Commit Graph
9369 Commits
Author SHA1 Message Date
zurdi db99ff04cb refactor(frontend-v2): optimize background art swapping with dwell timer 2026-04-30 15:21:30 +00:00
zurdiandClaude Opus 4.7 db205573b5 refactor(frontend-v2): extract GalleryShell, gallery views become thin orchestrators
Platform / Collection / Search shared an identical layout (single
virtualised scroll surface with hero, toolbar, AlphaStrip, dwell-
debounced prefetch, scroll restoration, list-mode RTable wiring,
search-input debounce, URL filter sync, sticky-toolbar overlay) — the
only differences were the hero (InfoPanel for Platform/Collection,
PageHeader for Search) and the resource-loading flow per view.

This commit hoists everything shared into `GalleryShell.vue` and turns
the three views into thin orchestrators that only know how to:
  * resolve their resource (platform / collection-kind / nothing),
  * provide a hero via the `#hero` slot,
  * call `shellRef.applyRestoredScroll()` after the initial fetch.

The shell handles its own `onBeforeRouteUpdate` / `onBeforeRouteLeave`
guards to save scroll on every route change; views own their load-on-
update flow. Search additionally overrides the `#empty` slot to render
a boxed `EmptyState` illustration when a search resolves with no hits.

Line counts:
  Platform.vue:   503 → 173
  Search.vue:     414 →  77
  Collection.vue: 472 → 191
  GalleryShell.vue: 0 → 607 (new)
  Total:         1389 → 1048

Future cross-view fixes (virtualizer tweaks, toolbar styling, dwell
timing, etc.) now land in one place instead of three.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 15:20:30 +00:00
zurdiandClaude Opus 4.7 54f353c596 feat(frontend-v2): toolbar steps out of scroll when sticky
Reworks the sticky-on-scroll behaviour so the gallery toolbar reads as
a single element that scrolls naturally with the hero and steps OUT of
the scroll once it reaches the top — matching AppNav, where content
never reaches the bar's area.

- The toolbar item inside the virtualizer renders an empty placeholder
  (its 64px of vertical space is reserved in the offset table).
- The actual GalleryToolbar lives once, as an absolute-positioned
  overlay on the section. Its `top` is computed from `scrollTop`:
  scrollTop < toolbarOffset → top = toolbarOffset - scrollTop (tracks
  the natural scroll); scrollTop ≥ toolbarOffset → top = 0 (pinned).
- While pinned, a `clip-path: inset(toolbar-h 0 0 0)` on the virtualizer
  hides anything painted in the top band so card rows don't bleed
  through behind the toolbar. The toolbar's backdrop-filter then only
  sees the page's BackgroundArt — same visual language as AppNav,
  semi-transparent over the page background, no card content showing
  through.
- A `--stuck` modifier adds the bottom border + blur only when pinned,
  so the in-flow state (transparent, sitting between hero and rows)
  reads cleanly without chrome.

Replaces the previous dual-toolbar slide-in approach (one inline, one
fixed sliding from above) which the user found jumpy. There is now
exactly one toolbar element from the user's POV.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 15:04:36 +00:00
zurdiandClaude Opus 4.7 14a6ae7c46 refactor(frontend-v2): custom virtualizer + per-row dwell + sticky toolbar
Big rearchitecture of the gallery infinite-scroll. Three problems with
the prior Vuetify-v-virtual-scroll-based implementation drove this:

1. Scroll freeze on window resolve — dynamic-height re-measurement plus
   the prior virtualItems computed re-running end-to-end on every
   byPosition change locked the main thread hard enough to eat scroll
   input.
2. AlphaStrip jumps landing on the wrong letter — v-virtual-scroll
   estimates scrollTop from average measured item height, which skewed
   when most items were unmeasured skeletons. Click "N", land short.
3. Aggressive per-row prefetch on fast scroll — the IntersectionObserver
   fired per-row crossing, queueing 72-item windows for rows the user
   was just flying past.

Architecture:

- `RVirtualScroller` rewritten as a custom virtualizer (~210 lines).
  Owns a prefix-sum offset table built from `getItemHeight(item)`, so
  `scrollToIndex` is just `containerEl.scrollTop = offsets[idx]` — no
  estimation, no drift, exact landing on AlphaStrip jumps. Items render
  with `transform: translateY(<offset>px)`. Configurable overscan
  (default 25 per side ≈ 50 + visible). Emits `viewportRange` (items
  whose pixel rect actually intersects the viewport — NOT the rendered
  overscan) so consumers can wire AlphaStrip / dwell off "what the user
  is actually looking at right now".
- `galleryItemHeight` per-kind table on `useGalleryVirtualItems`. Hero
  280, toolbar 64, letter-header 56, row 254, list-table 1200,
  load-more 80, empty 240, skeleton-row 254. Drives the offset math.
- `byPosition` mutated in place (no Map reassignment) — Vue 3's reactive
  Map triggers per-key dependents; an arriving window only re-renders
  the rows holding the just-resolved positions, not the full list.
- AlphaStrip lit letters + currentLetter derive from `viewportRange`
  (computed) — exactly what's on screen, not what's in the rendered
  overscan band.
- Per-row dwell prefetch: each visible row arms its own 2s timer.
  Fast-scroll / AlphaStrip fly-by leaves zero fetches in flight; pausing
  on a region for 2s fires per-row range fetches in parallel. Each row
  asks for exactly its 8 positions via the new
  `galleryRoms.fetchRange(offset, limit)`, so 4 visible rows resolve
  independently and stream into the DOM as their requests come back.
- Sticky header-dock toolbar: when the inline GalleryToolbar scrolls
  past the threshold (~hero height), a fixed copy slides in from above
  with a 240ms ease-out, sharing the same handlers/state. Falls back to
  the inline behaviour for `floating` dock (already always visible).
- Removed the IntersectionObserver / MutationObserver / per-batch
  rAF-prefetch scaffolding; the dwell + viewport-range pair replaces
  both responsibilities.

Manual browser validation pending. Letter ordering tweaked
(`#` first → AlphaStrip), skeleton label spacing nudged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 14:08:22 +00:00
zurdiandClaude Opus 4.7 8750dd558b feat(frontend-v2): useGalleryFilterUrl composable
Round-trips the active search term between Vue Router's `route.query`
and the v1 galleryFilter store. URLs are now bookmarkable for the bits
of state v2 actually exposes today.

- New composable in `src/v2/composables/useGalleryFilterUrl/`. URL→store
  on mount and on every `route.query.search` change (covers browser
  back/forward and pasted URLs); store→URL via `router.replace` so each
  keystroke doesn't grow the history stack. Skips writes when desired
  and current already match (no feedback loop with the inverse watcher).
- Plugged into Platform / Search / Collection.
- Removed the manual `searchTerm.value = null` cleanups in Platform and
  Collection — the next gallery view's mount re-applies its own URL,
  so the cleanup happens implicitly. No behavioural change for navigation
  patterns we already supported.
- Scope is intentionally narrow today (only `searchTerm` round-trips)
  because that's the only filter v2 surfaces. The other ~24 galleryFilter
  fields plug in here once the v2 filter drawer ships.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 08:04:51 +00:00
zurdiandClaude Opus 4.7 f3f9a61f04 feat(frontend-v2): useSocketEvent composable
Wraps the shared Socket.IO instance with mount/unmount cleanup so v2
consumers stop hand-pairing `socket.on(event, handler)` with
`onBeforeUnmount(() => socket.off(...))`.

- Auto-connects the singleton socket unless `{ connect: false }`.
- Cleanup uses `onScopeDispose` (not `onBeforeUnmount`) so the composable
  also works inside non-component effect scopes (Pinia store actions,
  manually-scoped subscriptions). Returns `{ stop }` for early manual
  cleanup; idempotent.
- Generic payload typing kept until the backend ships a typed event map
  (constitution §X.10) — until then the consumer asserts the shape.
- Migrated `Scan.vue`'s `scan:done` listener as a proof of correctness.
  No other v2 surface uses `socket.on()` (Patcher / RefreshMetadataDialog
  are emit-only).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 15:30:32 +00:00
zurdiandClaude Opus 4.7 9c467222aa feat(frontend-v2): scroll restoration on gallery views
Vue Router's built-in scrollBehavior only restores window scroll;
gallery views scroll on RVirtualScroller's containerEl, so navigating
back from GameDetails / Settings dumped the user at the top instead of
where they left off.

- New v2 store `scrollRestoration` with Map<routeFullPath, scrollTop>.
  Save is non-destructive (rereading the same key keeps the value), so
  user can navigate A → B → A and still land at A's last position.
- Platform / Search / Collection views save the scroller's scrollTop on
  onBeforeRouteLeave (and on onBeforeRouteUpdate when the same view
  swaps to a new route param), then restore in onMounted after the
  first window has loaded and setupSpy has attached the
  IntersectionObserver. The observer catches the rows revealed at the
  restored scroll position and kicks the prefetch for those windows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 15:21:47 +00:00
zurdi af53de4b29 chore: update permissions for nginx and gunicorn configuration directories 2026-04-29 13:30:43 +00:00
zurdi b12fb0fabc Refactor Gallery components for sparse loading and improved performance
- Updated Collection.vue to implement a single-virtualiser architecture with sparse loading, replacing the previous ROM store with a gallery ROM store.
- Enhanced Platform.vue to support windowed loading and optimized fetching of ROMs, including adjustments to the loading state and pagination.
- Modified Search.vue to align with the new gallery ROM store, improving search functionality and loading behavior.
- Introduced skeleton loading states for game cards and adjusted animations for a smoother user experience.
- Removed redundant code and improved overall readability and maintainability of the components.
2026-04-29 12:02:19 +00:00
zurdiandClaude Opus 4.7 a3cc9e4af7 feat(frontend-v2): virtualise all galleries with single-scroller architecture
Platform / Search / Collection now render hero, toolbar, content rows and
load-more as items inside one RVirtualScroller — single scroll surface,
no nested scrollbars, virtualisation extends to libraries with thousands
of ROMs.

- New useGalleryVirtualItems builds a discriminated GalleryItem[] (hero,
  toolbar, letter-header, row, list-table, load-more, empty, skeleton).
- New useResponsiveColumns chunks ROMs into rows that match the CSS
  grid via ResizeObserver. Rows use repeat(N, minmax(card-w, 1fr)) so
  the visible gap between cards grows accordion-style on resize.
- AlphaStrip is index-based: scrollToIndex(letterToIndex.get(letter),
  { smooth: true }) for animated jumps. Spy uses an IntersectionObserver
  on [data-spy-letters] (comma-joined per-row letter set) so multi-letter
  rows light up every letter they cover.
- Shared romBucketLetter util mirrors the backend's strip-articles regex
  (^(the|a|an)\\s+) so frontend grouping matches server sort order — "The
  Legend of Zelda" buckets under L, not T.
- RVirtualScroller exposes scrollToIndex(index, { smooth }) and
  containerEl. Smooth path captures Vuetify's synchronous scrollTop set
  and re-applies it via native scrollTo({ behavior: 'smooth' }).
- useLetterGroups slimmed to a pure grouping computed (DOM-ref scroll-spy
  bits removed). GameGrid.vue and LetterGroupedGrid.vue deleted.

Manual browser verification on a very-large library (5–10k+ ROMs) is
still pending.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:12:15 +00:00
zurdi ca5aa0ef6b refactor: update color usage across components to utilize color-mix for improved theming
- Replaced hardcoded RGBA colors with color-mix for various UI elements in AuthCard, MissingFSBadge, PageHeader, AppLayout, RTable, RMenuPanel, RDialog, global styles, and tokens.
- Enhanced consistency in color application by introducing new color tokens for brand, status, and overlay colors.
- Updated background and border styles in multiple views including ControllerDebug, Pair, Patcher, Player, Scan, and Settings to align with new theming approach.
- Improved accessibility and visual coherence by ensuring color contrasts are maintained across light and dark themes.
2026-04-29 09:39:50 +00:00
zurdiandClaude Opus 4.7 f97d7d28c9 feat(frontend-v2): eliminate hardcoded rgba(255, ...) outside tokens.css
Adds three new token groups so the 21 sites previously documented as
"intentional hardcoded rgba" can use proper tokens instead:

- colorOverlay (fixed dark glass, never theme-flips) — drives the
  surfaces sitting on cover artwork: StatusBadge, GameCard
  platform-icon / badge, GameActionBtn. Tokens: --r-color-overlay-fg
  (.95) / -fg-secondary (.85) / -fg-muted (.45) / -border (.12) /
  -border-strong (.25) / -scrim-soft (.55) / -scrim-strong (.78).

- panel + panelBorder pair (theme-flipped, in colorDark/colorLight) —
  the deep-glass / off-white surfaces that RDialog and RMenuPanel
  share. The inline `:global(.r-v2-light) X` overrides collapse into
  single rules.

- tooltipBg + tooltipBorder pair (theme-flipped) — moves the
  v-overlay__content.r-tooltip skin in global.css off literals.

- shimmerSweep (theme-flipped) — moves the linear-gradient sweep
  inside RSkeletonBlock::after off the hand-paired rgba values.

Also: RMenuItem danger hover background now uses
`color-mix(in srgb, var(--r-color-danger) 12%, transparent)`
instead of the raw rgba(255, 80, 80, 0.12) — derived from the
canonical danger token.

Outside tokens.css (which holds the source values), v2 now has
zero `rgba(255, 255, 255, X)` literals.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 08:31:14 +00:00
zurdiandClaude Opus 4.7 bd12780c42 docs(frontend-v2): close dual-theme audit, document intentional rgba
CLAUDE.md §X — frontend debt list trimmed; §X.5 (dual-theme audit)
removed since the audit is done. Added a new "Intentional
hardcoded rgba(255, ...)" section enumerating the 30 sites that
stay literal by design: cover-overlay surfaces, panel background
pairs, backdrop scrims, destructive-accent rgba over
--r-color-danger, and tokens.css itself.

Frontend remaining debt: 4 items (virtualisation, useGalleryFilterUrl,
scroll restoration, useSocketEvent).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 07:48:11 +00:00
zurdiandClaude Opus 4.7 c81396b2e5 feat(frontend-v2): bulk migrate ControllerDebug to theme-aware tokens
41 hardcoded rgba(255, 255, 255, X) sites in the controller-debug
view migrated via context-aware regex (color → fg/fg-secondary/
fg-muted/fg-faint, background → bg-elevated/surface/surface-hover,
border → border/border-strong, opacity-binned). Debug-only view so
exact token shade isn't load-bearing — gets the surface to react to
theme without per-site analysis.

Closes the dual-theme audit's frontend debt. The 30 sites that
remain are intentional and stay hardcoded:

  - tokens.css (9)           — the token definitions themselves
  - StatusBadge / GameCard /
    GameActionBtn (11)       — cover-overlay surfaces, dark glass
                               must read on top of cover art
                               regardless of theme
  - RDialog / RMenuPanel (4) — panel borders paired with hand-tuned
                               dark glass background; surface is a
                               distinctive token-not-yet
  - RMenuItem (2)            — destructive-action red
  - global.css (3)           — backdrop scrim gradient
  - RSkeletonBlock (1)       — shimmer keyframe stop

§X.5 (frontend dual-theme audit) of CLAUDE.md is fully done.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 07:45:58 +00:00
zurdiandClaude Opus 4.7 1ab6b63ff3 feat(frontend-v2): dual-theme migration of Player launcher screens
Player/EmulatorJS and Player/Ruffle launcher screens (the
pre-game UI before the embedded emulator takes over): cover
placeholder, subtitles, glass panel, asset preview cards,
section labels, color picker border + code, brand line,
spinner. The fullscreen-stage state stays #000 — that's the
emulator canvas backdrop and is intentionally opaque dark.

98 → 71 sites left. Most of what remains is intentional —
cover-overlay surfaces (StatusBadge / GameCard chrome /
GameActionBtn) which need dark glass to read on top of any
cover art, the RDialog/RMenuPanel panel borders that pair with
hand-tuned panel backgrounds, and tokens.css (the actual token
definitions, not migration targets).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 07:39:09 +00:00
zurdiandClaude Opus 4.7 bff1ce2e8a feat(frontend-v2): dual-theme migration of remaining views and small surfaces
Fourth pass of the dual-theme audit. Patcher panels, Scan log
config + log + empty state, Pair card, GameDetails scroll
panel/empty, RelatedGamesGrid + DetailsTabs, the small primitives
that still had token-able rules (RMenuDivider), shared composites
(Stat, PageHeader, EmptyState), assorted Dialogs leftovers
(DeleteManual body, NewCollectionRow placeholder + hover,
RefreshMetadata `--lb-dim`, AddRomsToCollection subtitle/empty,
ShowQRCode name, LibraryManagement body, CoverColumn fallback),
Player picker dialogs (SelectSave / SelectState empty,
EmulatorJSCacheDialog desc).

156 → 98 sites left. Most remaining are intentional cover-overlay
surfaces (StatusBadge, GameCard platform-icon/badge,
GameActionBtn) plus the niche/embedded views (ControllerDebug,
Player/EmulatorJS, Player/Ruffle) and the actual token
definitions in tokens.css.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 00:47:38 +00:00
zurdiandClaude Opus 4.7 83c6799855 feat(frontend-v2): dual-theme migration of GameDetails subcomponents + small surfaces
Third pass of the dual-theme audit. Migrates the GameDetails
sub-component grid (HLTBStrip, GameHeader tags, OverviewTab status,
InfoGrid chips, FileRow, PersonalTab status/progress,
MetadataProviderChips), plus the smaller surfaces around them
(BackBtn, NotificationHost toast, LanguageSelector pill,
CollectionPickerRow, ManualUploadTargetDialog options, Settings
UserProfile hero/section, GameCard placeholder text). 217 → 156
sites left.

Same token mapping as prior passes — bg-elevated/surface/surface-
hover, border/border-strong, fg/fg-secondary/fg-muted/fg-faint —
collapsing the verbose `:global(.r-v2.r-v2-light) X` overrides.
Cover-overlay surfaces (StatusBadge, GameCard platform-icon, badge,
rating) and the OAR rgba dark scrim on UploadProgressToast/
NotificationHost panels stay as-is — they're meant to read on
colorful artwork regardless of theme.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 00:09:23 +00:00
zurdi ebdf976238 refactor(frontend-v2): rename showPlatform to showPlatformIcon in GameGrid and Platform components 2026-04-29 00:05:45 +00:00
zurdi 31ab94a66f feat(frontend-v2): integrate RTooltip for platform icons and add showTooltip prop 2026-04-29 00:00:57 +00:00
zurdiandClaude Opus 4.7 fd3be92394 feat(frontend-v2): dual-theme migration of high-touch primitives + dialogs
Second pass of the dual-theme audit (premise #5). This batch covers
the primitives every dialog uses (RDialog, RTable, RSliderBtnGroup,
RMenuItem) plus the dialogs/views the user touches most often
(NotesTab, AchievementsTab, MatchRomDialog, DeleteRomDialog,
EditRomDialog, UploadProgressToast, AboutDialog). 360 → 217
hardcoded sites left.

Notable token swaps:
- bg surfaces: rgba(255, 255, 255, 0.03/0.04/0.05) →
  --r-color-bg-elevated; 0.07 → --r-color-surface; 0.08/0.09/0.12 →
  --r-color-surface-hover
- borders: 0.06/0.07 → --r-color-border; 0.08-0.12 →
  --r-color-border-strong
- text: 0.92+ → --r-color-fg; 0.55-0.85 → --r-color-fg-secondary;
  0.45 → --r-color-fg-muted; 0.25-0.35 → --r-color-fg-faint
- inversion-on-active (segmented pill / achievements filter):
  background #fff/#111 → --r-color-fg, color #111/#fff →
  --r-color-bg

The verbose `:global(.r-v2.r-v2-light) .foo { ... }` overrides
collapse into single token rules; tokens already flip between dark
and light. Verified with typecheck + lint + 94 tests.

The RDialog panel background (rgba(16, 12, 28, 0.97) /
rgba(255, 255, 255, 0.97)) and tinted overlays kept as-is for now —
intentional surface, not a generic token target.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 23:54:42 +00:00
zurdiandClaude Opus 4.7 f587be200d refactor(frontend-v2): GameCard renames showPlatformBadge → showPlatformIcon
Card chrome moves from a bottom-left platform-name badge to a TR
platform-icon (semi-transparent disc). The badge prop renames to
showPlatformIcon; the info-button + emit("info") drop along with it
since clicking the card already navigates to GameDetails. Story
argType updated to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 23:52:20 +00:00
zurdiandClaude Opus 4.7 3e4c96b223 docs(frontend-v2): close §X.5/§X.6/§X.7 debt entries
The 17 snackbar emits, 7 webp casts and Storybook preview
hydration are all done. CLAUDE.md §X is renumbered to reflect:

  Frontend debt (5 items):
  1. Virtualisation migration
  2. useGalleryFilterUrl (URL-sync gallery filters)
  3. Vue Router scroll restoration
  4. useSocketEvent composable
  5. Dual-theme audit (~360 sites left)

The hygiene migrations and Storybook hydration are no longer
listed — they're done.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 23:07:18 +00:00
zurdiandClaude Opus 4.7 d1815b5e3c chore(frontend-v2): hydrate permissionsStore with admin in storybook preview
Future primitives that consume useCan() render with grants by
default. Stories that need to exercise role-based hiding can
override per-story:

  storePermissions().hydrateFromRole("viewer" | "editor" | null);

Closes the §X.7 debt entry — primitive stories can now ship with
permission-aware controls without per-story boilerplate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 22:45:09 +00:00
zurdiandClaude Opus 4.7 14e1d84631 refactor(frontend-v2): migrate webp casts to useWebpSupport()
Replaces 7 sites of `(heartbeatStore.value as unknown as
{ FRONTEND?: { IMAGES_WEBP?: boolean } })?.FRONTEND?.IMAGES_WEBP`
with the typed composable. The cover-rewrite logic
`p.replace(/\.(png|jpg|jpeg)$/i, ".webp")` collapses into
`toWebp(p)` everywhere.

Files migrated:
- views: Home, CollectionsIndex, GameDetails, Gallery/Platform,
  Gallery/Search, Gallery/Collection
- dialogs: AddRomsToCollectionDialog

The cast itself now lives only inside `useWebpSupport`. When the
backend adds IMAGES_WEBP to FrontendDict in OpenAPI, the cast
disappears and the composable becomes a thin wrapper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 22:42:27 +00:00
zurdiandClaude Opus 4.7 1bbd53defe refactor(frontend-v2): migrate 17 call sites to useSnackbar()
Replaces every `emitter?.emit("snackbarShow", ...)` in v2 with the
typed composable. Tone derived from the old `color` string (red →
error, green → success, orange → warning, primary → info). Each
call collapses an emitter+payload into a one-liner, and where
emitter was only used for snackbars, the inject + Emitter import
is dropped entirely (LoginForm, ResetForm, Auth/Register,
Auth/ResetPassword, NotesTab, SoundtrackPanel, Patcher).

Files migrated:
- Auth: LoginForm, ResetForm, Register, ResetPassword
- Dialogs: AddRomsToCollection, DeleteManual, DeleteRom, EditRom,
  ManualUploadTarget, MatchRom, RefreshMetadata
- GameDetails: MediaTab, NotesTab, SoundtrackPanel
- AppShell: UserMenu
- Settings: UserProfile
- Views: Patcher
- Composables: useGameActions

NotificationHost still collapses free-form color strings to tones
for the duration of v1 coexistence; this commit removes v2's
contribution to the variance — every v2 emit now hits
NotificationHost with one of {success, error, warning, info}
already.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 22:23:13 +00:00
zurdiandClaude Opus 4.7 266a6b01b4 docs(frontend-v2): document the remaining dual-theme audit as debt
Adds an explicit §X.8 entry pointing the follow-up PR at the ~360
hardcoded rgba(255, 255, 255, ...) sites left after the first pass,
along with the token-mapping conventions used in the visible-surface
migration. Captures which views are still untouched (ControllerDebug,
Patcher, Player/EmulatorJS, dialog content, RDialog/RTable primitives,
auth views).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 15:56:50 +00:00
zurdiandClaude Opus 4.7 f2edde0305 feat(frontend-v2): migrate visible surfaces to theme-aware tokens
First pass of the dual-theme audit (premise #5). Replaces hardcoded
rgba(255, 255, 255, ...) with token references on the surfaces a
user sees first when toggling theme. Started at 429 hardcoded sites;
this commit migrates ~69 across 19 files. The rest is debt — see
CLAUDE.md §X.

Surfaces now theme-aware:
- AppShell: AppNav (classic-UI pill), UserMenu (avatar pill, chevron)
- Home: section header colors, CardRow head/count/arrows, empty state
- Galleries: GalleryToolbar (floating + kebab), Platform/Collection
  empty states, GameCard label, GameList row text/thumb,
  LetterGroupedGrid heading/load-more/empty, AlphaStrip letter colors,
  InfoPanel border/title
- Tiles: PlatformTile (background/border/hover/count),
  CollectionTile (name/count), CollectionMosaic (background/empty)
- Settings: SettingsShell (panel/subtitle), SettingsNav (panel/links),
  UserInterface (sections/cards/desc), MetadataSources (tiles/logos/
  indicators)

Tokens used: --r-color-bg-elevated, --r-color-surface,
--r-color-surface-hover, --r-color-border, --r-color-border-strong,
--r-color-fg, --r-color-fg-secondary, --r-color-fg-muted,
--r-color-fg-faint. The verbose `:global(.r-v2.r-v2-light) X { ... }`
override blocks collapse into single-token rules; tokens already
flip when html toggles between r-v2-dark and r-v2-light.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 15:55:18 +00:00
zurdi ae07e7647a feat(frontend-v2): conditionally render RMenuDivider based on user scopes and admin status 2026-04-28 15:28:28 +00:00
zurdiandClaude Opus 4.7 e2215b370c docs(frontend-v2): rewrite CLAUDE.md as the v2 constitution
Replaces the working-rules sketch with the canonical constitution
agreed in the redesign session. Stable structure (premises →
operational rules → patterns → verification → anti-patterns → file
conventions) plus an explicit §X "Known debt" listing every
implementation task left open after this work.

Premises (13): v1 frozen; three component tiers; canonical shared
resources; tokens as SSOT; dual theme mandatory; universal input;
wrapper contract; universal substitution; Vuetify utility CSS +
our wrappers (no plain CSS); Storybook for /lib; TS strict; a11y;
performance.

Architecture patterns covered: errors & snackbars, loading states,
sockets, UI state persistence, pagination & virtualisation, forms
& validation, permissions, destructive confirmations.

§X enumerates the deferred work — virtualisation migration of
GameGrid/LetterGroupedGrid, galleryFilter→URL sync, scroll
restoration, useSocketEvent composable, call-site migrations to
useSnackbar/useWebpSupport, plus backend-side debts (ActionKey
in OpenAPI, /permissions/me, FrontendDict.IMAGES_WEBP, form error
format, typed socket event map). Each item has the architectural
context the follow-up PR will need.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 15:03:43 +00:00
zurdiandClaude Opus 4.7 ba6751b676 feat(frontend-v2): RBtn loading debounce + useWebpSupport composable
RBtn: when `loading` becomes true, the spinner only shows after
`loadingDebounce` ms (default 200). Actions that resolve faster
than that flash never paint a spinner. Going from loading →
not-loading is immediate. The clamp keeps the focus ring stable
on Save buttons, optimistic toggles, etc.

useWebpSupport: single-source resolution of FRONTEND.IMAGES_WEBP
from the heartbeat response. The 16 v2 call sites can now drop
their `as unknown as { FRONTEND?: { IMAGES_WEBP?: boolean } }`
duplication and call `toWebp(url)` instead. The cast itself stays
in one place — backend debt to add IMAGES_WEBP to FrontendDict in
OpenAPI; once regenerated, the cast disappears.

(Migration of the existing call sites is left for the next pass —
they keep working via the inline pattern; new code uses the util.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:54:10 +00:00
zurdiandClaude Opus 4.7 1ee15fb2d1 feat(frontend-v2): ConfirmDialog shared composite + useConfirm composable
Generic confirmation dialog with three friction levels (low / medium
embedded in feature dialogs / high via requireTyped). Mounted once
in GlobalDialogs alongside the other emitter-driven dialogs, opened
via the useConfirm() composable which returns Promise<boolean> so
call sites read as:

  const ok = await confirm({ title, body, requireTyped: "DELETE" });
  if (!ok) return;

Type-to-confirm is the constitution-mandated friction level for
filesystem-affecting actions; tone="danger" tints the confirm
button red; default focus lands on Cancel so a stray Enter doesn't
destroy work.

Adds two events to the canonical Events map (additive; v1 keeps
working): showConfirm carries the payload, confirmResolved routes
the user's choice back to the awaiting promise via id matching.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:48:44 +00:00
zurdiandClaude Opus 4.7 eba4539909 feat(frontend-v2): permission system (useCan, permissionsStore, role-map)
Centralised permission checks for v2 — closes the constitution's
"never inline-check user.role in features" rule. Three pieces:

- src/stores/permissions.ts: Pinia store holding the user's
  effective grants. Today populated by hydrateFromRole() against a
  role-map; tomorrow populated by setGrants() from /permissions/me.
  Lives in the canonical store directory but is v2-only consumed —
  v1 keeps its inline checks until removal.

- src/v2/composables/useCan: ActionKey vocabulary, scope vocabulary
  ({global,platform,collection,rom}), role-map mirroring backend
  guards, and useCan(action, scope?) returning ComputedRef<boolean>.
  installPermissionsHydration() watches authStore.user and keeps
  the store in sync; AppLayout calls it on mount.

- Migrations: UserMenu.vue's isAdmin computed and SettingsNav's
  Server Stats visibility gate now go through useCan("app.admin").
  No more `user.role === "admin"` inline checks in v2.

Backend debt remains: ActionKey enum in OpenAPI + /permissions/me
endpoint + permissions:changed socket event. Until those land, the
role-map.ts file must be reviewed against backend role guards by
hand. Drift means the UI will offer actions the server rejects, or
hide actions it would have permitted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 14:28:14 +00:00
zurdiandClaude Opus 4.7 7f52b1680c feat(frontend-v2): useSnackbar composable, validation utils, RForm primitive
Three pieces of the forms / feedback layer that the constitution
calls for:

- useSnackbar(): typed convenience over the global snackbarShow
  emitter event. success/error/warning/info methods plus a generic
  show(). Existing call sites keep working via NotificationHost's
  free-form-color collapser; new code is expected to use the
  composable.

- src/v2/utils/validation.ts: pure rule helpers (required, email,
  asciiOnly, lengthBetween, usernameLength/Chars, passwordLength).
  Utility code is allowed to call i18n.global.t directly (the
  no-i18n rule covers lib primitives, not utils). The frozen
  rule arrays still living in stores/users.ts keep working for v1;
  v2 new forms compose these helpers locally.

- RForm primitive (forms/RForm): wraps VForm with two QoL extras
  — Enter on any field submits when validation passes, and a
  failed validate() scrolls the first invalid field into view and
  focuses it. Story exercises the basic submit flow; auto-picked
  up by test/storybook.test.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:59:19 +00:00
zurdi c6b0e69827 Revert "refactor(frontend-v2): GameGrid uses RVirtualScroller for row windowing"
This reverts commit 75c45a7b02.
2026-04-28 13:44:10 +00:00
zurdiandClaude Opus 4.7 75c45a7b02 refactor(frontend-v2): GameGrid uses RVirtualScroller for row windowing
Self-scrolling virtualized grid: rows are chunked from the rom array
based on a ResizeObserver-driven column count, and only the rows in
the visible window mount their GameCards. Card width and total height
are fixed via tokens (--r-card-art-w / --r-card-art-h heuristic) so
the row height stays predictable and v-virtual-scroll can window
accurately.

This is the component-level migration. Integrating it into the parent
gallery views (Platform / Search / Collection) requires their scroll
containers to delegate scroll to GameGrid (height context, no
overflow on the wrapper) and is deferred to a focused follow-up that
covers list mode and LetterGroupedGrid alongside.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:29:47 +00:00
zurdiandClaude Opus 4.7 0d2bc1cfa3 feat(frontend-v2): add RVirtualScroller primitive
Wraps Vuetify's VVirtualScroll with the project's wrapper contract
(inheritAttrs: false, $attrs forwarding, slot passthrough). Items
are typed as unknown[] so consumers cast at the call site — making
the primitive non-generic keeps it usable inside Storybook
components: {} registrations, where Vue 3.4 generic components
clash with the Component record type.

Story exercises a 5000-row list to verify only the visible window
hits the DOM. Auto-discovered by test/storybook.test.ts.

This primitive is the substrate for the upcoming GameGrid and
LetterGroupedGrid migrations — both will chunk their items into
rows of fixed-width cards and feed those rows here, so libraries
with thousands of ROMs no longer mount thousands of cards at once.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:21:52 +00:00
zurdiandClaude Opus 4.7 49d01f65d6 chore(frontend-v2): polish tokens script and drop layout scope redundancy
build-tokens.ts: import the source as .js (compatible with vue-tsc
without enabling allowImportingTsExtensions), wrap top-level await
in main(), drop a leftover unused helper. Doc strings now point to
"npm run build:tokens" — the script name avoids npm's reserved
"token" subcommand. Header in the regenerated tokens.css matches.

AppLayout, AuthLayout and PairShell: drop the redundant
"r-v2 r-v2-{dark|light}" classes from their root divs. RomM.vue
already toggles those on <html>, which covers both the in-tree
shell and any teleported overlays — anchoring them again on the
layout root was harmless duplication that complicated the v1 →
v2-only cleanup. Each layout keeps its own BEM root class
(.r-v2-shell, .r-v2-auth, .r-v2-pair-shell) for its scoped styles.
useThemeClass becomes unused and is removed; when v1 is deleted,
the only thing left to clean is the toggle in RomM.vue.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:12:58 +00:00
zurdiandClaude Opus 4.7 b3180a5aca feat(frontend-v2): generate tokens.css from index.ts as single source
scripts/build-tokens.ts emits src/v2/styles/tokens.css with explicit
naming overrides for the special cases (--r-row-pad, --r-elev-*,
--r-nav-h, abbreviated layout vars). tsx wired into devDeps;
build:tokens script + predev/prebuild hooks keep the CSS in sync.

Backfill missing tokens that lived only in CSS: --r-color-fav
joins colorBrand, and the focus colors in colorDark / colorLight
match the translucent values components actually consume (not the
unused #ffffff / #111117 they used to declare). Drop the orphan
--r-focus-ring-color (zero references in the codebase).

Adopt --r-radius-card (14px) for RMenuPanel and RDialog instead of
hard-coded 14px; switch a NotesTab badge from 10px to --r-radius-lg.
Closes the "panels use 14px not --r-radius-lg" pitfall — the
constitution no longer needs that footnote.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 13:09:50 +00:00
zurdiandClaude Opus 4.7 e75fc82ce8 chore(frontend-v2): fix lint errors blocking the new CI workflow
Drop unused imports (RTooltip in MetadataProviderChips, BackBtn in
GameDetails). Add aria-label to NotesTab textarea and proper
for/id pairing to its public-toggle checkbox label. Mark Home's
favoriteRoms with eslint-disable-next-line (false positive: used
in <template> but @typescript-eslint/no-unused-vars with
projectService doesn't see Vue templates).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 11:53:15 +00:00
zurdiandClaude Opus 4.7 df8f6178ef chore(frontend): set up vitest + storybook play() tests and align CI
Add Vitest 4 with happy-dom, @vue/test-utils, and a single
test/storybook.test.ts that auto-discovers every story under
src/v2/lib and runs its play() via composeStories — no Playwright,
just composition-based interaction tests. 89 stories now smoke-pass
in CI.

Scripts: lint:fix (auto-fix), lint (now scoped to ./src/v2; v1 is
frozen), lint:all (legacy sweep), test, test:watch, test:ui,
storybook:test.

eslint.config.js gets argsIgnorePattern: "^_" so unused-by-design
parameters can use the underscore convention.

CI: new frontend.yml runs lint, test, build in parallel on
frontend/** changes; typecheck.yml bumped to Node 22 with cached
npm ci. Existing typecheck job preserved for branch protection.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 11:52:44 +00:00
zurdiandCopilot fc88b80781 feat: add StatusBadge component and integrate status management in GameCard and useGameActions
Co-authored-by: Copilot <copilot@github.com>
2026-04-27 23:29:33 +00:00
zurdi 6228713fd1 feat: implement shared-element transitions for CollectionTile, GameCard, PlatformTile, and GameList components 2026-04-27 23:00:16 +00:00
zurdi cd0ab21880 feat: implement shared-element transitions for GameCard and GameDetails 2026-04-27 20:43:59 +00:00
zurdi 0bfce43371 chore: update uv sync command to use frozen option for consistency 2026-04-27 20:34:22 +00:00
zurdiandCopilot 9a3bde0610 feat: enhance UserMenu with upload functionality and improve menu item styling
Co-authored-by: Copilot <copilot@github.com>
2026-04-27 16:42:13 +00:00
zurdi 605b13ef6a style: set tbody cell height to 55px for improved row consistency 2026-04-27 16:15:27 +00:00
zurdi ba3468d441 feat: add RSliderBtnGroup component with stories and types
- Implemented RSliderBtnGroup as a segmented/tab control with a sliding indicator.
- Created stories for different variants: Segmented, Tab, and Disabled.
- Added types for SliderBtnGroupItem to define item structure.
- Introduced RSpinner component for inline loading states with stories.
- Developed RList and RListItem components with stories for list display.
- Created RToolbar component for toolbar layout with customizable properties.
- Added RTooltip component for tooltips with various activator patterns.
- Updated imports in EmulatorJS and LibraryManagement views to reflect new component paths.
2026-04-27 11:35:49 +00:00
zurdi 4ce5e172e9 style: adjust margin for list in AddRomsToCollectionDialog and remove scrollbar color in RDialog 2026-04-26 23:11:45 +00:00
zurdi b418df06f5 feat: add tile size prop to collection components for responsive layout 2026-04-24 23:24:20 +00:00
zurdi c8609dc62d style: adjust padding and margin for improved layout consistency across collection components 2026-04-24 23:03:56 +00:00