Skip to content

Commit

Permalink
Fixing misc minor issues encountered with fedorov compton rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
boggydigital committed Oct 30, 2024
1 parent 2bb6ac4 commit fac8b6f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 107 deletions.
59 changes: 0 additions & 59 deletions rest/compton_data/product_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ import (
)

var ProductProperties = []string{
vangogh_local_data.TitleProperty,

vangogh_local_data.DehydratedImageProperty,
vangogh_local_data.ImageProperty,

vangogh_local_data.ProductTypeProperty,
vangogh_local_data.TagIdProperty,
vangogh_local_data.LocalTagsProperty,

vangogh_local_data.WishlistedProperty,
vangogh_local_data.DiscountPercentageProperty,
vangogh_local_data.PriceProperty,
vangogh_local_data.BasePriceProperty,
vangogh_local_data.OperatingSystemsProperty,
vangogh_local_data.HLTBPlatformsProperty,
vangogh_local_data.RatingProperty,
Expand Down Expand Up @@ -45,65 +38,13 @@ var ProductProperties = []string{
vangogh_local_data.RequiresGamesProperty,
vangogh_local_data.IsRequiredByGamesProperty,

vangogh_local_data.StoreUrlProperty,
vangogh_local_data.ForumUrlProperty,
vangogh_local_data.SupportUrlProperty,
vangogh_local_data.SteamAppIdProperty,
vangogh_local_data.PCGWPageIdProperty,
vangogh_local_data.HLTBIdProperty,
vangogh_local_data.IGDBIdProperty,
vangogh_local_data.StrategyWikiIdProperty,
vangogh_local_data.MobyGamesIdProperty,
vangogh_local_data.WikipediaIdProperty,
vangogh_local_data.WineHQIdProperty,
vangogh_local_data.VNDBIdProperty,
vangogh_local_data.IGNWikiSlugProperty,

vangogh_local_data.HLTBHoursToCompleteMainProperty,
vangogh_local_data.HLTBHoursToCompletePlusProperty,
vangogh_local_data.HLTBHoursToComplete100Property,

vangogh_local_data.OwnedProperty,
vangogh_local_data.IsFreeProperty,
vangogh_local_data.IsDiscountedProperty,
vangogh_local_data.PreOrderProperty,
vangogh_local_data.ComingSoonProperty,
vangogh_local_data.InDevelopmentProperty,
vangogh_local_data.ValidationResultProperty,
}

var ProductExternalLinksProperties = []string{
GauginGOGLinksProperty,
GauginSteamLinksProperty,
GauginOtherLinksProperty,
}

var ProductHiddenProperties = []string{
vangogh_local_data.TitleProperty,
vangogh_local_data.DehydratedImageProperty,
vangogh_local_data.ImageProperty,
vangogh_local_data.OwnedProperty,
vangogh_local_data.ValidationResultProperty,
vangogh_local_data.ProductTypeProperty,
vangogh_local_data.ComingSoonProperty,
vangogh_local_data.PreOrderProperty,
vangogh_local_data.InDevelopmentProperty,
vangogh_local_data.IsFreeProperty,
vangogh_local_data.IsDiscountedProperty,
vangogh_local_data.BasePriceProperty,
vangogh_local_data.DiscountPercentageProperty,
vangogh_local_data.ValidationResultProperty,
vangogh_local_data.StoreUrlProperty,
vangogh_local_data.ForumUrlProperty,
vangogh_local_data.SupportUrlProperty,
vangogh_local_data.SteamAppIdProperty,
vangogh_local_data.PCGWPageIdProperty,
vangogh_local_data.HLTBIdProperty,
vangogh_local_data.IGDBIdProperty,
vangogh_local_data.StrategyWikiIdProperty,
vangogh_local_data.MobyGamesIdProperty,
vangogh_local_data.WikipediaIdProperty,
vangogh_local_data.WineHQIdProperty,
vangogh_local_data.VNDBIdProperty,
vangogh_local_data.IGNWikiSlugProperty,
}
2 changes: 1 addition & 1 deletion rest/compton_data/section_styles.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ var SectionStyles = map[string]string{
SteamNewsSection: "steam-news.css",
SteamReviewsSection: "steam-reviews.css",
SteamDeckSection: "steam-deck.css",
DownloadsSection: "downloads.css",
DownloadsSection: "",
}
23 changes: 5 additions & 18 deletions rest/compton_data/section_titles.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package compton_data

const (
ChangelogSection = "changelog"
DescriptionSection = "description"
DownloadsSection = "downloads"
ExternalLinksSection = "links"
PropertiesSection = "properties"
ExternalLinksSection = "links"
DescriptionSection = "description"
ChangelogSection = "changelog"
ScreenshotsSection = "screenshots"
VideosSection = "videos"
SteamNewsSection = "steam-news"
SteamReviewsSection = "steam-reviews"
SteamDeckSection = "steam-deck"
VideosSection = "videos"
DownloadsSection = "downloads"
)

var SectionTitles = map[string]string{
Expand All @@ -25,16 +25,3 @@ var SectionTitles = map[string]string{
SteamDeckSection: "Steam Deck",
VideosSection: "Videos",
}

var SectionsTitlesOrder = []string{
SectionTitles[PropertiesSection],
SectionTitles[ExternalLinksSection],
SectionTitles[DescriptionSection],
SectionTitles[ChangelogSection],
SectionTitles[ScreenshotsSection],
SectionTitles[VideosSection],
SectionTitles[SteamNewsSection],
SectionTitles[SteamReviewsSection],
SectionTitles[SteamDeckSection],
SectionTitles[DownloadsSection],
}
3 changes: 0 additions & 3 deletions rest/compton_fragments/product_properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func ProductProperties(r compton.Registrar, id string, rdx kevlar.ReadableRedux)
grid := compton.GridItems(r).JustifyContent(align.Center)

for _, property := range compton_data.ProductProperties {
if slices.Contains(compton_data.ProductHiddenProperties, property) {
continue
}

if property == vangogh_local_data.OperatingSystemsProperty {
if tv := operatingSystemsTitleValues(r, id, rdx); tv != nil {
Expand Down
9 changes: 8 additions & 1 deletion rest/compton_pages/downloads.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ var downloadTypesStrings = map[vangogh_local_data.DownloadType]string{
vangogh_local_data.Movie: "Movie",
}

var downloadTypesColors = map[vangogh_local_data.DownloadType]color.Color{
vangogh_local_data.Installer: color.Purple,
vangogh_local_data.DLC: color.Indigo,
vangogh_local_data.Extra: color.Orange,
vangogh_local_data.Movie: color.Red,
}

// Downloads will present available installers, DLCs in the following hierarchy:
// - Operating system heading - Installers and DLCs (separately)
// - title_values list of downloads by version
Expand Down Expand Up @@ -161,7 +168,7 @@ func operatingSystemHeading(r compton.Registrar, os vangogh_local_data.Operating
func downloadVariant(r compton.Registrar, dv *DownloadVariant) compton.Element {

fr := compton.Frow(r).
Icon(dv.dlType.String()).
IconColor(downloadTypesColors[dv.dlType]).
Heading(downloadTypesStrings[dv.dlType])

if dv.langCode != "" {
Expand Down
4 changes: 2 additions & 2 deletions rest/compton_pages/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ func Product(id string, rdx kevlar.ReadableRedux, hasSections []string, extLinks

/* Product details sections */

for _, section := range hasSections {
for ii, section := range hasSections {

sectionTitle := compton_data.SectionTitles[section]
summaryHeading := compton.DSTitle(p, sectionTitle)
detailsSummary := compton.DSLarge(p, summaryHeading, section == compton_data.PropertiesSection).
detailsSummary := compton.DSLarge(p, summaryHeading, ii == 0).
BackgroundColor(color.Highlight).
ForegroundColor(color.Foreground).
MarkerColor(color.Gray).
Expand Down
22 changes: 0 additions & 22 deletions rest/compton_styles/downloads.css

This file was deleted.

3 changes: 2 additions & 1 deletion rest/get_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ func GetSearch(w http.ResponseWriter, r *http.Request) {
}
desc := q.Get(vangogh_local_data.DescendingProperty) == "true"

var err error
found := rdx.Match(q)

var err error
ids, err = rdx.Sort(found, desc, sort, vangogh_local_data.TitleProperty, vangogh_local_data.ProductTypeProperty)
if err != nil {
http.Error(w, nod.Error(err).Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit fac8b6f

Please sign in to comment.