Skip to content

refactor(webapp): split the admin and playing pages and the query catalogue into directories - #360

Merged
InstaZDLL merged 2 commits into
mainfrom
refactor/webapp-split-pages
Oct 26, 2026
Merged

InstaZDLL merged 2 commits into
mainfrom
refactor/webapp-split-pages

Conversation

@InstaZDLL

@InstaZDLL InstaZDLL commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Phase A of the webapp restructuring, for the pages, components and API client: the three files over 600 lines in webapp/src/pages/, webapp/src/components/ and webapp/src/api/ become directories, one file per section. Moves only: no export renamed, no signature or behaviour changed, and every import specifier elsewhere in the client (./pages/admin-page, ./pages/playing-page, ../api/queries, ./queries, ./playing-page) resolves as it did, to the directory's index.

The history has two commits: the git mv alone, then the split.

Old → new

Old Lines New Lines
api/queries.ts 688 api/queries/index.ts: the module's doc comment and the explicit re-exports 77
api/queries/catalog.ts: albums, songs, artists (with the enrichment retry), genres, the random draw, search 154
api/queries/collections.ts: playlists, shares, bookmarks, radio stations, smart playlists, podcasts 50
api/queries/tracks.ts: one track's panels: properties, lyrics, canvas, the tag editor 82
api/queries/listening.ts: stats, mixes, now playing, favourites, history, scrobbles (HISTORY_PLAYS goes with its two users) 173
api/queries/maintenance.ts: needs attention, quality, the filed tree and folder tracks, missing and purged files 175
api/queries/administration.ts: API tokens, own credentials, library members and settings, the administration listing 71
pages/playing-page.tsx 732 pages/playing-page/index.tsx: PlayingView, playingView, the view switcher, PlayingPage and its bookmarks 229
pages/playing-page/lyrics.tsx: currentLyricLine, lyricSheetState, useLyricSheet, useFollowSungLine, LyricLines, LyricsStrip, LyricsView 318
pages/playing-page/detail-view.tsx: detailSplit, DetailView 82
pages/playing-page/immersive.tsx: ImmersiveView 137
pages/admin-page.tsx 860 pages/admin-page/index.tsx: AdminPage (library registration, account creation, the account rows) 231
pages/admin-page/libraries.tsx: LibraryMembersPanel, LibrarySettingsPanel 361
pages/admin-page/credentials.tsx: CredentialForm, ApiTokensPanel 163
pages/admin-page/activity.tsx: SCAN_STATUS, ScanProgress, NowPlayingPanel 131

No other .ts/.tsx file under pages/, components/ or api/ was over its cap when this started (components/smart-playlists.tsx 589, api/session.test.ts 601, a test file under its 1,000).

The visibility changes are the ones the split needs and nothing more: export added to LyricSheet, useLyricSheet, LyricsStrip, LyricsView, ImmersiveView, DetailView, CredentialForm, ApiTokensPanel, ScanProgress, NowPlayingPanel, LibraryMembersPanel and LibrarySettingsPanel, each imported by its directory's index or a sibling. None of them is re-exported, so each directory's public surface is exactly the old file's: 51 names for queries, 6 for playing-page, 1 for admin-page.

Deviations from the suggested shape, and why

  • No radio.ts, podcasts.ts or playlists.ts under queries/. Each is two to four one-line query options; a file each would have been 10–20 lines. They are one family, what an account keeps, in collections.ts (50 lines).
  • maintenance.ts holds the filed tree and folder tracks as well as the three maintenance sections. The old file had a displaced doc comment for filedTreeQuery sitting directly above the "Needs attention" comment (see below). Keeping lines 237–359 together keeps that comment exactly where it was rather than moving it, which would have been a fix.
  • nowPlayingQuery is in listening.ts, beside the other listening reads, though only the admin screen asks for it.
  • The admin screen's account and library sections stay in index.tsx. The forms that create a library and an account, and the per-account rows, are JSX inside AdminPage sharing its state (notice, adminError, watchedScan, reload). Lifting them out would mean new props and components, which is not a move.

Proofs

Every line, exactly once. A script (not committed) takes each old file's non-blank lines outside import/export … from statements, strips a leading export , and compares them as a multiset against the same lines of the new files minus their one-line header. It also compares the old file's exported names against the new index's:

src/api/queries: 569 old lines checked over 7 files; 0 mismatches; exports old 51, index 51, missing [], extra []
src/pages/playing-page: 679 old lines checked over 4 files; 0 mismatches; exports old 6, index 6, missing [], extra []
src/pages/admin-page: 798 old lines checked over 4 files; 0 mismatches; exports old 1, index 1, missing [], extra []

The check was shown to fail on purpose: against a copy of the originals with the albums key reordered (["albums", scope ?? null, sort]) and one line of PlayingPage deleted, it reports both (old x1, new x0 / new only x1) and exits 1. Because every key literal is one of those lines, the query keys are byte-identical: cache entries are keyed by them.

vitest (bun run test): 40 files, 323 tests before and after. api/queries.test.ts, pages/playing-view.test.ts and pages/lyrics.test.ts stay where they were; their ./queries and ./playing-page specifiers now resolve to the directories.

Playwright (bunx playwright test --list, listing only): 508 tests in 5 files before and after.

Checks run (in webapp/)

  • bunx biome check .: the same 10 warnings as main, none in the new files
  • bun run typecheck: clean
  • bun run test: 323 passed
  • bun run build: built

Playwright was not run locally; CI runs it on this PR.

Noticed, not changed

  • A displaced doc comment in the query catalogue. The /** A library's whole filed tree … */ block sits directly above the /** "Needs attention" (RFC-015) … */ block, two JSDoc comments stacked, so it documents nothing and filedTreeQuery, about 100 lines further down, has no doc comment. Kept verbatim in api/queries/maintenance.ts.
  • Untranslated text on the admin screen. Each account row reads {user.role} · {user.folder_ids.length} libraries, with "libraries" hard-coded in English, and the membership role picker shows the raw listener/manager values as option labels.
  • CLAUDE.md's webapp layout paragraph says pages/ holds "one screen per file". After this PR a screen can be a directory. That is for the phase B documentation pass.

Summary by CodeRabbit

  • Nouvelles fonctionnalités
    • La page d’administration permet de gérer les bibliothèques et leurs membres, les comptes utilisateurs, les jetons API et les identifiants Subsonic. Elle affiche aussi la progression des analyses et les écoutes en cours.
    • La page de lecture propose des vues détaillée, paroles et immersive. Les paroles synchronisées peuvent être parcourues par horodatage, et la vue immersive inclut les commandes de lecture.
    • Les paramètres d’une bibliothèque peuvent être modifiés, et sa suppression nécessite une confirmation par saisie de son nom.

…rectories

Signed-off-by: InstaZDLL <github.105mh@8shield.net>
…alogue by section

Signed-off-by: InstaZDLL <github.105mh@8shield.net>
@github-actions github-actions Bot added scope: web Embedded web player (React) scope: components Web UI components type: refactor Code refactoring size: xl > 500 lines labels Oct 26, 2026
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between f4b3952 and 3f4590e.

Files selected for processing: 18
  • webapp/src/api/queries.ts
  • webapp/src/api/queries/administration.ts
  • webapp/src/api/queries/catalog.ts
  • webapp/src/api/queries/collections.ts
  • webapp/src/api/queries/index.ts
  • webapp/src/api/queries/listening.ts
  • webapp/src/api/queries/maintenance.ts
  • webapp/src/api/queries/tracks.ts
  • webapp/src/pages/admin-page.tsx
  • webapp/src/pages/admin-page/activity.tsx
  • webapp/src/pages/admin-page/credentials.tsx
  • webapp/src/pages/admin-page/index.tsx
  • webapp/src/pages/admin-page/libraries.tsx
  • webapp/src/pages/playing-page.tsx
  • webapp/src/pages/playing-page/detail-view.tsx
  • webapp/src/pages/playing-page/immersive.tsx
  • webapp/src/pages/playing-page/index.tsx
  • webapp/src/pages/playing-page/lyrics.tsx
Files with no reviewable changes: 3
  • webapp/src/pages/admin-page.tsx
  • webapp/src/pages/playing-page.tsx
  • webapp/src/api/queries.ts

Limit details: You’ve used the included review currently available. Your 85 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Walkthrough

Les requêtes centralisées sont réparties en modules par domaine, avec un point d’entrée qui les réexporte. Les pages d’administration et de lecture sont également réparties en composants spécialisés pour leurs opérations, leurs vues et leurs affichages.

Changes: Modularisation des requêtes

Layer / File(s) Summary
Catalogue et collections
webapp/src/api/queries.ts, webapp/src/api/queries/catalog.ts, webapp/src/api/queries/collections.ts
Les requêtes du catalogue et des collections sont définies séparément. Les clés incluent les paramètres pertinents; les requêtes paginées, la recherche et l’enrichissement ont leurs règles dédiées.
Écoute, maintenance et pistes
webapp/src/api/queries/listening.ts, webapp/src/api/queries/maintenance.ts, webapp/src/api/queries/tracks.ts
Les modules ajoutent les requêtes d’écoute, de maintenance et de pistes. Ils définissent notamment la pagination, la résolution tolérante de pistes et les délais d’actualisation.
Administration et exports publics
webapp/src/api/queries/administration.ts, webapp/src/api/queries/index.ts
Les requêtes d’administration sont ajoutées. Le point d’entrée réexporte les fonctions et constantes des modules de requêtes.

Page d’administration

Layer / File(s) Summary
Page et activité d’administration
webapp/src/pages/admin-page.tsx, webapp/src/pages/admin-page/index.tsx, webapp/src/pages/admin-page/activity.tsx
La page regroupe la création de bibliothèques et de comptes, les changements de statut et le lancement des scans. Des composants affichent leur progression et les écoutes en cours.
Panneaux de gestion
webapp/src/pages/admin-page/libraries.tsx, webapp/src/pages/admin-page/credentials.tsx
Les panneaux gèrent les membres et paramètres des bibliothèques, les identifiants Subsonic et les jetons API. Les données des panneaux concernés sont chargées à leur ouverture.

Page de lecture

Layer / File(s) Summary
Vues de lecture et signets
webapp/src/pages/playing-page.tsx, webapp/src/pages/playing-page/index.tsx, webapp/src/pages/playing-page/detail-view.tsx, webapp/src/pages/playing-page/immersive.tsx
La page sélectionne la vue détail, paroles ou immersive à partir de l’URL. Elle conserve les opérations de sauvegarde, de suppression et de lecture des signets.
Affichage et suivi des paroles
webapp/src/pages/playing-page/lyrics.tsx
Le module détermine l’état des paroles et la ligne synchronisée active. Les vues suivent cette ligne et les lignes horodatées permettent de rechercher une position.

Priority: Low

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Refactor

Suggested labels: scope: web, size: xl

Merge Risk: Minimal · up to 3f459

This is a behavior-preserving refactor that splits the admin page, playing page and query catalogue into directories. Public exports and import resolution are preserved, and no merge-blocking issue was found. The remaining check is CI, which runs the Playwright suite.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 54.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 35 functions across 15 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed Le titre décrit clairement la restructuration des pages d’administration et de lecture ainsi que du catalogue de requêtes en répertoires.
Description check Passed La description est complète et précise. Elle présente l’objectif, les changements, les choix de structure, les preuves de conservation du comportement, les tests exécutés et les points différés. Elle …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

La description est complète et précise. Elle présente l’objectif, les changements, les choix de structure, les preuves de conservation du comportement, les tests exécutés et les points différés. Elle n’utilise pas exactement les titres du modèle et ne reprend pas la confirmation finale du modèle, mais les informations essentielles sont présentes.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

🔧 Biome (2.5.15)
webapp/src/api/queries/administration.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

webapp/src/api/queries/catalog.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

webapp/src/api/queries/collections.ts

Biome could not lint this file: nested root configuration. Check the repository's Biome configuration and plugins.

  • 12 others

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added type: refactor Code refactoring and removed type: refactor Code refactoring labels Oct 26, 2026
@InstaZDLL InstaZDLL self-assigned this Oct 26, 2026
@InstaZDLL
InstaZDLL merged commit 7672fb4 into main Oct 26, 2026
16 checks passed
@InstaZDLL
InstaZDLL deleted the refactor/webapp-split-pages branch October 26, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: components Web UI components scope: web Embedded web player (React) size: xl > 500 lines type: refactor Code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant