Files
romm/frontend/src/v2/components/shared/IndexShell.vue
zurdi 9696de8ee8 fix(v2): rebuild the gallery list view for phones
The list header was built for a desktop table: it floated as its own
island over the rows, which showed through its blur, and the table
underneath it scrolled sideways on a phone.

- Pin the header edge to edge as one glass surface with the toolbar,
  tinted only once pinned, keeping its border as the divider.
- Trade the columns on sm-and-down for a two-line row (cover, title,
  facts) with a chevron that rolls a three-column detail panel open,
  so nothing scrolls sideways.
- Swap the alpha strip for an A-Z menu in the toolbar on phones and
  tablets, and land letter jumps flush under the toolbar in both
  layouts.
- Give the platforms and collections indexes, and the missing-games
  list, the same row.
- Move the selection counter into a notch above the floating bar and
  animate the bar in.
- Roll every counter up to its new value (useAnimatedNumber).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bZ7R3xC73MZu1vTNuatPK
2026-09-20 17:44:40 +02:00

101 lines
3.2 KiB
Vue

<script setup lang="ts">
// IndexShell: shared layout for index views (Platforms / Collections).
//
// The page scrolls as a whole, under the translucent top bar like Home, and
// the toolbar pins right below the top bar as one glass surface with it
// (usePinnedToolbar).
//
// Why a dedicated shell instead of GalleryShell: GalleryShell is wired
// to ROM-specific stores / composables / components (`storeGalleryRoms`,
// `AlphaStrip`, `GameCard`, `FilterDrawer`, …). Index views render tiles
// of platforms or collections, a different domain, so they get their
// own thin shell that owns just the sticky-toolbar machinery.
// No virtualisation (small datasets), no AlphaStrip, no selection bar.
//
// Slot contract:
// * `#header`: view-supplied header (PageHeader / divider / …).
// Scrolls away with content.
// * `#toolbar`: toolbar content (GalleryToolbar), pinned under the
// top bar.
// * `#listHeader`: list-mode column header (PlatformListHeader /
// CollectionListHeader), sticky below the toolbar.
// Only rendered when `listMode` is true.
// * default: index content (grid / list / panels).
import { usePinnedToolbar } from "@/v2/composables/usePinnedToolbar";
interface Props {
/** Enables the sticky `#listHeader` band below the toolbar. */
listMode?: boolean;
}
withDefaults(defineProps<Props>(), { listMode: false });
defineSlots<{
header(): unknown;
toolbar(): unknown;
listHeader(): unknown;
default(): unknown;
}>();
const { toolbarHeight, pinned, bindToolbar, bindSentinel } = usePinnedToolbar();
</script>
<template>
<section
class="r-v2-idx-shell"
:style="{ '--r-v2-idx-shell-toolbar-h': `${toolbarHeight}px` }"
>
<!-- One stable box, so the toolbar's observer sees the header grow. -->
<div>
<slot name="header" />
</div>
<div :ref="bindSentinel" aria-hidden="true" />
<div
:ref="bindToolbar"
class="r-pinned-toolbar"
:class="{ 'r-pinned-toolbar--pinned': pinned }"
>
<slot name="toolbar" />
</div>
<div
v-if="listMode"
class="r-v2-idx-shell__list-header"
:class="{ 'r-pinned-list-header': pinned }"
>
<slot name="listHeader" />
</div>
<slot />
</section>
</template>
<style scoped>
/* Plain document flow: <main> clears the top bar and, on phones, the bottom
tab bar. */
.r-v2-idx-shell {
padding: 32px var(--r-row-pad) 60px;
}
html[data-bp~="xs"] .r-v2-idx-shell {
padding: 16px 14px 24px;
}
/* List column header: sticky just below the pinned toolbar, and under it
(z-index 3 vs 4) so the toolbar always wins pointer events. */
.r-v2-idx-shell__list-header {
position: sticky;
top: calc(var(--r-nav-h) + var(--r-v2-idx-shell-toolbar-h));
z-index: 3;
}
/* Compact list mode: the column header and the rows run to the screen
edges, out of the shell's gutter — each keeps that gutter as its own
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) {
margin-inline: calc(-1 * var(--r-row-pad));
}
</style>