47 Commits

Author SHA1 Message Date
Stu Anderson
7c07914de8 fix(ui): dim verification sources the ROM did not match (#5627)
* fix(ui): dim verification sources the ROM did not match

A miss used the same neutral look as the provider cards' linked state,
so it could read as verified. Dim it like an unlinked provider.

Fixes #4009

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(ui): share one opacity token for inactive states

Disabled controls, unlinked providers, locked achievements, switched-off
hash matchers and unmatched verification sources each hard-coded 0.55.
Add --r-opacity-inactive and use it in all twelve, so the inactive look
is tuned in one place. Carousel thumbnails and controller-debug axis
lines keep their own value: they are not inactive states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:22:54 -05:00
Stu Anderson
8e1ea1155d fix(frontend): catch mdi icon names the build would drop (#5562)
* perf(frontend): subset the mdi icon font to the icons the app uses

#5118 trimmed the icon CSS, but the font file still held every glyph
(403 KB) and the build still copied the eot, ttf and woff formats.
The build plugin now also cuts the woff2 down to the code points of the
rules it keeps, and the stylesheet's only font source is that file.

Build only: dev keeps the full font, so a newly used icon renders
without a restart. Font in the build: 403,216 B -> 25,504 B, and the
three unused formats are no longer emitted.

Adds subset-font and @types/subset-font as dev dependencies.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* chore(frontend): lint against building mdi icon names at runtime

The build keeps only the icon glyphs whose names appear in full in
src/, so `mdi-${name}` or "mdi-" + name would render an empty square
in production. romm/no-dynamic-mdi-name reports both forms in scripts
and Vue templates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* chore(frontend): drop the mdi font subsetting, keep the lint rule

The browser caches the full icon font after the first load, so
subsetting it only saves about 360 KB on a cold cache. That doesn't
justify two new dev dependencies and a build step that writes into
node_modules. The rule that rejects runtime-built icon names still
protects the existing CSS trim.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(frontend): flag mdi icon names split across string literals

Addresses Greptile's review: "mdi-" + "home" passed the rule, but the
build only finds icon names written in full, so that icon lost its CSS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(frontend): type isStringLiteral as a type guard

vue-tsc rejected reading .value off the narrowed BinaryExpression side.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(frontend): catch mdi names split across + chains and templates

pr-ready step 2 (code-review xhigh). The rule now reads the static text
at each end of a join, so `base + " mdi-" + name` and `mdi-` + name are
reported, while "mdi-home" + " " + tone stays valid. The word boundary
no longer treats `_` as a separator, and the test reuses a shared
sfcTemplate helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(frontend): share the SFC test wrapper, inline isStringLiteral

pr-ready step 3 (simplify). sfc and sfcTemplate now build their case
through one vueCase helper, isStringLiteral is inlined into its only
caller, and the rule points at the build's ICON_NAME so the two
character classes stay in step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(frontend): fail the build on mdi names @mdi/font does not define

The icon trim keeps only names written in full in src/, so a name built
at runtime, or one @mdi/font never had, renders blank in production.
The build now lists each mdi-* token outside tests that names no class
in the stylesheet, with its file and line, and stops. That covers what
the lint rule cannot see: names joined through a variable, .concat, or
+=, and plain typos.

The check found mdi-playstation in the RSelect story, which @mdi/font 7
does not have; it is now mdi-sony-playstation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-17 08:13:26 -05:00
Sam Dornan
bd938bb7eb refactor(frontend): emit themed tokens as light-dark() pairs (#5356) 2026-10-25 20:23:41 -05:00
Sam Dornan
70f125d184 chore(frontend): remove Tailwind CSS and Vuetify (#5315) 2026-10-25 05:03:45 -05:00
Sam Dornan
7eae2b8ffb chore(frontend): remove the v1 UI and console mode (#5309) 2026-10-23 19:37:45 -05:00
Stu Anderson
4e8fec6845 perf(frontend): serve only the mdi icons the app uses (#5118)
* perf(frontend): serve only the mdi icons the app uses

@mdi/font ships a CSS rule and four font formats for every icon. Generate
a trimmed stylesheet from the icons named in the source and alias the
package import to it.

- scripts/build-icons.ts writes src/plugins/materialdesignicons-trimmed.css
  (woff2 only, LF line endings, no source map pointer). predev and prebuild
  run it through build:icons, and CI checks the committed file is current.
- scripts/trim-mdi-fonts.ts builds the allow list from src/, Vuetify's own
  icon set and the icons the backend names. Only a plain
  .mdi-name::before rule can be dropped; anything unsure is kept.
- Custom notification icons the app does not draw fall back to the level
  icon instead of rendering blank.
- An "All icons (mdi)" story under Primitives/RIcon shows every shipped
  icon with search, plus the icons that are available but not shipped.
- Vitest keeps ?raw CSS imports instead of emptying them.
- build:tokens leaves tokens.css alone when only formatting differs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* perf(frontend): trim the mdi icon css in a Vite plugin

Replace the generated, committed icon CSS with a transform plugin that
trims @mdi/font in memory, in dev, Storybook and build. A watcher
reloads dev when the source names a new icon. Drops build-icons.ts, the
alias, the CI staleness check and the checked-in CSS.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* PR feedback

* style(frontend): sort imports in notifications test

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* perf(frontend): reduce the mdi icon trim to a build-only plugin

Drop the icon browser story, the notification glyph probe, the
build:tokens compare and the woff2-only font rewrite. The plugin now
only removes unused icon rules in production builds, so dev serves the
full set and needs no file watcher.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-08 07:25:40 -04:00
Stu Anderson
d8b024bddc chore(e2e): Update playwright with smaller focus (#4932)
* chore(e2e): Update playwright #4772, smaller focus

* chore(e2e) address greptile feedback

* chore(e2e): keep static analysis out of e2e/.output

Everything the suites write (reports, traces, saved sessions) lands in
e2e/.output. It was already gitignored and ESLint skipped it, but the
e2e tsconfig included it through ./**/*.ts, so any .ts file written
there was type-checked, and Trunk skipped it only through the
.gitignore default. Exclude it from the tsconfig and list it in
Trunk's ignore paths explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(e2e): run with zero config locally and typecheck the suite in CI

- Every E2E_* variable now falls back to a default matching
  seed_e2e_users.py, and the shell wins over e2e/.env, which is optional.
- With E2E_BASE_URL unset, the config starts (or reuses) `npm run dev`
  through webServer; CI still sets the URL and serves the static build.
- Drop the migration table for removed variables, the unknown-key checks,
  and the gitignore entries for suite versions that never shipped.
- Add e2e/tsconfig.json to the root project references, so
  `npm run typecheck` (run by Frontend Checks) covers specs/ and setup/.
- Restore `test:e2e:ui`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): make seedUiState win over the user's stored preferences

Preferences are now stored per user (#5098), and the app only adopts an
unscoped value when the user has no `user:<id>:` copy. Saved sessions
carry one, so seedUiState(page, "light") was silently ignored. Drop the
scoped copies before seeding, and assert the light theme in the spec
that relies on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(frontend): add build:preview, which copies frontend/assets into dist

Vite leaves frontend/assets out of the build and only the Docker image
copies it in, so a bare `vite preview` serves the SPA fallback for every
icon, logo, font and default cover. Give that copy one home: the e2e
workflow and the local production-build recipe both use the script. It
copies with fs.cpSync so it also runs from cmd.exe and PowerShell.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(e2e): let the Playwright webServer serve CI again

The suite starts its own server once more, so the workflow no longer
needs its own build, serve, wait and teardown steps, nor the E2E_*
variables that now default to the seeded accounts. In CI the webServer
runs `build:preview` and `vite preview` as it did before this PR; locally
it runs (or reuses) `npm run dev`. The default URL is 127.0.0.1, which
the preview binds, rather than localhost, which can resolve to ::1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): simplify the setup files

- auth.setup.ts signs each account in afresh every run, instead of
  validating saved sessions in a separate browser context. Two sign-ins
  cost about 3s.
- The hand-rolled login retry loop and its CI-specific attempt counts
  give way to `retries: 2` on the setup project, and the timeout
  arithmetic to `setup.slow()`.
- global-setup.ts folds its four check functions into one, and reads the
  library total from the admin's account check instead of fetching it
  twice.
- Drop isSessionValid(), login() and the ESLint exception that only the
  old setup needed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): drop the global-setup preflight

The suite already reports what it checked: a downed backend fails
sign-in through the app-error guard (`GET /api/heartbeat returned 502`),
and a wrong E2E_BASE_URL fails page.goto with the URL. The one case it
explained better, a rejected account, is now an assertion on the
`POST /api/login` status in auth.setup.ts. With no preflight, the suite
never calls the API directly, so its ESLint exception goes too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(e2e): cover every route for both roles, and stop the theme leaking

loads.spec.ts:
- Key PAGES by RouteName from src/plugins/routeNames.ts, with a `skip`
  reason for routes it can't open, so a new route fails the typecheck
  until it is listed. That adds devices and conversion-settings, which
  had drifted out.
- Load each page as every role allowed on it, not only as admin, so a
  viewer-only 403 shows up.
- Drop the wait for in-flight requests, which timed out on pages that
  load slowly on a large library.

Tags and folders now use route names (@page:rom, specs/rom/,
specs/user-profile/).

The app syncs UI settings to the account and reapplies them on sign-in,
so a theme a spec wrote leaked into later sessions: admin ended up on
"auto", and every "dark" spec rendered light. seedUiState now always
stores "auto", the config sets `colorScheme: "dark"`, and the light
spec uses emulateMedia. The saved sessions carry the seeded settings, so
specs no longer call seedUiState themselves.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): keep support/auth.ts to accounts and sign-in

- Navigation helpers (gotoHydrated, gotoFirstRom, gotoOwnProfile) move
  to support/navigation.ts, with a gotoFirstPlatform that loads.spec.ts
  and gotoFirstRom now share.
- openMoreMenu and menuLabels move into rom/actions-menu.spec.ts, their
  only user.
- Role derives from ROLES, and accountFor's return type is inferred, so
  the Account interface goes.
- watchAppErrors folds into the app-error guard, its last caller.
- output.ts exports the results and report paths instead of a
  suiteOutput() that only ever took "specs".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): don't count the page load against gotoHydrated's waits

The /api/permissions/me and login-form waits are armed before page.goto,
so their 5s local action timeout also covered the navigation, and a slow
page timed out before the request was sent. The test's own timeout now
bounds them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): replace the environment module with plain reads

With every variable defaulted, the parser, its aggregated error and the
e2eEnv fixture guarded against mistakes that can barely happen, and
Playwright reports the rest itself.

- playwright.config.ts loads e2e/.env with process.loadEnvFile (the
  shell still wins) and reads E2E_BASE_URL; support/auth.ts reads the
  accounts into ACCOUNTS. Specs that need the URL use the baseURL
  fixture.
- E2E_WORKERS goes: `--workers N` already does that.
- Drop the e2eEnv fixture, its ESLint import ban and the empty-pattern
  exception it needed, and trim .env.example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(e2e): typecheck the suite with tsconfig.node.json

e2e/tsconfig.json was a looser copy of the Node config: it lacked
noUncheckedIndexedAccess and exactOptionalPropertyTypes, so specs/ and
setup/ escaped flags the rest of the frontend, and the e2e support files
through playwright.config.ts, already obey. The suite runs in Node, so
it joins tsconfig.node.json, and typecheck:e2e goes with its config.
The specs needed no changes under the stricter flags.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): trim the ESLint config and the app-error guard's opt-out

- Drop the Node globals block: typescript-eslint turns no-undef off for
  .ts files, so it changed nothing.
- Drop no-skipped-test's allowConditional: nothing in the suite skips.
- Fold the type-info, floating-promise and no-API blocks into one, and
  move the e2e/.output ignore to the base config's generated-output list.
- Remove failOnAppErrors and E2EOptions: nothing opts out of the guard.

Every remaining rule still fires on a probe spec.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(frontend): shorten the test:e2e command note

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(frontend): copy assets with cp -R in build:preview

Also puts a comma in the test:e2e command note.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): one set of timeouts, and treat empty variables as unset

- Local runs used 3-10s timeouts against CI's 10-45s, so slow pages on
  a large dev library failed locally while CI passed. Both now use the
  CI values; a debugger still turns them off.
- An empty E2E_BASE_URL left baseURL as "" while still starting the
  server, and an empty account variable signed in as "". Both fall back
  to their defaults now.
- Set the Desktop Chrome device once, point the slow-test comment at
  test.slow(), and anchor the setup project's testMatch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): apply code-review findings

pr-ready step 2 (code-review xhigh --fix):
- fall back to E2E_PASSWORD, which the seed script uses, for both accounts
- name the cause when the library has no platform or game to click
- read PWDEBUG=0/false as off, as Playwright does
- widen the API-call lint ban to any uncalled `.request` and its import
- compare the signed-in username case-insensitively
- only allow adminOnly with a URL, so the viewer 404 check always runs
- fix the README grep recipe and the recorded-spec location
- Object.hasOwn in seedUiState, ROLES in role.spec, shorter comments

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): apply simplify findings

pr-ready step 3 (simplify):
- one home for the login-form and signed-in-user locators
- derive ROLES and STORAGE_STATE from ACCOUNTS
- openMediaSubtab returns the panel; upload helpers take a scope
- menuLabels reads the panel openMoreMenu returns
- seed the UI state in login.spec's beforeEach
- one no-restricted-syntax entry for the API-call ban
- one port constant in playwright.config.ts
- drop .gitignore entries for paths nothing writes any more

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(e2e): trim two long comments

pr-ready step 4 (review-polish).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(e2e): plainer README opener and comments

pr-ready step 5 (humanizer).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): role selectors, one first-game lookup, shared route scopes

- Select by role and label: the account menu's name ("Account menu for
  <user>") replaces the user-name span, the Login button the login form's
  class, the "Page not found" heading the 404 class, and the subtab rail's
  tablist role the subtab button class.
- library.setup.ts clicks through to the first game once per run and saves
  its URL; specs open it with gotoFirstRom() instead of clicking through
  /platforms in every test. loads.spec keeps the click-through.
- Move the router's route scope table to routeNames.ts as ROUTE_SCOPES, so
  loads.spec derives admin-only pages from it: a newly gated route gets the
  viewer 404 check unless it is listed in VIEWER_OPENS.
- `vite preview` serves frontend/assets through a sirv middleware, as the
  dev server and the Docker image do, so build:preview goes away.
- CI builds the frontend in the background while the backend is set up,
  and the Playwright webServer only runs `vite preview` on that build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(v2): menuitem role on button menu items, tabpanel role on Media panels

- RMenuItem sets role="menuitem" on its button form too, not only on links,
  so every item in an RMenu is a menuitem. Stories give the items a
  role="menu" parent.
- SubtabNav takes an optional idPrefix that gives each rail tab an id and
  aria-controls. MediaTab uses it to make its sections tabpanels labelled
  by their tab; the small-screen sheet variant has no tabs, so its sections
  stay plain.
- The e2e specs read menu labels by the menuitem role and find a Media
  panel by its tabpanel name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-04 20:28:07 -04:00
Zach Clendenen
65247bf82c perf(frontend): load md-editor on demand instead of with the app (#5080)
* perf(frontend): load md-editor on demand instead of with the app

md-editor's config() ran from the app entry, which kept the library in
the entry's import graph. A Vite and Vitest alias now routes every bare
md-editor-v3 import, v1 included, through plugins/mdeditor.ts, which
applies the XSS config as a side effect of the first load. The
sanitizer stays on for every caller without an entry import.

ChangelogDialog (mounted on every v2 page) and NotesTab imported
MdPreview and MdEditor statically. They now load them through small
MarkdownPreview and MarkdownEditor wrappers with defineAsyncComponent,
so md-editor and CodeMirror download when a note or the changelog is
shown, and the editor only when editing starts.

Based on the lazy-loading approach from #4988 by @andest01.

* fix(storybook): keep the app's alias array when adding @ and @v2

Addresses Greptile: spreading the app's alias array into an object turned
it into numeric keys, so Storybook lost the md-editor-v3 alias and with
it the XSS config.

* refactor(frontend): address code-review findings

- Share one alias list between vite, vitest and (through vite.config.js) Storybook.
- Re-export MdEditor and MdPreview from typed modules instead of wrapper SFCs, so callers keep prop and v-model type checks.
- Block deep md-editor-v3 imports in ESLint, since they would skip the XSS config.
- Pass no-echarts where notes and the changelog render, so md-editor does not fetch echarts from unpkg.

* refactor(frontend): simplify the shared md-editor module

Simplify pass:
- Merge the editor and preview re-exports into one shared/markdown module; both pulled the same md-editor chunk and stylesheet.
- MarkdownViewer imports MdPreview from it too, and gets no-echarts like the other v2 previews.
- Drop the ESLint ignore for mdeditor-dist.d.ts, which has no deep import.

* style(frontend): trim the shared md-editor module comment (review-polish)

* fix(frontend): keep the md-editor preview and editor in separate modules

The simplify pass merged them into one module, which put MdEditor and CodeMirror in the preview's chunk: the changelog and note previews went from 78 KB to 290 KB gzip. MarkdownViewer keeps using the shared preview module.

* feat(frontend): show a spinner while the note editor loads

* fix(frontend): cover md-editor chunk loads with the existing spinners (code-review)

ChangelogDialog waits on the renderer chunk with the releases fetch, so a
load failure lands in the dialog's error state instead of blank bodies.
NotesTab's preview gets the same loading spinner as the editor. Document
the @v2 and md-editor-v3 aliases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(frontend): share the async md-editor components (simplify)

Define the async MdPreview/MdEditor wrappers and their attr-dropping
spinner once in shared/asyncMarkdown.ts instead of per NotesTab instance
and again in ChangelogDialog. Keep the md-editor alias out of the tsconfig
paths block in the architecture doc.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(frontend): let TypeScript follow the md-editor-v3 alias

Only Vite knew about the alias, so go-to-definition on md-editor-v3 opened
the package types instead of src/plugins/mdeditor.ts, where the sanitizer
config lives. A tsconfig path now points there too.

* refactor(frontend): turn off md-editor's CDN renderers once for v2

The shared markdownPreview/markdownEditor modules wrap the components with
noHighlight, noKatex, noMermaid and noEcharts, so v2 call sites no longer
repeat the flags and a new one cannot miss them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-03 17:04:09 -04:00
Sam Dornan
893c77f47d Enable noUncheckedIndexedAccess (#5063) 2026-10-02 22:56:24 -04:00
Claude
54a6ca6c96 Remove the no-emdash-in-comment ESLint rule after a one-time sweep
Replace the em-dashes in frontend comments outside the frozen v1 UI
(script, template and style comments, plus the header build-tokens.ts
writes into tokens.css), then drop the rule. String literals keep their
em-dash glyphs. The AGENTS.md rule stays, and pr-ready's humanizer pass
catches new ones in prose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyamrxVw5BzEidVzm68LY7
2026-09-28 17:25:42 +00:00
Georges-Antoine Assi
a35391f77d chore(frontend): trim platform icon comments (review-polish)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:47:39 -04:00
Georges-Antoine Assi
5269e942a6 refactor(frontend): simplify platform icon resolution
- Move the slug-to-URL resolver into src/v2/utils/platformIcons so
  PlatformIcon no longer pulls in the blob cache, and normalize slugs
  through one helper.
- Keep PlatformIcon's tooltip as title or alt, which drops the three
  :show-tooltip="false" overrides the slug fallback needed.
- Drop the plugin's unused directory argument, the redundant onError
  guards and the doubled fsSlug lookup, and shorten the test helper.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:45:59 -04:00
Georges-Antoine Assi
d5e73dae5b fix(frontend): address code-review findings on platform icons
- Emit the slug-to-file map from the manifest plugin and reload it when
  icons change under the dev server.
- Default the plugin's icon directory so both configs share one path.
- Keep decorative platform icons at an empty alt, and turn off the slug
  tooltip where the display name already sits next to the icon.
- Clean up the manifest test's temp dir and cover CachedPlatformIcon.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:31:34 -04:00
Georges-Antoine Assi
ffb6dc62f9 fix(frontend): only request platform icons that ship
The v2 platform icon components probed /assets/platforms/<slug>.svg, then
.ico, and let the browser 404 on every miss before settling on default.ico.
A build-time manifest of the shipped filenames (virtual:platform-icons) now
picks the right file up front, so unknown slugs go straight to the default
and the prefetch cache makes at most one request per shipped slug.

The manifest is a Vite virtual module rather than an eager import.meta.glob,
which would emit hashed copies of all ~240 icons and inline the small ones
into the lib chunk just to read their names.

RPlatformIcon moves out of lib/ to components/shared/PlatformIcon, since it
now depends on platform-specific asset knowledge. Its tooltip also falls
back to the slug when no title or alt is given (the empty-string alt default
used to short-circuit the `??` chain).

Based on the approach in #4728 by @andest01.

Fixes #4671

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 21:08:43 -04:00
zurdi
9fb8bafd65 Merge remote-tracking branch 'origin/master' into fix/gallery-list-table-header 2026-09-22 21:40:33 +02:00
Sam Dornan
bcb203dc18 fix(v2): declare color-scheme with the v2 theme palettes (#4701)
v2's UA-drawn chrome currently follows Vuetify's runtime theme, which injects
`:root { color-scheme: dark }` while a dark theme is active and nothing at the
root for light. That holds only because RomM.vue keeps vuetifyTheme.change() in
sync, and v1 plus Vuetify are slated for deletion: once their stylesheet is
gone the root is undeclared again, where Chrome falls back to light chrome and
a dark v2 UI gets light form controls.

Declare the scheme next to each palette so it travels in the same scope class
the v2 tokens already own, rather than depending on a v1 framework's runtime
theme.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 12:37:34 -05:00
zurdi
8feef65006 refactor(v2): give the list view's repeated parts one home
The redesign wrote the same compact sort control into three headers, the
same compact row anatomy into four components, and a second rAF tween
beside the one it had just added.

- Extract ListSortMenu, which also settles the three different answers
  the headers gave when no column carries the current sort.
- Move the compact row's flex/stack/facts rules to global.css, beside
  the list chrome already there.
- Share one `tween` helper between the two animating composables.
- Let useAnimatedNumber take an already-formatted value, so Stat and
  PageHeader stop repeating the same number-or-string branch.
- Make the tick column a layout token instead of a constant, a CSS
  variable declared only for phones, and three literal fallbacks.
- Read the expansion duration from the motion token it documents.
- Drop the `compact` aliases that only renamed `smAndDown`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bZ7R3xC73MZu1vTNuatPK
2026-09-20 19:49:51 +02:00
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
Zurdi
3a877dad99 Merge pull request #4580 from rommapp/claude/v2-mobile-list-rows
feat(v2): phone-friendly list rows, soundtrack header and mini player
2026-09-17 18:02:52 +02:00
zurdi
b76e2a44df feat(v2): even out the top-bar pills and stream the scan progress
- The scan indicator, the now-playing pill and the user menu trigger share
  a new `--r-nav-pill-h` layout token, so the three pills line up at the
  same height.
- The scan indicator drops its spinner; its bottom progress bar carries
  the activity instead, with a glow streaming along the unfilled track
  while the scan runs. The glow is a new `stream` mode on RProgressLinear.
- On portrait phones the now-playing title is capped narrower and loops,
  so the pill no longer crowds the bar; landscape keeps the wider title.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
2026-09-17 16:32:14 +02:00
Georges-Antoine Assi
ec11448bba fix(frontend): check each nginx isolation map on its own
Address the Greptile review: compare the restated patterns against the
$coep_header and $coop_header maps separately, since a merged set hides a
pattern dropped from one of them, and skip the check where the whole repo
is not mounted, so the drift test can still run in the dev container.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 09:24:00 -04:00
Georges-Antoine Assi
b5cd86e3f7 fix(frontend): restate the player isolation URLs instead of reading nginx
The vite plugin parsed the COOP/COEP patterns out of the nginx template at
config load, but the Dockerfile's frontend-build stage copies frontend/
alone, so the config threw ENOENT and the image build failed.

Restate the two patterns in the plugin and let its test assert they still
match the template's map, which also drops the dev container mount that
existed only to feed that read.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 09:13:32 -04:00
Georges-Antoine Assi
a3b534a1c3 chore(v2): address the review comments on the launch path
Condense the comments that ran past two lines, and build the launch
intent fixtures from typed factories again rather than bare literals.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:36:53 -04:00
Georges-Antoine Assi
fdb4cb5e82 chore(v2): trim the launch-path comments and mount the nginx map in dev
The dev container mounts frontend/ alone, so the vite plugin that now
reads the nginx template could not find it and the dev server refused to
start. Mount the template directory read-only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:18:21 -04:00
Georges-Antoine Assi
8ecb4dd0c5 refactor(v2): fold the cleanup pass findings into the launch path
The dev server now parses the isolated URLs out of the nginx template
instead of restating them, and refuses a template that yields none.

js-dos skips the runtime preload on the leg it is about to reload away,
records its play session on pagehide, and takes the relaunch marker from
the composable that defines it.

Also drops a redundant parameter and a duplicated derivation from
applyLaunchIntent, collapses the repeated id checks in isLaunchIntent,
gives the js-dos asset bases one home, and trims the comments.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:18:20 -04:00
Georges-Antoine Assi
3eadc4c33c fix(v2): apply the code review fixes to the launch path
Replace the player entry when leaving by SPA navigation, keep a failed
js-dos runtime load from stacking a second stylesheet, and answer the
player URLs from `vite preview` as well as the dev server.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 08:18:20 -04:00
zurdi
5497ee9edb chore(v2): trim the launch-path comments and factor the test fixtures
Comments down to the fact a reader cannot recover from the code, and the save,
state and firmware fixtures behind one factory each rather than a cast per
literal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1VFUvsR5wYK3axxR1gebc
2026-09-17 05:53:30 +02:00
zurdi
6bf6ed25d2 refactor(v2): fold the cleanup pass findings into the launch path
- The stream player restated the stop pair `useActivityPresence.stop()` now
  owns, so it calls it.
- The dev server's isolation list and the nginx map it mirrors are checked
  against each other by a test, rather than by a comment asking whoever edits
  one to remember the other.
- One case covers the js-dos runtime being injected once, whichever side of the
  first load a second view mounts on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1VFUvsR5wYK3axxR1gebc
2026-09-17 05:44:52 +02:00
zurdi
8d4e856360 fix(v2): close the gaps the code review found in the player launch path
Findings from the review pass over the SPA launch change, plus the two bot
reviews on the PR.

Correctness:
- Presence stops were addressed to the device, not to a rom, so a view that
  never announced anything could clear what another tab was playing. A stop now
  needs a started session, and happens once; `useActivityPresence` grows the
  `stop()` the two call sites were spelling out by hand.
- The EmulatorJS exit read `window.EJS_emulator`, which a departure taken while
  the loader was still injecting would not see yet, so the runtime could be left
  in a document a later launch then failed to load into. It tracks the injection
  itself.
- js-dos resolved its asset base per view: a second launch in a document whose
  runtime came from the CDN looked for the payloads locally. Two views mounting
  at once could also both inject the runtime. Both now go through one
  document-level loader, which resolves with the base it served from and lets a
  later mount retry a failed load.
- A blocked sessionStorage threw while every EmulatorJS view was initialising.
  Storage that cannot be read is an absent intent, and one that cannot be
  written cancels the relaunch rather than losing the selection to it.
- Outside a secure context the headers cannot expose SharedArrayBuffer, so the
  reload only delayed the same error by a round trip. It is refused up front.
- The dev server mirrored one of the two nginx isolation entries, leaving the
  console player unisolated there.

Reuse and cover:
- `usePlayerExit` owns the whole rule again: `departing` moved in, so both views
  use `guard` rather than one of them restating it, and the `leaving` flag it
  never needed is gone.
- Resolving an intent back into a selection is a pure pair in `launchIntent.ts`
  with its own tests, rather than closures the view kept to itself.
- The Vite plugin is a script beside `precompress`, so the regexes that have to
  track nginx are tested.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R1VFUvsR5wYK3axxR1gebc
2026-09-17 05:33:30 +02:00
Sam Dornan
1f231c84f4 test(precompress): close the gaps the review found in the gzip_static guards
The nginx guard only read the http-level default.conf and the three raw
location bodies, so two ways of reintroducing the ROM-corruption bug went
undetected. Both were confirmed against the suite before this change, each
leaving all seven tests green:

- gzip_static added at server scope in the template, with the locations left
  intact: /library/ and /cache/ inherit it, and a request for Game.nes returns
  Game.nes.gz's bytes.
- gzip_static removed from the fingerprinted-assets regex location, which the
  parametrised list never covered, silently dropping precompressed bundles.

Parse the template's location blocks instead, honouring braces inside the
quoted regex matcher, and assert against server scope, each build-output
location including the regex one, and any location that gains the directive.
A prefix match would have let /assets/romm/resources/ pass as expected, so
matchers resolve exactly and only the regex is keyed by its opening.

Also tie MIN_BYTES to nginx's gzip_min_length with a test rather than a
comment, cover the "gzip made it bigger" branch that the extension filter
kept unreachable, drop an em dash, and correct a comment that claimed every
file without a .gz sibling is gzipped on the fly, which is untrue for types
outside gzip_types.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 04:49:06 +00:00
Sam Dornan
64740468ec fix(frontend): address the review findings on the precompress plugin
The summary divided by zero and printed "NaN% smaller" when nothing
cleared the extension and size filters.

The comment on the extension list said it tracks gzip_types, which was
wrong twice over: .svg, .wasm, .webmanifest and .map are absent from that
directive, and gzip_static serves a .gz sibling without consulting it at
all. Someone editing either list on the strength of that comment would
have changed behaviour silently.

Storybook builds ran the plugin too, gzipping storybook-static that nginx
never serves. It is stripped alongside vite-plugin-pwa, which .storybook
already does for the same reason.

The Python test could only grep vite.config.js for the call, so a gutted
closeBundle or apply: "serve" left it green. A vitest suite now runs the
hooks against a temporary directory and checks the archive round-trips,
that small and already-compressed files are skipped, and that a rerun does
not compress its own output.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 02:09:24 +00:00
Sam Dornan
36cda30407 refactor(frontend): run precompression as a build plugin
Chaining the step onto the build script left `vite build` on its own
without compression, and only worked because npm ran the chain. A plugin
makes it part of the build itself, so there is nothing to bypass.

It runs with enforce: post so the service worker vite-plugin-pwa emits is
compressed too, and reads its output directory from the resolved config
rather than assuming dist. The precache is generated earlier in the build
and still lists no .gz entries.

Written here rather than taken off the shelf: vite-plugin-compression was
last published in 2022, vite-plugin-brotli caps at vite 7, and
vite-plugin-compression2 declares no vite 8 support while depending on
@rollup/pluginutils, which this rolldown-based build does not use. Node's
zlib covers it in one file with no dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 01:38:01 +00:00
Sam Dornan
76ab7ac7c7 perf(frontend): precompress built assets and serve them with gzip_static
The SPA bundle was compressed on every cold page load. Writing a .gz
sibling at build time and turning on gzip_static moves that work to the
build: serving the 1.6 MB main bundle drops from ~71ms to ~9ms per
request, measured over 25 requests against a local nginx.

Level 9 is affordable when it runs once, though it lands within a percent
of what nginx produces at runtime, so the win is the CPU rather than the
bytes. Anything without a .gz sibling still compresses on the fly.

The step is chained into build rather than a postbuild hook because
frontend/.npmrc sets ignore-scripts, which stops npm running pre and post
hooks at all. Node's zlib does the work, so no new dependency.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 01:30:10 +00:00
zurdi
45f55bf633 fix(v2): gallery header/nav mobile polish + dimension tokens
- RTabNav: the horizontal tab strip no longer swallows vertical swipes
  (`overflow-y: hidden` so it's not a vertical scroll container; drop
  `touch-action: pan-x`, which froze the page) — the view scrolls even
  when the swipe starts on the tabs.
- AppNav: remove the "back to v1" escape-hatch button (and its now-dead
  code / imports / styles); the v1 UI keeps its own switch.
- GalleryShell/AlphaStrip: the stuck toolbar overlay now insets by the
  strip's real footprint via shared tokens, so it lines up exactly with
  the in-flow toolbar; wider, more tappable strip on phones, raised to
  centre in the visible band (above the bottom bar).
- CollectionHead / PlatformHead: bigger collection cover on phones
  (matches the index); the platform icon is a per-breakpoint square in a
  box that grows to it, so it reflows instead of overflowing/clipping.
- Add `--r-coll-cover-*` and `--r-alpha-strip-w*` dimension tokens.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 11:56:42 +00:00
zurdi
c8bc51dc81 Enhance light theme support with color adjustments and new tokens 2026-06-24 17:52:21 +00:00
zurdi
25b9397467 feat: implement CRT mode with visual effects and toggle functionality 2026-06-17 01:28:17 +02:00
zurdi
da0961281a Implement responsive navigation layout with BottomNav and BreakpointBadge components 2026-06-05 15:09:26 +02:00
zurdi
16d6cef03e feat: implement drawer z-index and enhance search context handling 2026-05-25 20:44:37 +00:00
zurdi
1aa23bd46e feat: unified RDialog consumers 2026-05-21 16:25:31 +00:00
zurdi
d7eb469f1f feat: introduce zIndex tokens for consistent stacking layers across components 2026-05-14 17:08:35 +00:00
zurdi
674ca98c57 feat: add RExpandTransition component for height animations
- Introduced RExpandTransition.vue to animate height changes of wrapped elements using v-if or v-show.
- Added index.ts to export the new RExpandTransition component.
- Updated RList, RListItem, RToolbar, RTooltip, RVirtualScroller components to remove Vuetify references in comments.
- Replaced v-expand-transition with RExpandTransition in Login.vue and Patcher.vue for consistent animation behavior.
- Refactored Scan.vue to manage open panels using a Set for better performance and clarity.
- Updated styles in global.css and tokens.css to improve focus ring visibility and component styling.
- Removed vuetify.ts theme definitions as they are no longer needed.
2026-05-14 15:07:03 +00:00
zurdi
8b796098d0 feat: implement list mode enhancements; add new components for list row and header, update styles and tokens for improved layout 2026-05-07 15:09:26 +00:00
zurdi
1728980948 feat: add status action to GameActionBtn and integrate with GameCard
- Introduced a new "status" action in GameActionBtn, allowing users to set and display game status.
- Replaced the StatusBadge component with the GameActionBtn in GameCard for a unified interface.
- Updated various components to accommodate the new status feature, including GameDetails and AppNav.
- Added CSS variables for page max width to ensure consistent layout on ultrawide displays.
- Removed redundant max-width styles from several components to streamline layout management.

Co-authored-by: Copilot <copilot@github.com>
2026-05-06 09:34:10 +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
zurdi
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
zurdi
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
zurdi
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