ReviewOS

also looking at this

loghqorg/loghq

feat(analytics): presets-and-calendar reporting-period picker

#6
Merged glennmichael123 wants to merge feat/date-range-picker into main
3 files +500 -5
10 days ago

Brings analyticshq's Fathom-style reporting-period picker (stacksjs/analyticshq#55, #56) to loghq's /analytics view. It had preset tabs (7d/30d/90d/180d) but no custom range and no calendar — this adds both while keeping the tabs.

How it fits loghq

  • URL stays the only state. loghq's four native spans go out as ?range=; every other preset and any hand-picked span goes out as ?from=&to=.
  • Minimal server change. analytics.stx parses ?from=&to= as UTC day bounds; because volumeSeries / levelsByRelease already take {fromDay, toDay}, a custom span needs no query rewrite and is still bucketed by day like 180d. The range pills stop reading active while a custom span is active.
  • loghq vocab and theme. Presets are 7/30/90/180 days + Today/Yesterday/This-Last month/This-Last year (no 24h/1y/all — loghq doesn't have those). The CSS is themed on loghq's tokens; the range fill is --accent-soft (its green wash).

Verified

Rendered on an unguarded harness (the real view is auth-gated): component renders server-side into two calendars, loghq's green range fill (rgb(4,120,87)), today marked, future days disabled, and outside-click dismiss works. tests/unit/date-range-picker.test.ts — 9 cases over the grid/day-math, loghq's preset vocab (asserts no 24h/1y/all, has 180d), and the query it builds. pickier clean.

First of three ports (loghq → statushq → bughq); analyticshq is already live.

3 changed files on the files tab, with 0 review threads.

Sign in to comment on this pull request.