feed: add public popularity (views-over-time) chart in the ⋯ menu (#26)

A "Popularity" item in the video ⋯ menu opens a public views-over-time chart
(view data is public). Builds on the now-trustworthy view counts (#4).

- buildViewCountTimeSeries buckets raw kind-30079 view events by the counter's
  dedupe window (one view per viewer per day) into a cumulative series.
- buildViewCountChartSvg renders a token-colored (currentColor / text-accent)
  SVG area+line chart — no charting library, no raw colors.
- The modal fetches via listVideoViewEventsWithDefaultClient, shows the total,
  and updates LIVE by subscribing to view events (debounced re-render); cleans
  up on close (Esc / backdrop / ✕). Lazy-loaded from the menu handler so it
  only ships when opened.

New size tokens for the modal; reuses .ds-overlay-backdrop for the scrim.

Tests: tests/view-count-chart.test.mjs (cumulative dedupe, junk filtering,
SVG line/area + empty/single-point).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
thePR0M3TH3ANandClaude Opus 4.8 committed 2026-06-24 13:51:41 -04:00
1 parent 0a37e625bb
commit 575befb83c
7 files changed
+445 -5

No files matched your search

+15
View File
@@ -518,6 +518,21 @@
-webkit-backdrop-filter: blur(var(--overlay-backdrop-blur));
}
.popularity-modal__backdrop {
z-index: var(--z-overlay-popover);
padding: var(--space-md);
}
.popularity-modal {
width: 100%;
max-width: var(--popularity-modal-max-width);
}
.popularity-modal__chart {
width: 100%;
height: var(--popularity-modal-chart-height);
}
.popover-panel[data-variant="zap"],
.popover__panel[data-variant="zap"] {
background: var(--color-overlay-veil);
+2
View File
@@ -80,6 +80,8 @@
--blur-modal-alert: 14px;
--blur-thumbnail-blur: 18px;
--modal-nav-backdrop-blur: 6px;
--popularity-modal-max-width: 28rem;
--popularity-modal-chart-height: 130px;
--app-header-centerline-offset: calc(
var(--space-sm) + (var(--space-2xl-plus) / 2)