fix(cmux-next stats): a week or a month draws one row of days across the page

Merged
TE
15d ago
+151-18

Layout pass, running list (lane: layout-pass; full list in cmuxterm-hq knowledge/layout-pass.md)

  • Merged: #22785 Settings, #22825 Markdown toolbar, #22839 Chief latency bars, #22847 Harnesses, #22862 gallery Settings cascade, #22872 code editor find pill, #22880 gallery model picker, #22904 Passwords header, #22917 Agent Activity split
  • Open: #22897 diff toolbar beside the files sidebar
  • This PR: Stats activity for a week or a month, and the gallery's 12-week state
  • Next: icon-picker search placeholder at 440

What

Stats draws activity as a week-column heatmap, 12px cells with one column per week. That works for 12 weeks. A week was two thin columns and a month was five, at the left edge of an 850px section.

  • A week or a month (31 days or fewer) now draws one row of days across the page, on the same 2px rhythm as the Time of day bars below it. Under a week each day is labelled with its weekday. Under a month, today and every seventh day before it show their date. Tooltips are unchanged.
  • 12 weeks keeps the week-column heatmap.
  • The store started out claiming a read was already on its way, so setRange(84) before start() read nothing. The app calls start() and never hit this, but the gallery's 12-week ("quarter") state sat on "Loading…". The store now starts idle.

Test

bun test test/stats-page.test.tsx (jsdom). New cases:

  • a week renders seven days in one row, labelled Tue to Mon with today last, and no heatmap grid;
  • a month renders 30 days, dated only on today and every seventh day before it;
  • 12 weeks keeps the 84-cell heatmap;
  • picking the default range before the first read starts a read.

Results:

  • Base (red commit 7931c3ce): all four fail.
  • Head: 14 pass.

Screenshots

The Stats page's ?mock dev entry, Activity and Time of day sections. Before is the base, after is this branch.

BeforeAfter
Week, 900, dark
Week, 360, light
Month, 640, light
Month, 360, dark

Observed / Not run

  • Observed: the test above, red then green. tsc --noEmit reports no errors in the changed files. Clean: oxlint, vp fmt and every check:* script in webviews. prepush-gate.py: no new violations.
  • vp fmt also reflowed the five one-line heat-level rules in styles.css; their values are unchanged.
  • Not run locally: the full vp check and a gallery build, because heavy jobs are off huge-blue. The stills come from the dev entry, not the gallery.

Changelog

none (Stats is a preview feature until styled)

Agent session: huge-blue

šŸ¤– Generated with Claude Code