M8a: Listening stats, playlists, collections, more themes #22

Merged
mett merged 2 commits from feat/m8a-extras into main 2026-10-29 12:40:55 +01:00
Owner

First half of M8 (split agreed in the session): stats, playlists, collections and more themes. Library admin follows as M8b, which will close #8.

Part of #8

What's in it

  • Listening stats (/stats): total time, days listened, finished items, today, days in a row, a 7-day bar chart in local time, most listened items, top authors and genres, recent sessions. Summarized in Rust from /api/me/listening-stats; week and streak are computed in the UI so they follow the local calendar.
  • Playlists (per user and library; books or episodes): index with "New", detail page to play through, rename/describe, reorder, remove, delete. Removing the last item makes the server delete the playlist, so the page goes back to the list.
  • Collections (shared, book libraries only): same pages. Editing needs ABS's update permission, deleting needs delete (now on User as canUpdate/canDelete). The server needs a book to create one, so new collections start from "Add to".
  • "Add to" menu on book pages and episode rows: toggles membership in playlists/collections, or starts a new one with the item.
  • Play queue: playing a playlist or collection sets a queue in AppState. Autoplay and Up Next follow it ("Playlist: Road trip"); playing anything not on it ends it.
  • Themes: Catppuccin Latte/Frappé/Macchiato/Mocha, Nord, Dracula, Spotify next to dark/OLED/light, picked from a swatch grid. Palette themes default to their own accent (cover or fixed colour still selectable); Spotify always uses #1DB954.
  • Fix: app.html paints the body #0e0e0e inline, which dimmed the content of every light theme (the existing Light too). theme.apply() now sets the body background.

Tests

  • pnpm check: 0 errors. Prettier: clean on all tracked and new files. (pnpm lint as a whole trips over another session's untracked .claude/worktrees/ checkout, not part of this branch.)
  • cargo fmt --check, cargo clippy --all-targets -D warnings: clean.
  • cargo test against the test server (ABS 2.37.2 via Podman): all pass. New live_lists.rs covers stats decoding and the playlist (books and episodes) and collection lifecycles, including the server deleting an emptied playlist. New unit tests cover the stats summary, playlist decoding and the queue.
  • Bindings committed; git diff --exit-code -- src/lib/bindings clean.
  • Tried by hand in tauri dev (isolated XDG dirs, test server): stats page, creating a playlist, adding from a book and an episode, reorder, play from an entry with Up Next showing the playlist, creating and renaming a collection, removing the last playlist item, switching between all ten themes.
  • Not tested: Windows build.

🤖 Generated with Claude Code

First half of M8 (split agreed in the session): stats, playlists, collections and more themes. Library admin follows as M8b, which will close #8. Part of #8 ## What's in it - **Listening stats** (`/stats`): total time, days listened, finished items, today, days in a row, a 7-day bar chart in local time, most listened items, top authors and genres, recent sessions. Summarized in Rust from `/api/me/listening-stats`; week and streak are computed in the UI so they follow the local calendar. - **Playlists** (per user and library; books or episodes): index with "New", detail page to play through, rename/describe, reorder, remove, delete. Removing the last item makes the server delete the playlist, so the page goes back to the list. - **Collections** (shared, book libraries only): same pages. Editing needs ABS's `update` permission, deleting needs `delete` (now on `User` as `canUpdate`/`canDelete`). The server needs a book to create one, so new collections start from "Add to". - **"Add to" menu** on book pages and episode rows: toggles membership in playlists/collections, or starts a new one with the item. - **Play queue:** playing a playlist or collection sets a queue in `AppState`. Autoplay and Up Next follow it ("Playlist: Road trip"); playing anything not on it ends it. - **Themes:** Catppuccin Latte/Frappé/Macchiato/Mocha, Nord, Dracula, Spotify next to dark/OLED/light, picked from a swatch grid. Palette themes default to their own accent (cover or fixed colour still selectable); Spotify always uses #1DB954. - **Fix:** `app.html` paints the body `#0e0e0e` inline, which dimmed the content of every light theme (the existing Light too). `theme.apply()` now sets the body background. ## Tests - `pnpm check`: 0 errors. Prettier: clean on all tracked and new files. (`pnpm lint` as a whole trips over another session's untracked `.claude/worktrees/` checkout, not part of this branch.) - `cargo fmt --check`, `cargo clippy --all-targets -D warnings`: clean. - `cargo test` against the test server (ABS 2.37.2 via Podman): all pass. New `live_lists.rs` covers stats decoding and the playlist (books and episodes) and collection lifecycles, including the server deleting an emptied playlist. New unit tests cover the stats summary, playlist decoding and the queue. - Bindings committed; `git diff --exit-code -- src/lib/bindings` clean. - Tried by hand in `tauri dev` (isolated XDG dirs, test server): stats page, creating a playlist, adding from a book and an episode, reorder, play from an entry with Up Next showing the playlist, creating and renaming a collection, removing the last playlist item, switching between all ten themes. - Not tested: Windows build. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- API client for /api/me/listening-stats, playlists (per library, create,
  rename, reorder, add, remove, delete) and collections (same set).
- Stats are summarized in Rust: days sorted, top items/authors/genres by
  listening time, recent sessions newest first, finished count from the
  progress map. Week and streak are left to the UI's local calendar.
- Playing a playlist or collection sets a queue: autoplay and Up Next follow
  it; playing anything not on it ends it.
- User gains can_update/can_delete (ABS permissions) for collection edits.
- live_lists.rs covers stats decoding and the playlist/collection lifecycle,
  including the server deleting a playlist once its last item is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
M8 UI: stats page, playlists, collections, more themes
Some checks failed
CI / linux (pull_request) Has been cancelled
CI / fedora (pull_request) Has been cancelled
CI / windows (pull_request) Has been cancelled
f2a68de8ad
- Stats page: tiles (total, days listened, finished, today, days in a row),
  a 7-day bar chart in local time, most listened items, top authors and
  genres, recent sessions.
- Playlists and Collections in the sidebar (collections in book libraries
  only): index pages, detail pages to play through, rename, reorder,
  remove and delete. Collection edits follow the server's update/delete
  permissions. "Add to" menu on book pages and episode rows.
- Themes: Catppuccin Latte/Frappé/Macchiato/Mocha, Nord, Dracula and
  Spotify next to dark/OLED/light. Palette themes default to their own
  accent (cover or a fixed colour still selectable); Spotify keeps its
  green. Fixes light themes being dimmed by app.html's inline dark body.
- PLAN.md/README: M8 split into M8a (this) and M8b (library admin).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mett merged commit b5add535ad into main 2026-10-29 12:40:55 +01:00
Sign in to join this conversation.
No description provided.