Skip to content

feat: add listening activity / stats page - #438

Open
luishidalgoa wants to merge 3 commits into
victoralvesf:developmentfrom
luishidalgoa:feat/#436-listening-activity
Open

feat: add listening activity / stats page#438
luishidalgoa wants to merge 3 commits into
victoralvesf:developmentfrom
luishidalgoa:feat/#436-listening-activity

Conversation

@luishidalgoa

Copy link
Copy Markdown

What

Adds an Activity page (sidebar → Activity) with listening stats, as requested in #436 — similar to the activity views some Subsonic clients offer.

Sections:

  • Summary cards: total plays, listening time, unique artists, streak (current + best).
  • Daily activity and listening hours bar charts.
  • Genres breakdown (donut) and a calendar heatmap of listening history.
  • Recent plays and Top albums.
  • A 7D / 30D / 90D / All range filter scopes the local stats.

How the data works (please read)

The Subsonic API exposes play counts and a last-played timestamp, but no per-play history with timestamps, which the time-series views (daily/hourly/heatmap/streak) need. So this takes a hybrid approach:

  • Local tracking — when a track is scrobbled (the existing submission point in player.store), the play is also recorded in IndexedDB (idb-keyval). Everything time-based is derived from this log. It's bounded (max 50k events) and best-effort (never blocks playback). This means the stats start empty and fill in from the moment the feature ships — there's no historical backfill because the server can't provide it.
  • ServerTop albums uses getAlbumList2 (frequent), so that panel has data from day one.

All the derivation logic is pure and isolated in src/utils/activity.ts; the page/components just render it, so swapping any panel between local/server later is easy.

Notes

  • Adds recharts for the charts (donut/bars); the heatmap is hand-built.
  • New route /library/activity (auth-gated like the rest), sidebar entry, and i18n for en/es/pt/pt-BR (others fall back to en-US / Weblate).
  • tsc, Biome (incl. the repo pre-commit hook) and a production vite build are all clean.

This is a proposal — happy to adjust scope, drop the dependency for hand-rolled charts, or change the data strategy (e.g. local-only, or server-only) based on what you'd prefer. Since it introduces a new dependency and an on-device tracking store, I wanted to check the direction with you.

Closes #436

Adds an "Activity" page that surfaces the user's listening stats,
similar to the activity views found in some Subsonic clients.

Plays are recorded locally in IndexedDB when a track is scrobbled, and
the page derives from that history:

- summary cards (total plays, listening time, unique artists, streak)
- daily activity and listening-hours bar charts
- a genres breakdown (donut) and a calendar heatmap of listening history
- recent plays

Top albums are pulled from the server (getAlbumList2 frequent), so that
panel has data from day one. A 7D/30D/90D/All range filter scopes the
local stats. Since the Subsonic API exposes no per-play history, the
time-series data accumulates on-device from the moment the feature ships.

Adds recharts for the charts and translations for en/es/pt/pt-BR.

Closes victoralvesf#436

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

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

@luishidalgoa is attempting to deploy a commit to the Victor Alves' projects Team on Vercel.

A member of the Team first needs to authorize it.

The empty state hid the whole page, including the server-backed Top
Albums panel, so a brand-new user saw a fully blank page. Keep Top
Albums visible alongside the empty state so there is immediate content
while the local play history builds up.

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

Copy link
Copy Markdown
Author
image image

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aonsoku Ready Ready Preview, Comment Jul 12, 2026 1:09am

@victoralvesf
victoralvesf deleted the branch victoralvesf:development July 14, 2026 12:20
@victoralvesf victoralvesf reopened this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants