From d703f437bae2f0bda43f38147be303a4e5627eff Mon Sep 17 00:00:00 2001 From: zurdi Date: Wed, 27 May 2026 11:51:47 +0000 Subject: [PATCH] feat: enhance GameListRow and GameListSkeletonRow with provider chips and update platform handling --- .../src/v2/components/Gallery/GameListRow.vue | 159 +++++++++++++----- .../Gallery/GameListSkeletonRow.vue | 6 +- .../src/v2/components/Gallery/listColumns.ts | 19 +-- .../components/GameActions/GameActionBtn.vue | 23 ++- .../v2/components/Scan/ScanPlatformRow.vue | 31 +--- frontend/src/v2/stores/galleryRoms.ts | 1 + frontend/src/v2/utils/metadataProviders.ts | 56 ++++++ 7 files changed, 206 insertions(+), 89 deletions(-) create mode 100644 frontend/src/v2/utils/metadataProviders.ts diff --git a/frontend/src/v2/components/Gallery/GameListRow.vue b/frontend/src/v2/components/Gallery/GameListRow.vue index 7a5ef1244..e8cd1227e 100644 --- a/frontend/src/v2/components/Gallery/GameListRow.vue +++ b/frontend/src/v2/components/Gallery/GameListRow.vue @@ -23,21 +23,22 @@ import { RCheckbox, RChip, - RIcon, RPlatformIcon, RSkeletonBlock, + RTooltip, } from "@v2/lib"; import { computed, onBeforeUnmount, onMounted } from "vue"; import { useI18n } from "vue-i18n"; import { useRouter } from "vue-router"; import storePlatforms from "@/stores/platforms"; import { formatBytes, toBrowserLocale } from "@/utils"; -import MoreMenu from "@/v2/components/GameActions/MoreMenu.vue"; +import GameActionBtn from "@/v2/components/GameActions/GameActionBtn.vue"; import GameCard from "@/v2/components/GameCard/GameCard.vue"; import { useGallerySelectionInput } from "@/v2/composables/useGallerySelectionInput"; import { useViewTransition } from "@/v2/composables/useViewTransition"; import storeGalleryRoms, { type SimpleRom } from "@/v2/stores/galleryRoms"; import storeGallerySelection from "@/v2/stores/gallerySelection"; +import { activeProviders } from "@/v2/utils/metadataProviders"; import { getListColumns, getListGridTemplate, @@ -47,6 +48,12 @@ import { defineOptions({ inheritAttrs: false }); +// Cap on how many language/region chips render before the `+N` overflow +// chip kicks in. Tuned so 4-chip lists fit on a single wrapped line +// inside the pills cell; longer lists stack to a second line with the +// `+N` chip pinned at the end. Full list lives in the RTooltip. +const PILLS_VISIBLE = 4; + interface Props { /** Absolute position in the active gallery (0-indexed). Drives the * row's per-row fetch + serves as the lookup key into the store's @@ -78,7 +85,7 @@ const selection = storeGallerySelection(); const selectionInput = useGallerySelectionInput(); const platformsStore = storePlatforms(); const { morphTransition } = useViewTransition(); -const { locale, t } = useI18n(); +const { locale } = useI18n(); const columns = computed(() => getListColumns(props.showPlatformColumn)); const listSkeletonColumns = columns; @@ -118,6 +125,11 @@ const platformMeta = computed(() => { return platformsStore.get(item.platform_id) ?? null; }); +const providers = computed(() => { + const item = rom.value; + return item ? activeProviders(item) : []; +}); + function formatDate(value: string | null | undefined): string { if (!value) return "—"; try { @@ -280,6 +292,26 @@ onBeforeUnmount(() => { {{ rom.name ?? rom.fs_name_no_ext }}
{{ rom.fs_name }}
+
+ + + +
@@ -290,7 +322,7 @@ onBeforeUnmount(() => { {{ platformMeta?.name ?? "—" }} @@ -304,45 +336,67 @@ onBeforeUnmount(() => {
{{ releaseDate(rom) }}
{{ ratingValue(rom) }}
-
+
{{ l }} + + +{{ (rom.languages?.length ?? 0) - PILLS_VISIBLE }} +
+
-
+
{{ r }} + + +{{ (rom.regions?.length ?? 0) - PILLS_VISIBLE }} +
+
- - - +
+ + +
@@ -373,10 +427,10 @@ onBeforeUnmount(() => {
-
+
- - + +
{ text-overflow: ellipsis; } +.game-list-row__providers { + display: flex; + align-items: center; + gap: 3px; + margin-top: 4px; + overflow: hidden; +} + +.game-list-row__provider { + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + border-radius: 4px; + background: var(--r-color-surface); + flex-shrink: 0; +} + +.game-list-row__provider img { + display: block; + object-fit: contain; +} + +/* Pills cell — chips wrap to multiple lines inside the cell when they + don't fit on a single row, so short language/region lists read as a + single horizontal strip and longer lists stack vertically. The cell + keeps `overflow: hidden` (defense against extreme lists) and the + row's fixed 80px height clips anything past ~3 wrapped lines; the + full list is available via the cell's `title` tooltip. */ +.game-list-row__cell--pills { + white-space: normal; +} .game-list-row__pills { display: flex; - flex-wrap: nowrap; + flex-wrap: wrap; + align-content: center; gap: 3px; - overflow: hidden; + max-height: 100%; } .game-list-row__platform { @@ -523,24 +611,9 @@ onBeforeUnmount(() => { text-overflow: ellipsis; } -.game-list-row__more { - appearance: none; - background: transparent; - border: 0; - padding: var(--r-space-1); - border-radius: var(--r-radius-sm); +.game-list-row__actions { display: inline-flex; align-items: center; - justify-content: center; - color: var(--r-color-fg-muted); - cursor: pointer; - transition: - color var(--r-motion-fast) var(--r-motion-ease-out), - background var(--r-motion-fast) var(--r-motion-ease-out); -} -.game-list-row__more:hover, -.game-list-row__more:focus-visible { - color: var(--r-color-fg); - background: var(--r-color-surface-hover); + gap: 4px; } diff --git a/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue b/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue index c43cebd2a..5e889a73d 100644 --- a/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue +++ b/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue @@ -57,10 +57,10 @@ const gridStyle = computed(() => ({
-
+
- - + +
diff --git a/frontend/src/v2/components/Gallery/listColumns.ts b/frontend/src/v2/components/Gallery/listColumns.ts index d54d4e954..41d2c9a81 100644 --- a/frontend/src/v2/components/Gallery/listColumns.ts +++ b/frontend/src/v2/components/Gallery/listColumns.ts @@ -20,6 +20,7 @@ import { layout } from "@/v2/tokens"; export type ListSortKey = Extract< GalleryOrderKey, | "name" + | "platform_id" | "fs_size_bytes" | "created_at" | "first_release_date" @@ -29,13 +30,7 @@ export type ListSortKey = Extract< export interface ListColumn { /** Sort key (matches `galleryRoms.orderBy`). `null` for non-sortable * display-only columns (icon labels, action menus). */ - key: - | ListSortKey - | "select" - | "platform" - | "languages" - | "regions" - | "actions"; + key: ListSortKey | "select" | "languages" | "regions" | "actions"; /** Column header label. Empty string renders no text (used for the * leading select column + trailing actions column). */ label: string; @@ -60,11 +55,11 @@ export function getListColumns(showPlatform: boolean): readonly ListColumn[] { ]; if (showPlatform) { cols.push({ - key: "platform", + key: "platform_id", label: "Platform", - sortable: false, + sortable: true, align: "start", - skeletonWidth: 80, + skeletonWidth: 100, }); } cols.push( @@ -119,8 +114,8 @@ export function getListColumns(showPlatform: boolean): readonly ListColumn[] { * is inserted between `name` and `fs_size_bytes` when present so column * order matches the array. */ export function getListGridTemplate(showPlatform: boolean): string { - const platformTrack = showPlatform ? " 110px" : ""; - return `36px minmax(0, 1.6fr)${platformTrack} 88px 96px 84px 56px 110px 110px 56px`; + const platformTrack = showPlatform ? " 170px" : ""; + return `36px minmax(0, 1.6fr)${platformTrack} 88px 96px 84px 56px 110px 110px 88px`; } /** Default exports — the cross-platform variant. Used by the bootstrap- diff --git a/frontend/src/v2/components/GameActions/GameActionBtn.vue b/frontend/src/v2/components/GameActions/GameActionBtn.vue index 608d1c8d7..ad4841415 100644 --- a/frontend/src/v2/components/GameActions/GameActionBtn.vue +++ b/frontend/src/v2/components/GameActions/GameActionBtn.vue @@ -28,6 +28,9 @@ // glass → default translucent frosted-glass pill // surface → translucent grey, page-background friendly (Details) // emphasized → white-on-dark (used by Play in card + details) +// bare → no background or border, just the icon (list rows / +// inline strips where the row's own surface frames the +// control) // // `withLabel` turns the button into a pill with "Play" / "Download" / // etc. text next to the icon, matching the GameDetails Play CTA. @@ -69,8 +72,10 @@ interface Props { * (GameDetails header where the buttons sit on the * page background, not over a cover). * `emphasized` — primary white-on-dark CTA (Play). + * `bare` — no chrome; just the icon. For list rows where the row's + * own surface already frames the control. */ - variant?: "glass" | "surface" | "emphasized"; + variant?: "glass" | "surface" | "emphasized" | "bare"; withLabel?: boolean; /** * Status-only: when several status states are active, the button @@ -601,6 +606,22 @@ function onClick(e: MouseEvent) { color: var(--r-color-fg); } +/* Bare — no chrome. The active-state colour swap (`--active-favorite` + etc.) still applies because it overrides `color` only. Hover paints a + subtle surface tint so the hit-target reads. */ +.r-v2-game-btn--bare { + background: transparent; + border-color: transparent; + color: var(--r-color-fg-muted); + backdrop-filter: none; + -webkit-backdrop-filter: none; +} +.r-v2-game-btn--bare:hover { + background: var(--r-color-surface-hover); + border-color: transparent; + color: var(--r-color-fg); +} + /* Emphasized — the primary-action look (white on dark). Used by Play. */ .r-v2-game-btn--emphasized { background: var(--r-color-overlay-emphasis-bg) !important; diff --git a/frontend/src/v2/components/Scan/ScanPlatformRow.vue b/frontend/src/v2/components/Scan/ScanPlatformRow.vue index 51edc7594..dcf8b93d3 100644 --- a/frontend/src/v2/components/Scan/ScanPlatformRow.vue +++ b/frontend/src/v2/components/Scan/ScanPlatformRow.vue @@ -11,6 +11,7 @@ import { ROUTES } from "@/plugins/router"; import type { SimpleRom } from "@/stores/roms"; import { getMissingCoverImage, getUnmatchedCoverImage } from "@/utils/covers"; import { useWebpSupport } from "@/v2/composables/useWebpSupport"; +import { activeProviders } from "@/v2/utils/metadataProviders"; defineOptions({ inheritAttrs: false }); @@ -21,36 +22,6 @@ const props = defineProps<{ const { t } = useI18n(); const { toWebp } = useWebpSupport(); -interface Provider { - key: string; - title: string; - logo: string; - bg?: string; -} -const PROVIDERS: readonly Provider[] = [ - { key: "hasheous_id", title: "Verified with Hasheous", logo: "hasheous.png" }, - { key: "igdb_id", title: "IGDB match", logo: "igdb.png" }, - { key: "ss_id", title: "ScreenScraper match", logo: "ss.png" }, - { key: "moby_id", title: "MobyGames match", logo: "moby.png" }, - { - key: "launchbox_id", - title: "LaunchBox match", - logo: "launchbox.png", - bg: "#185a7c", - }, - { key: "ra_id", title: "RetroAchievements match", logo: "ra.png" }, - { key: "flashpoint_id", title: "Flashpoint match", logo: "flashpoint.png" }, - { key: "hltb_id", title: "HowLongToBeat match", logo: "hltb.png" }, - { key: "gamelist_id", title: "ES-DE match", logo: "esde.png" }, - { key: "libretro_id", title: "Libretro match", logo: "libretro.png" }, -]; - -function activeProviders(rom: SimpleRom) { - return PROVIDERS.filter((p) => - Boolean((rom as Record)[p.key]), - ); -} - function coverFor(rom: SimpleRom): string { if (rom.path_cover_small) return toWebp(rom.path_cover_small); // Fallback procedural cover — distinct artwork for identified vs. diff --git a/frontend/src/v2/stores/galleryRoms.ts b/frontend/src/v2/stores/galleryRoms.ts index c5fb78cd4..2376a2a12 100644 --- a/frontend/src/v2/stores/galleryRoms.ts +++ b/frontend/src/v2/stores/galleryRoms.ts @@ -46,6 +46,7 @@ export type SimpleRom = SimpleRomSchema; export type GalleryOrderKey = | "name" | "fs_name" + | "platform_id" | "fs_size_bytes" | "created_at" | "updated_at" diff --git a/frontend/src/v2/utils/metadataProviders.ts b/frontend/src/v2/utils/metadataProviders.ts new file mode 100644 index 000000000..21a4c69d7 --- /dev/null +++ b/frontend/src/v2/utils/metadataProviders.ts @@ -0,0 +1,56 @@ +// Metadata-provider registry — single source of truth for the small +// provider chips that appear next to a ROM (gallery list rows, scan +// rows, future surfaces). One entry per provider gives label + logo +// path + (optional) brand-colour background; consumers iterate and +// filter to the providers whose id field is populated on the ROM. +import type { SimpleRom } from "@/stores/roms"; + +/** Subset of `SimpleRom` fields that hold a matched provider id. Keying + * the list against this type means a typo or a removed field is a + * compile error, not a silent miss. */ +export type ProviderIdKey = + | "hasheous_id" + | "igdb_id" + | "ss_id" + | "moby_id" + | "launchbox_id" + | "ra_id" + | "flashpoint_id" + | "hltb_id" + | "gamelist_id" + | "libretro_id"; + +export interface MetadataProvider { + /** Field on `SimpleRom` that holds this provider's match id. */ + key: ProviderIdKey; + /** Tooltip text — also serves as the chip's `alt`. */ + title: string; + /** File under `/assets/scrappers/`. */ + logo: string; + /** Brand background tint when the logo needs one to read on the chip + * (LaunchBox ships a white isotype that disappears on a light chip). */ + bg?: string; +} + +export const METADATA_PROVIDERS: readonly MetadataProvider[] = [ + { key: "hasheous_id", title: "Verified with Hasheous", logo: "hasheous.png" }, + { key: "igdb_id", title: "IGDB match", logo: "igdb.png" }, + { key: "ss_id", title: "ScreenScraper match", logo: "ss.png" }, + { key: "moby_id", title: "MobyGames match", logo: "moby.png" }, + { + key: "launchbox_id", + title: "LaunchBox match", + logo: "launchbox.png", + bg: "#185a7c", + }, + { key: "ra_id", title: "RetroAchievements match", logo: "ra.png" }, + { key: "flashpoint_id", title: "Flashpoint match", logo: "flashpoint.png" }, + { key: "hltb_id", title: "HowLongToBeat match", logo: "hltb.png" }, + { key: "gamelist_id", title: "ES-DE match", logo: "esde.png" }, + { key: "libretro_id", title: "Libretro match", logo: "libretro.png" }, +]; + +/** Returns the providers whose id field is populated on the given ROM. */ +export function activeProviders(rom: SimpleRom): MetadataProvider[] { + return METADATA_PROVIDERS.filter((p) => Boolean(rom[p.key])); +}