From 367626c21e9f629ef49702200f658921f8c9e9bd Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 22 Jun 2026 07:48:52 -0400 Subject: [PATCH 1/6] some UI tweaks --- .../v2/components/Gallery/GalleryShell.vue | 34 +++++++- .../v2/components/Gallery/GameListHeader.vue | 9 ++- .../src/v2/components/Gallery/GameListRow.vue | 23 ++++-- .../Gallery/GameListSkeletonRow.vue | 12 ++- .../src/v2/components/Gallery/listColumns.ts | 13 +++- .../GameDetails/RelatedGamesGrid.vue | 4 - .../src/v2/components/shared/GameCover.vue | 21 +++-- .../useGalleryCoverRatios/index.test.ts | 14 ++-- .../useGalleryCoverRatios/index.ts | 78 +++++++++++++++++-- .../v2/composables/useViewTransition/index.ts | 10 ++- frontend/src/v2/views/Player/EmulatorJS.vue | 21 ++++- frontend/src/v2/views/Player/Ruffle.vue | 20 ++++- 12 files changed, 218 insertions(+), 41 deletions(-) diff --git a/frontend/src/v2/components/Gallery/GalleryShell.vue b/frontend/src/v2/components/Gallery/GalleryShell.vue index 49f61e33f..0c62a7485 100644 --- a/frontend/src/v2/components/Gallery/GalleryShell.vue +++ b/frontend/src/v2/components/Gallery/GalleryShell.vue @@ -57,7 +57,11 @@ import GameListHeader from "@/v2/components/Gallery/GameListHeader.vue"; import GameListRow from "@/v2/components/Gallery/GameListRow.vue"; import GameListSkeletonRow from "@/v2/components/Gallery/GameListSkeletonRow.vue"; import SelectionBar from "@/v2/components/Gallery/SelectionBar.vue"; -import { type ListSortKey } from "@/v2/components/Gallery/listColumns"; +import { + LIST_COVER_HEIGHT_PX, + LIST_COVER_WIDTH_PX, + type ListSortKey, +} from "@/v2/components/Gallery/listColumns"; import { GameCard, GameCardSkeleton } from "@/v2/components/GameCard"; import { useBreakpoint } from "@/v2/composables/useBreakpoint"; import { coverRatio, isBoxartStyle } from "@/v2/composables/useCoverArt"; @@ -266,7 +270,19 @@ const coverAspectRatio = computed(() => // Measured natural cover ratios feeding the flow-packer — GameCard reports // each cover's ratio on load (`onCardRatio`), the packer reads `ratioAt`, // and `ratioVersion` bumps (debounced) to trigger a single re-pack. -const { ratioVersion, ratioAt, onCardRatio } = useGalleryCoverRatios(); +// `maxRatio` (widest cover in this gallery) drives the list view's cover +// column width. +const { ratioVersion, ratioAt, onCardRatio, maxRatio, resetMaxRatio } = + useGalleryCoverRatios(); + +// List-view cover column width: the widest cover at the row's cover height, +// clamped so a portrait-only list stays tight and an outlier can't make the +// column absurd. Wide (landscape) covers then show whole instead of being +// clipped, and every row shares the width so titles stay aligned. +const listCoverWidth = computed(() => { + const w = Math.round(LIST_COVER_HEIGHT_PX * maxRatio.value); + return Math.min(128, Math.max(LIST_COVER_WIDTH_PX, w)); +}); // 2D arrow / gamepad nav for both layouts of the gallery. Two passes: // * Grid mode — rows are `.r-v2-shell__row` (the per-virtualizer-item @@ -511,6 +527,15 @@ watch(virtualItems, () => { syncFetches(viewportRange.value); }); +// Recompute the list cover-column max when the gallery's rom set changes +// (context switch, filter, sort) so a previous platform's wide covers +// don't keep the column wide. Keyed on `romIdIndex` (not `virtualItems`) +// so grid re-packs don't trigger the O(total) rebuild. +watch( + () => galleryRoms.romIdIndex, + () => resetMaxRatio(), +); + // List mode pins a column header below the toolbar; AlphaStrip jumps // must land BELOW both pinned bars or the destination row would slide // behind the column header. Matches the height set in @@ -773,6 +798,7 @@ defineExpose({ :sort-key="listSortKey" :sort-dir="orderDir" :show-platform-column="showPlatformColumn" + :cover-width="listCoverWidth" @sort="onListSort" /> @@ -817,11 +843,14 @@ defineExpose({ :position="asListRow(item as GalleryItem).position" :webp="supportsWebp" :show-platform-column="showPlatformColumn" + :cover-width="listCoverWidth" + @ratio="onCardRatio" />
diff --git a/frontend/src/v2/components/Gallery/GameListHeader.vue b/frontend/src/v2/components/Gallery/GameListHeader.vue index ad01905e6..7a4cc4893 100644 --- a/frontend/src/v2/components/Gallery/GameListHeader.vue +++ b/frontend/src/v2/components/Gallery/GameListHeader.vue @@ -32,10 +32,14 @@ interface Props { * name on `GameListRow` + `GameListSkeletonRow` so all three stay in * lockstep. */ showPlatformColumn?: boolean; + /** Width of the cover column (px) — shared with every row so the title + * column aligns. Set by the shell from the gallery's widest cover. */ + coverWidth?: number; } const props = withDefaults(defineProps(), { showPlatformColumn: true, + coverWidth: 48, }); const emit = defineEmits<{ @@ -45,7 +49,10 @@ const emit = defineEmits<{ const { t } = useI18n(); const columns = computed(() => getListColumns(props.showPlatformColumn)); const gridStyle = computed(() => ({ - gridTemplateColumns: getListGridTemplate(props.showPlatformColumn), + gridTemplateColumns: getListGridTemplate( + props.showPlatformColumn, + props.coverWidth, + ), })); const galleryRoms = storeGalleryRoms(); diff --git a/frontend/src/v2/components/Gallery/GameListRow.vue b/frontend/src/v2/components/Gallery/GameListRow.vue index 1615220b8..4ab21ee22 100644 --- a/frontend/src/v2/components/Gallery/GameListRow.vue +++ b/frontend/src/v2/components/Gallery/GameListRow.vue @@ -72,6 +72,9 @@ interface Props { /** Include the `platform` column. Mirrors `GameListHeader` so the row * stays aligned with the column header above it. */ showPlatformColumn?: boolean; + /** Cover column width (px) — shared with the header so the title column + * aligns. Set by the shell from the gallery's widest cover. */ + coverWidth?: number; } const props = withDefaults(defineProps(), { @@ -79,8 +82,15 @@ const props = withDefaults(defineProps(), { rom: undefined, webp: false, showPlatformColumn: true, + coverWidth: 48, }); +const emit = defineEmits<{ + /** Forwards the cover's measured natural ratio so the shell can size the + * cover column to the gallery's widest cover. */ + (e: "ratio", payload: { romId: number; ratio: number }): void; +}>(); + const router = useRouter(); const galleryRoms = storeGalleryRoms(); const selection = storeGallerySelection(); @@ -121,7 +131,10 @@ function onCheckboxClick(e: MouseEvent) { } const gridStyle = computed(() => ({ - gridTemplateColumns: getListGridTemplate(props.showPlatformColumn), + gridTemplateColumns: getListGridTemplate( + props.showPlatformColumn, + props.coverWidth, + ), })); const platformMeta = computed(() => { @@ -321,6 +334,7 @@ onBeforeUnmount(() => { decorative :show-title="false" :show-platform-icon="false" + @ratio="emit('ratio', $event)" />
@@ -579,13 +593,12 @@ onBeforeUnmount(() => { justify-content: flex-end; } -/* Cover sits in its own fixed-width column (right-aligned, vertically - centred) so the title/meta column starts at the same x on every row and - the cover hugs the title side. */ +/* Cover sits in its own fixed-width column (centred) so the title/meta + column starts at the same x on every row. */ .game-list-row__cover { display: flex; align-items: center; - justify-content: flex-end; + justify-content: center; } .game-list-row__title { diff --git a/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue b/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue index 7869c76df..a41c40968 100644 --- a/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue +++ b/frontend/src/v2/components/Gallery/GameListSkeletonRow.vue @@ -27,15 +27,21 @@ interface Props { * `GameListRow` so the bootstrap-phase skeleton stays aligned with * whichever variant the surrounding list is rendering. */ showPlatformColumn?: boolean; + /** Cover column width (px) — shared with the header / rows. */ + coverWidth?: number; } const props = withDefaults(defineProps(), { showPlatformColumn: true, + coverWidth: 48, }); const columns = computed(() => getListColumns(props.showPlatformColumn)); const gridStyle = computed(() => ({ - gridTemplateColumns: getListGridTemplate(props.showPlatformColumn), + gridTemplateColumns: getListGridTemplate( + props.showPlatformColumn, + props.coverWidth, + ), })); @@ -112,11 +118,11 @@ const gridStyle = computed(() => ({ justify-content: flex-end; } -/* Right-align the cover block to match the real row. */ +/* Centre the cover block to match the real row. */ .r-glr-skel__cover { display: flex; align-items: center; - justify-content: flex-end; + justify-content: center; } .r-glr-skel__title { diff --git a/frontend/src/v2/components/Gallery/listColumns.ts b/frontend/src/v2/components/Gallery/listColumns.ts index fa6327f44..583d6cd22 100644 --- a/frontend/src/v2/components/Gallery/listColumns.ts +++ b/frontend/src/v2/components/Gallery/listColumns.ts @@ -116,11 +116,16 @@ export function getListColumns(showPlatform: boolean): readonly ListColumn[] { /** CSS-grid template paired with `getListColumns`. The `platform` slot * is inserted between `name` and `fs_size_bytes` when present so column * order matches the array. */ -export function getListGridTemplate(showPlatform: boolean): string { +export function getListGridTemplate( + showPlatform: boolean, + coverWidthPx = 48, +): string { const platformTrack = showPlatform ? " 200px" : ""; - // Cover track = the xs cover height (64px), so any portrait→square cover - // fits without clipping and the title column starts at a fixed x. - return `36px 64px minmax(0, 1.6fr)${platformTrack} 88px 96px 84px 56px 110px 110px 88px`; + // Cover track widens to the widest cover in the gallery (set by the + // shell from measured ratios), so landscape covers show whole instead of + // being clipped, while portrait-only lists stay tight. The title column + // starts at a fixed x because every row shares this width. + return `36px ${coverWidthPx}px 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/GameDetails/RelatedGamesGrid.vue b/frontend/src/v2/components/GameDetails/RelatedGamesGrid.vue index cf400c8c7..5736a0116 100644 --- a/frontend/src/v2/components/GameDetails/RelatedGamesGrid.vue +++ b/frontend/src/v2/components/GameDetails/RelatedGamesGrid.vue @@ -29,10 +29,6 @@ defineProps<{ From 4a49a762a8bc3cca12c520637c6c5f412e42f1d6 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Mon, 22 Jun 2026 12:19:03 -0400 Subject: [PATCH 4/6] fix(v2): port cover animations to v1's compose-by-property model MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rework useCoverAnimation to mirror v1's useGameAnimation, which composes two motions on different CSS properties so they don't fight: the spin owns `transform: rotate` (set per-frame) while the disc/cartridge slot-in owns `margin-top` (eased in CSS with an overshoot). A single transform for both couldn't ease the slide independently of the per-frame spin. - CD launch spins at max while sliding the cover down into the drive; cartridge launch seats fully into its bay (1/3 height). - Drop the cartridge hover animation entirely — matches v1, which only spins discs and plays the hover video on hover. - Enable hover-motion on the EmulatorJS and Ruffle player heroes so the hover spin / video work there too. - Fix a `.ame-cover__img` typo (missing "g") that was silently breaking the cover image base styles, and ease `margin` in CSS on `.game-cover__img` so the slide composes with the bloom reveal instead of overriding it. Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/v2/components/shared/GameCover.vue | 15 +- .../v2/composables/useCoverAnimation/index.ts | 222 ++++++++---------- frontend/src/v2/views/Player/EmulatorJS.vue | 1 + frontend/src/v2/views/Player/Ruffle.vue | 1 + 4 files changed, 107 insertions(+), 132 deletions(-) diff --git a/frontend/src/v2/components/shared/GameCover.vue b/frontend/src/v2/components/shared/GameCover.vue index bc7d88266..8361ddaa9 100644 --- a/frontend/src/v2/components/shared/GameCover.vue +++ b/frontend/src/v2/components/shared/GameCover.vue @@ -163,6 +163,7 @@ const coverActive = computed( const { isVideoPlaying, playLoad } = useCoverAnimation({ el: imgEl, + containerEl: rootEl, videoEl, animateCD: art.animateCD, animateCartridge: art.animateCartridge, @@ -302,22 +303,24 @@ defineExpose({ background: transparent; } -/* Direct-child selector so the placeholder's own isn't matched. */ -.ame-cover__img { +/* The cover image. (The placeholder's own uses its own class.) */ +.game-cover__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; - /* Three motions ride this , each on its own property so they never + /* Four motions ride this , each on its own property so they never clobber each other: opacity crossfades to the hover video, filter + - scale drive the blur-up reveal on first paint, and the spin owns - `rotate` (set imperatively in useCoverAnimation). */ + scale drive the blur-up reveal on first paint, the spin owns `transform` + (set per-frame in useCoverAnimation), and `margin-top` is the + cartridge/disc slot-in slide (eased here so it composes with the spin). */ transition: opacity 0.35s ease, filter 0.6s ease, - scale 0.65s cubic-bezier(0.22, 1, 0.36, 1); + scale 0.65s cubic-bezier(0.22, 1, 0.36, 1), + margin 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); } .game-cover__img--behind { opacity: 0; diff --git a/frontend/src/v2/composables/useCoverAnimation/index.ts b/frontend/src/v2/composables/useCoverAnimation/index.ts index 11b58b623..2df4c980b 100644 --- a/frontend/src/v2/composables/useCoverAnimation/index.ts +++ b/frontend/src/v2/composables/useCoverAnimation/index.ts @@ -1,18 +1,25 @@ // useCoverAnimation — the "juicy" motion layer for alt-art game covers. // -// v2 rebuild of v1's deprecated `useGameAnimation` against a raw -// (v2 has no Vuetify VImg internals). Three behaviours, all driven by the -// card's hover/focus `active` signal and the flags `useCoverArt` resolves: -// * CD spin — physical art on a CD-based platform spins up on -// hover (accelerate) and coasts down on leave. -// * Cartridge — physical art on a cartridge platform does a one-shot -// "slot-in" drop when first hovered. -// * Hover video — miximage art crossfades to its `path_video` clip a -// beat after hover, and resets on leave. +// v2 port of v1's `useGameAnimation` (which drove a Vuetify VImg; v2 drives a +// raw ). Three behaviours, all gated by the card's hover/focus `active` +// signal and the flags `useCoverArt` resolves: +// * CD spin — physical art on a CD platform spins up on hover +// (accelerate) and coasts down on leave. The launch +// flourish spins it at max while it slides down into the +// drive and vanishes. +// * Cartridge — physical art on a cartridge platform seats fully into +// its bay on launch (no hover animation, matching v1). +// * Hover video — miximage art crossfades to its `path_video` clip a beat +// after hover, and resets on leave. +// +// The v1 trick (kept here because it's the part that makes it feel right): +// the slide is `margin-top` with an overshoot transition, while the spin is +// `transform: rotate` — two *different* properties, so they compose. A single +// `transform` for both can't be eased independently (the per-frame spin would +// fight the eased slide). // // All motion is gated by the user's `disableAnimations` setting (via -// `motionEnabled`) AND the OS `prefers-reduced-motion` — when either says -// no, the cover stays a still image. +// `motionEnabled`) AND the OS `prefers-reduced-motion`. import { computed, onBeforeUnmount, @@ -31,22 +38,31 @@ export interface SpinConfig { decel: number; } -// Mirrors v1's ANIMATION_CONFIG (maxRotationSpeed / acceleration / -// deceleration), kept as deg/sec(²) for the frame-rate-independent step. +// Mirrors v1's ANIMATION_CONFIG, kept as deg/sec(²) for the frame-rate- +// independent step. export const SPIN_CONFIG: SpinConfig = { maxSpeed: 5000, accel: 2500, decel: 1500, }; +// Cartridge slot-in depth on launch, as a fraction of the cover height +// (v1 seated at 1/3 on play). There is no cartridge hover animation. +const CART_SEAT_FRACTION = 1 / 3; + +// How long the player waits (ms) for the launch flourish before booting — +// the margin transition is 500ms; a little extra lets the motion read. +const CD_LOAD_MS = 700; +const CART_LOAD_MS = 600; + // Delay before the hover video kicks in, so fast scans across the gallery -// don't fire a burst of