Library page: unified Albums + Artists view with three toggles
Stacked on PR #40. The third of four PRs in the Library redesign: replaces the old List view at / with a single Library page that can render albums or artists, from the unsorted or sorted side, in grid or list view.
What changes
-
/is now the Library page. Four orthogonal toggles drive what's shown:- Source: Unsorted | Sorted (strict — no 'all')
- Type: Albums | Artists
- View: Grid | List
- Search: client-side filter over the loaded set All four (except search) live in URL params, so refreshes and back/forward preserve state and views are shareable.
-
+page.server.tsSSR loader normalizes bothalbums(unsorted) andsorted_albumsrows into aLibraryAlbumItem[]. Artists view reuses the extendedgetArtistIndexfrom earlier in this PR. -
getArtistIndexnow takes a thresholds parameter and returns per-source quality counts (green/yellow/red/gray) plustotalSizeBytes. ExistingpendingCount/sortedCountfields preserved so the legacy/artistspage still renders. -
New components:
-
LibraryAlbumCard— grid card taking the normalized shape (handles sorted-side missing artwork via the existing placeholder) -
AlbumGrid— responsive 280px grid wrapper -
AlbumListRow+AlbumTable— eight-column list view (Artist · Album · Year · Quality · Codec · Bitrate · Sample rate · Size) -
ArtistCard— grid card with name, count, and quality dots -
ArtistListRow— table row equivalent
-
-
$lib/format.tsconsolidates theformatBytes(and addsformatHz/formatBitrate/formatBitDepth) duplicated acrossbatch/+page.svelteandFileList.svelte. Existing duplicates aren't removed in this PR — that's PR 4 cleanup. - Nav label changed from 'List' to 'Library'. The 'Artists' link stays as the working fallback for this PR.
Behavior carried over
- Clicking an unsorted album opens
AlbumOrganizePanel(existing flow viafetchAlbum+currentAlbumstore). - Refresh icon triggers
/api/scanandinvalidateAll()s the loader. - Active scan banner with progress.
Behavior intentionally not in this PR
- Sorted album clicks are no-ops. The slide-over panel becomes mode-aware (read-only for sorted) in PR 4.
-
Artist clicks navigate to
/artist/[key], which 404s until PR 4. The legacy/artistsroute is kept as a working fallback.
Verification
-
pnpm run buildpasses. - Visit
/. Default view: Unsorted + Albums + Grid (matches the old List page visually, plus quality dots from PR 2). - Toggle each of the six combinations:
- Unsorted + Albums + Grid / List
- Sorted + Albums + Grid / List (sorted side now populates after the PR 1 backfill scan)
- Unsorted + Artists + Grid / List
- Sorted + Artists + Grid / List
- Each toggle updates URL params; refresh and back/forward preserve state.
- Search filters artist+album within the current view.
- Click an unsorted album → existing sort panel opens.
- Click a sorted album → no-op (PR 4 will make the panel read-only-aware).
- Click an artist → navigates to
/artist/[key]which 404s in this PR. - Old
/artistsroute still works.