fix(v2): address the code-review pass on the list view

- Stop the pinned index header from subtracting the gutter twice, which
  pushed its glass past the right edge and scrolled the page sideways.
- Give the compact skeleton row the tick-column spacer the real row has,
  so covers and titles don't jump when the first window resolves.
- Name the sort menu "Sort by" when the gallery's order is one the
  columns don't carry, instead of claiming the first column.
- Paint a rolling counter's starting value before the first frame, which
  a background tab never serves.
- Dispose the expansion animation with its scope.
- Drop the selection notch's live region, which read out every frame of
  the roll, for a labelled image.
- Apply the letter-jump deadline on the scroll-end path too.
- Localise the platforms row's game count on desktop as the compact row
  already did.
- Delete rules and constants the compact branches made unreachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bZ7R3xC73MZu1vTNuatPK
This commit is contained in:
zurdi
2026-09-20 19:31:16 +02:00
parent 13a1a96c79
commit 32eb667606
13 changed files with 114 additions and 100 deletions

View File

@@ -671,11 +671,23 @@ function endLetterJump() {
jumpLetter.value = null;
}
/** The letter still worth correcting towards, or null once the cap is up. */
function pendingJumpLetter(): string | null {
const letter = jumpLetter.value;
if (!letter) return null;
if (Date.now() > jumpDeadline) {
endLetterJump();
return null;
}
return letter;
}
// The smooth scroll animates towards the target the jump computed; anything
// that moved meanwhile (a re-pack, the header rendering) leaves it short, so
// settle onto the letter once the animation stops.
function onScrollEnd() {
if (jumpLetter.value) anchorLetter(jumpLetter.value, false);
const letter = pendingJumpLetter();
if (letter) anchorLetter(letter, false);
}
// Three things move a letter out from under the toolbar after the jump: the
@@ -689,13 +701,8 @@ watch(
() => galleryRoms.loadedWindows.size,
],
() => {
const letter = jumpLetter.value;
if (!letter) return;
if (Date.now() > jumpDeadline) {
endLetterJump();
return;
}
anchorLetter(letter, false);
const letter = pendingJumpLetter();
if (letter) anchorLetter(letter, false);
},
);

View File

@@ -56,11 +56,13 @@ const gridStyle = computed(() => ({
const { smAndDown } = useBreakpoint();
const compact = computed(() => smAndDown.value);
const sortOptions = computed(() => getSortOptions(props.showPlatformColumn));
// `sortKey` is null whenever the gallery's order is one the columns don't
// carry (`last_played`, `fs_name`, …); naming a column there would claim a
// sort that isn't in effect.
const sortLabel = computed(
() =>
sortOptions.value.find((option) => option.key === props.sortKey)?.label ??
sortOptions.value[0]?.label ??
"",
t("gallery.sort-by"),
);
const selection = storeGallerySelection();

View File

@@ -74,7 +74,7 @@ interface Props {
showPlatformColumn?: boolean;
/** Offer the chevron that opens the detail panel (phones and tablets).
* Only for surfaces whose virtualiser accounts for the taller row —
* the gallery shell does, via `expandedPosition`. */
* both callers do, via `useListExpansion`. */
expandable?: boolean;
/** Whether this row's detail panel is open. */
expanded?: boolean;
@@ -481,7 +481,6 @@ function onRowPointerEnd() {
<span
v-if="providers.length > 0"
class="game-list-row__providers"
@click.stop
>
<span
v-for="provider in providers"
@@ -722,68 +721,70 @@ function onRowPointerEnd() {
<!-- Column-driven, so the per-cell shapes stay in step with
`GameListSkeletonRow` and the row does not reflow on data arrival. -->
<template
v-for="col in compact ? [] : listSkeletonColumns"
:key="String(col.key)"
>
<div
v-if="col.key === 'select'"
class="game-list-row__cell game-list-row__select"
>
<!-- Empty cell during skeleton phase — no placeholder so the
<template v-else>
<template v-for="col in listSkeletonColumns" :key="String(col.key)">
<div
v-if="col.key === 'select'"
class="game-list-row__cell game-list-row__select"
>
<!-- Empty cell during skeleton phase — no placeholder so the
selection chrome only appears once a real row exists. -->
</div>
<div
v-else-if="col.key === 'cover'"
class="game-list-row__cell game-list-row__cover"
>
<RSkeletonBlock
:width="LIST_COVER_WIDTH_PX"
:height="LIST_COVER_HEIGHT_PX"
/>
</div>
<div
v-else-if="col.key === 'name'"
class="game-list-row__cell game-list-row__title"
>
<div class="game-list-row__meta" :style="titleSkeletonGapStyle">
</div>
<div
v-else-if="col.key === 'cover'"
class="game-list-row__cell game-list-row__cover"
>
<RSkeletonBlock
v-for="(bar, i) in LIST_TITLE_SKELETON_BARS"
:key="i"
:width="bar.width"
:height="bar.height"
:width="LIST_COVER_WIDTH_PX"
:height="LIST_COVER_HEIGHT_PX"
/>
</div>
</div>
<div v-else-if="col.key === 'platform_id'" class="game-list-row__cell">
<div class="game-list-row__platform">
<RSkeletonBlock :width="24" :height="24" circle />
<RSkeletonBlock :width="100" :height="10" />
<div
v-else-if="col.key === 'name'"
class="game-list-row__cell game-list-row__title"
>
<div class="game-list-row__meta" :style="titleSkeletonGapStyle">
<RSkeletonBlock
v-for="(bar, i) in LIST_TITLE_SKELETON_BARS"
:key="i"
:width="bar.width"
:height="bar.height"
/>
</div>
</div>
</div>
<div
v-else-if="col.key === 'languages' || col.key === 'regions'"
class="game-list-row__cell"
>
<div class="game-list-row__pills">
<RSkeletonBlock :width="28" :height="16" rounded="pill" />
<RSkeletonBlock :width="28" :height="16" rounded="pill" />
<div
v-else-if="col.key === 'platform_id'"
class="game-list-row__cell"
>
<div class="game-list-row__platform">
<RSkeletonBlock :width="24" :height="24" circle />
<RSkeletonBlock :width="100" :height="10" />
</div>
</div>
</div>
<div
v-else-if="col.key === 'actions'"
class="game-list-row__cell"
:class="cellModifiers('actions')"
>
<RSkeletonBlock :width="18" :height="18" circle />
</div>
<div
v-else
class="game-list-row__cell"
:class="{ 'game-list-row__cell--end': col.align === 'end' }"
>
<RSkeletonBlock :width="col.skeletonWidth ?? 60" :height="10" />
</div>
<div
v-else-if="col.key === 'languages' || col.key === 'regions'"
class="game-list-row__cell"
>
<div class="game-list-row__pills">
<RSkeletonBlock :width="28" :height="16" rounded="pill" />
<RSkeletonBlock :width="28" :height="16" rounded="pill" />
</div>
</div>
<div
v-else-if="col.key === 'actions'"
class="game-list-row__cell"
:class="cellModifiers('actions')"
>
<RSkeletonBlock :width="18" :height="18" circle />
</div>
<div
v-else
class="game-list-row__cell"
:class="{ 'game-list-row__cell--end': col.align === 'end' }"
>
<RSkeletonBlock :width="col.skeletonWidth ?? 60" :height="10" />
</div>
</template>
</template>
</template>
</a>
@@ -901,12 +902,18 @@ html[data-bp~="sm-and-down"] .game-list-row {
gap: 2px;
min-width: 0;
}
/* One line, always: the panel's height is fixed (`--r-list-row-detail-h`) for
the virtualiser, so a caption that wraps in another locale would push the
last field out of the clipped box. */
.game-list-row__field-label {
font-size: var(--r-font-size-xs);
font-weight: var(--r-font-weight-bold);
letter-spacing: 0.07em;
text-transform: uppercase;
color: var(--r-color-fg-muted);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.game-list-row__field--wide {
grid-column: 1 / -1;

View File

@@ -50,6 +50,9 @@ const compact = computed(() => smAndDown.value);
<template>
<div v-if="compact" class="r-glr-skel r-glr-skel--compact">
<!-- Stands in for the compact row's tick column, or the cover would start
further left here than in the row this replaces. -->
<div class="r-glr-skel__select" />
<div class="r-glr-skel__cell r-glr-skel__cover">
<RSkeletonBlock
:width="LIST_COVER_WIDTH_PX"
@@ -143,6 +146,10 @@ const compact = computed(() => smAndDown.value);
gap: var(--r-space-3);
padding: 0 var(--r-row-pad);
}
.r-glr-skel--compact > .r-glr-skel__select {
flex: none;
width: var(--r-list-select-w, 36px);
}
.r-glr-skel__stack {
display: flex;
flex-direction: column;

View File

@@ -113,7 +113,6 @@ const iconSize = computed(() => (xs.value ? 116 : 148));
icon="mdi-play-circle"
size="14"
:color="mode === 'stream' ? 'romm-blue' : 'success'"
class="r-v2-plat__playable-icon"
/>
{{ t("platform.playable") }}
</RChip>

View File

@@ -314,9 +314,11 @@ function clear() {
>
<!-- Count: a notch rising from the bar's top edge, centred. Its lower
half hides behind the bar, so the two read as one surface. -->
<!-- Named, not a live region: the digits change once per animation frame
while the count rolls, and a status role would read out every one. -->
<div
class="selection-bar__notch"
role="status"
role="img"
:aria-label="t('gallery.selection-n-selected', { n: selection.count })"
>
<span class="selection-bar__notch-count">{{ rollingCount }}</span>
@@ -646,8 +648,8 @@ html[data-bp~="sm-and-down"] .selection-bar--visible {
);
}
/* Tighten the action row on phones so all buttons + the count + divider
fit a 320px width: squeeze the inter-button gaps and side padding. */
/* Tighten the action row on phones so all buttons + the divider fit a 320px
width: squeeze the inter-button gaps and side padding. */
html[data-bp~="xs"] .selection-bar__panel {
gap: 2px;
padding: 0 6px;

View File

@@ -144,10 +144,6 @@ export function getListColumns(showPlatform: boolean): readonly ListColumn[] {
// Fixed track widths (px) — kept as data so the grid template AND the row's
// natural min-width (below) derive from the same numbers.
const LIST_SELECT_TRACK_PX = 36;
// Phones shrink the tick column (see global.css). The template reads the
// variable so the header and every row narrow together; the min-width math
// below stays on the desktop track, which only over-reserves by a few px.
const LIST_SELECT_TRACK = `var(--r-list-select-w, ${LIST_SELECT_TRACK_PX}px)`;
const LIST_PLATFORM_TRACK_PX = 200;
const LIST_METRIC_TRACKS_PX = [88, 96, 96, 56, 72, 110, 110, 88];
/** Minimum width of the title column so it stays readable when the row is
@@ -201,7 +197,7 @@ export function getListGridTemplate(showPlatform: boolean): string {
const metrics = LIST_METRIC_TRACKS_PX.map((w) => `${w}px`).join(" ");
// A fixed cover track keeps the title column at the same x in every row,
// including the loading placeholders.
return `${LIST_SELECT_TRACK} ${LIST_COVER_TRACK_PX}px minmax(${LIST_TITLE_MIN_PX}px, 1.6fr)${platformTrack} ${metrics}`;
return `${LIST_SELECT_TRACK_PX}px ${LIST_COVER_TRACK_PX}px minmax(${LIST_TITLE_MIN_PX}px, 1.6fr)${platformTrack} ${metrics}`;
}
// The row/header grids also carry a `--r-space-5` column gap and a

View File

@@ -197,11 +197,4 @@ function handleClick(col: PlatformColumn) {
flex-shrink: 0;
color: var(--r-color-brand-primary);
}
html[data-bp~="xs"] .plat-list-header {
grid-template-columns: minmax(0, 1fr) 96px;
}
html[data-bp~="xs"] .plat-list-header__cell--meta {
display: none;
}
</style>

View File

@@ -195,12 +195,9 @@ function onRowClick(e: MouseEvent) {
</div>
<div class="plat-list-row__cell plat-list-row__cell--end">
<span v-if="romCount != null">
{{ romCount }}
<span class="plat-list-row__count-unit">{{
romCount === 1 ? "game" : "games"
}}</span>
</span>
<span v-if="romCount != null">{{
t("collection.games-count", romCount, { named: { n: romCount } })
}}</span>
<span v-else class="plat-list-row__count-unit">—</span>
</div>
</a>
@@ -350,11 +347,4 @@ function onRowClick(e: MouseEvent) {
.plat-list-row__count-unit {
color: var(--r-color-fg-muted);
}
html[data-bp~="xs"] .plat-list-row {
grid-template-columns: minmax(0, 1fr) 96px;
}
html[data-bp~="xs"] .plat-list-row__cell--meta {
display: none;
}
</style>

View File

@@ -94,7 +94,14 @@ html[data-bp~="xs"] .r-v2-idx-shell {
padding, so only the separators and the row fill reach the edge. */
html[data-bp~="sm-and-down"] .r-v2-idx-shell__list-header,
html[data-bp~="sm-and-down"] .r-v2-idx-shell :deep(.coll-list-row--compact),
html[data-bp~="sm-and-down"] .r-v2-idx-shell :deep(.plat-list-row) {
html[data-bp~="sm-and-down"] .r-v2-idx-shell :deep(.plat-list-row--compact) {
margin-inline: calc(-1 * var(--r-row-pad));
}
/* The header already reaches both edges by the margin above, so the pinned
glass must not add the gutter a second time: the page has no horizontal
clip, and the surplus on the right would scroll the document sideways. */
html[data-bp~="sm-and-down"]
.r-v2-idx-shell__list-header.r-pinned-list-header::before {
inset: 0;
}
</style>

View File

@@ -37,6 +37,9 @@ export function useAnimatedNumber(
display.value = to;
return;
}
// Paint the starting value now: the first frame is a whole render away,
// and in a background tab it never comes at all.
display.value = from;
const start = performance.now();
const step = (now: number) => {
const t = Math.min(1, (now - start) / duration);

View File

@@ -65,7 +65,6 @@ const DEFAULT_COVER_RATIO = 2 / 3;
// * list-row / skeleton-list-row: token-derived `LIST_ROW_HEIGHT_PX`.
const FIXED_HEIGHT_BY_KIND: Partial<Record<GalleryItem["kind"], number>> = {
"letter-header": 56,
"list-row": LIST_ROW_HEIGHT_PX,
"skeleton-list-row": LIST_ROW_HEIGHT_PX,
"load-more": 80,
empty: 240,

View File

@@ -9,7 +9,7 @@
// reserved slot grows and shrinks with it — a panel animating inside a slot
// that already jumped to its full height just fades. So the height is animated
// here, and both the row's panel and the virtualiser read the same number.
import { ref } from "vue";
import { onScopeDispose, ref } from "vue";
import {
LIST_ROW_DETAIL_HEIGHT_PX,
listRowHeight,
@@ -89,6 +89,8 @@ export function useListExpansion() {
return listRowHeight(detailHeight(position));
}
onScopeDispose(stopAnimation);
return {
expandedPosition,
isExpanded,