Commit 60dbb72
authored
Unify date controls behind a single range picker (#749)
The date controls had drifted into four different shapes across views — Analytics/Usage's preset + input selector, Activity's segmented control plus a separate prev/next navigator, Trends' inline labelled from/to plus a granularity group, and Insights' mode-coupled inputs. Same job, four costumes: three input heights, three preset vocabularies, two active-state styles.
This replaces all of them with one shared `RangePicker`: a popover trigger plus a segmented panel (Relative / Calendar / Custom). Every view renders the identical control. Behavior that isn't date *selection* (Activity's period stepping) lives inside the panel, so the toolbars look the same everywhere.
A small selection model (`rangeSelection.ts`) resolves any selection to the `from/to` or `preset/anchor` each store already consumes, so existing behavior is preserved rather than reimplemented:
- Analytics and Usage keep rolling-vs-pinned windows, the "All" (earliest-session) preset, and URL persistence.
- Activity keeps day/week/month period stepping (now inside the panel) and the future-step guard.
- Trends keeps its granularity and normalize controls, relocated out of the date toolbar into the chart panel's header as a minimal "Group by" dropdown — they sat next to the picker and collided with its Calendar tab's day/week/month.
- Insights keeps single-day selection (Calendar · Day, the common default) and its insight-type select; the bespoke mode-coupled date inputs are gone.
Out of scope by design: Analytics' chart granularity and Activity's bucket stay as their own controls. Folding every resolution toggle into one shared control is a possible follow-up.
Where to look: `frontend/src/lib/components/shared/RangePicker.svelte` (the control) and `rangeSelection.ts` (the selection model + date math). Each page's adapter is the small `rangeSelection` / `applyRange` block added to its `*Page.svelte`. `DateRangeSelector`, `RangeControl`, and `RangeNavigator` are deleted.
Co-authored-by: Phillip Cloud <cpcloud@users.noreply.github.com>1 parent f734c69 commit 60dbb72
16 files changed
Lines changed: 1404 additions & 686 deletions
File tree
- frontend/src/lib/components
- activity
- analytics
- insights
- trends
- usage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
51 | 81 | | |
52 | 82 | | |
53 | 83 | | |
| |||
95 | 125 | | |
96 | 126 | | |
97 | 127 | | |
98 | | - | |
99 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
100 | 135 | | |
101 | 136 | | |
102 | 137 | | |
| |||
This file was deleted.
Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 0 additions & 147 deletions
This file was deleted.
Lines changed: 0 additions & 59 deletions
This file was deleted.
0 commit comments