@micha.bigler/ui-core-micha 2.29.2 → 2.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/DESIGN.md +5 -5
  2. package/WORK_ORDERS.md +6 -0
  3. package/dev/entries.jsx +167 -1
  4. package/dev/main.jsx +10 -3
  5. package/dist/components/charts/BarChart.js +8 -6
  6. package/dist/components/charts/LineChart.js +23 -6
  7. package/dist/components/charts/TimeSeriesChart.js +12 -3
  8. package/dist/components/charts/chartDefaults.js +80 -0
  9. package/dist/components/charts/chartLabels.js +31 -0
  10. package/dist/components/charts/palette.js +7 -3
  11. package/dist/components/charts/yearTickInterval.js +7 -0
  12. package/dist/index.js +4 -0
  13. package/dist/theme/createAppTheme.js +168 -0
  14. package/dist/theme/index.js +4 -0
  15. package/dist/theme/themeCompleteness.js +320 -0
  16. package/dist/theme/tokens.js +325 -0
  17. package/package.json +4 -1
  18. package/src/components/charts/BarChart.jsx +37 -9
  19. package/src/components/charts/LineChart.jsx +61 -9
  20. package/src/components/charts/TimeSeriesChart.jsx +21 -0
  21. package/src/components/charts/chartDefaults.js +111 -0
  22. package/src/components/charts/chartLabels.js +36 -0
  23. package/src/components/charts/palette.js +6 -3
  24. package/src/components/charts/yearTickInterval.js +7 -0
  25. package/src/index.js +16 -0
  26. package/src/theme/createAppTheme.js +212 -0
  27. package/src/theme/index.js +14 -0
  28. package/src/theme/themeCompleteness.js +355 -0
  29. package/src/theme/tokens.js +376 -0
  30. package/tests/BarChart.test.jsx +4 -1
  31. package/tests/LineChart.test.jsx +5 -2
  32. package/tests/chartDefaults.test.js +177 -0
  33. package/tests/chartLabels.test.js +50 -0
  34. package/tests/chartsPalette.test.js +40 -0
  35. package/tests/createAppTheme.test.js +103 -0
  36. package/tests/themeCompleteness.test.js +63 -0
  37. package/tests/timeSeriesLegend.test.js +99 -0
  38. package/work-orders/CHART-6.md +428 -0
  39. package/work-orders/SHELL-2.md +197 -0
  40. package/work-orders/THEME-1.md +587 -0
  41. package/work-orders/assets/SHELL-2-account-navigation.html +1159 -0
  42. package/work-orders/assets/THEME-1-baseline-reference-sheet.html +1352 -0
@@ -0,0 +1,428 @@
1
+ # CHART-6 — Chart-chrome defaults in the three wrappers, plus the two generic fixes hoisted up
2
+
3
+ **Target repo:** `ui-core-micha` (branch `main` — this repo has no `develop`)
4
+ **Tier:** 2 (shared core — `ui-core-micha` is named in AGENTS.md's Tier-2 forcing list)
5
+ **Review:** independent `reviewer` (Sonnet, full) **and** `ui_reviewer` — spawned concurrently, both mandatory before commit
6
+ **Decision record:** `webapp-management/DESIGN_SYSTEM_PROGRAM.md` (DS-4), plus the operator decisions of 2026-08-10 recorded below
7
+ **Version target:** `2.31.0`
8
+ **Hard precondition:** **THEME-1 must have landed and published as `2.30.0` first** — see Preconditions
9
+
10
+ ---
11
+
12
+ ## A. Envelope
13
+
14
+ ### Goal
15
+
16
+ Close the chart-chrome default surface in ucm's three chart wrappers, resolve
17
+ `TimeSeriesChart`'s double legend, and hoist the two generic fixes that live in a consuming app
18
+ today up into the kit.
19
+
20
+ Expected outcome: a chart rendered through the kit looks deliberate without the caller setting
21
+ anything, and the four props that today decide whether it looks deliberate stop being the
22
+ caller's problem.
23
+
24
+ ### Why
25
+
26
+ Both hram and fitness-monitor import the **same** thin wrappers. There is no app-local chart
27
+ module to promote — the quality gap is **three unset props plus one library default**. The
28
+ wrappers are roughly 18 lines of logic each: they enforce axis labels, apply a `hideLegend`
29
+ heuristic, force axis-trigger tooltips, and supply a palette fallback. Tick font, grid, margins
30
+ and marker styling are simply absent, so MUI X-Charts' own visual language shows through
31
+ untouched.
32
+
33
+ ### Measured evidence (2026-08-08/09, verified)
34
+
35
+ - **Hand discipline fails even in the exemplar.** hram sets `tickLabelStyle.fontSize` at only
36
+ **4 of 9** wrapper call sites — absent in `ExpertTimelinePanel`, `ReferralMetricsPanel`,
37
+ `ResultsTimelinePanel`, `TotalMetricsPanel` and `GenericAnalysisPlot`'s top chart. This is the
38
+ argument for defaults at the chokepoint rather than a convention.
39
+ - **The hollow-marker default is a library value, verified in source:**
40
+ `@mui/x-charts/LineChart/MarkElement.js:27` sets `fill: theme.palette.background.paper` — a
41
+ white-filled marker with a coloured stroke. hram avoids it by disabling markers globally;
42
+ fitness-monitor turns them on and inherits it.
43
+ - **`TimeSeriesChart` renders a double legend** whenever ≥2 series are visible: its toolbar toggle
44
+ row names and toggles the series, and MUI draws its own legend underneath.
45
+ - **The label-collapse workaround has two independent consumers** — fitness-monitor's
46
+ `utils/chartLabels.js` (36 lines) and jg-ferien's `ActivitySection.jsx:10-16`, which documents
47
+ the identical upstream issue. The promotion test is met.
48
+ - **`TeachingRunDetailPanel` (hram) bypasses the wrapper entirely** with a direct
49
+ `@mui/x-charts` import — noted, not fixed here.
50
+ - **X-Charts `8.28.2` API limits, both verified in the installed types:** the legend's `position`
51
+ is a 3×3 grid (`vertical: top|middle|bottom` × `horizontal: start|center|end`) and participates
52
+ in layout — it reserves space rather than overlaying the plot. `skipAnimation` is a boolean per
53
+ chart with **no separate enter/update control**.
54
+
55
+ ### Scope
56
+
57
+ #### A. Prop defaults in all three wrappers
58
+
59
+ Applies to `LineChart`, `BarChart` **and `TimeSeriesChart`** — the third was overlooked when this
60
+ strand was first written and is the kit's most mature preset.
61
+
62
+ | Default | Value | Replaces |
63
+ |---|---|---|
64
+ | `tickLabelStyle.fontSize` | the baseline's tick size | MUI's ~12px, unstyled |
65
+ | `showMark` | `false` | MUI's `true` |
66
+ | marker style, when a caller opts markers back in | **filled** | MUI's hollow `background.paper` fill |
67
+ | `grid` | `{ horizontal: true }` | MUI's default of no grid at all |
68
+ | bottom margin | increased automatically when tick labels are rotated | hand-tuned per call site, or forgotten |
69
+ | `legendPosition` | **new prop** over MUI's nine positions; default **bottom-start**, filled marks, aligned to `ChartFrame`'s `p: 2` | MUI's centered-top with dash marks |
70
+
71
+ **Every one of these is a default, not an override.** A prop set by the caller always wins — hram's
72
+ four tuned `tickLabelStyle` call sites must render exactly as they do today.
73
+
74
+ #### B. `TimeSeriesChart`'s double legend
75
+
76
+ Where the toolbar toggle row is present, **MUI's legend is switched off and the toolbar becomes
77
+ the legend** (filled colour dots on the toggles). A row that both names and toggles the series is
78
+ the more capable of the two, and two elements saying the same thing is one too many.
79
+
80
+ The toggles must keep their accessible names — this must not become a row of unlabelled controls
81
+ for keyboard or screen-reader users.
82
+
83
+ #### C. Motion
84
+
85
+ - **Charts animate on entry** (operator, 2026-08-10), at the baseline's `motion.chart` duration.
86
+ - **Charts that poll or re-render on a timer get `skipAnimation`** — named concretely: cockpit's
87
+ status board and hram's `CampaignMonitorPanel`. There the animation replays on every refresh and
88
+ the value never comes to rest.
89
+ - Because `skipAnimation` is all-or-nothing in 8.28.2, those two also lose their entry animation.
90
+ **A library limit, documented as such — not a design choice.**
91
+
92
+ #### D. The two hoists from fitness-monitor
93
+
94
+ - **`chartLabels.js`** — the documented X-Charts label-collapse workaround, 36 lines. Two
95
+ independent consumers already, so this is a promotion and not a bet.
96
+ - **`yearTickInterval`** — hoisted **on its own merits**, not by association: it currently lives
97
+ page-locally in fitness-monitor's `BodyHistoryPage` and is **not** part of `chartLabels.js`. The
98
+ duplicated-year-tick defect it fixes hits any dense time axis, so it belongs to every
99
+ `TimeSeriesChart` consumer. Ships as **its own export**, not mixed into `chartLabels.js`.
100
+
101
+ Both apps keep working unchanged. **Removing their local copies is not part of this WO** — that
102
+ happens in each app's own adoption WO, so this one stays reviewable in a single repo.
103
+
104
+ #### E. Version
105
+
106
+ `2.31.0` — minor: new props and new exports, nothing removed.
107
+
108
+ ### Non-goals / do not touch
109
+
110
+ - **The legend auto-placement heuristic.** The operator's idea — detect whether the top-right or
111
+ bottom-right corner of the plot is empty and place the legend there, otherwise below — is good,
112
+ but X-Charts' built-in legend reserves layout space instead of overlaying, so a true in-plot
113
+ legend needs a custom overlay. **Own strand, once someone has verified that path.** Deliberately
114
+ kept out of a Tier-2 shared-core WO in a repo with no staging net, so this one stays fully
115
+ verifiable.
116
+ - **The theme factory** — THEME-1.
117
+ - **`useNeutralChartPalette`'s ramp transition** — owned by THEME-1 (decision 22). This WO must not
118
+ touch `charts/palette.js`.
119
+ - **The six hand-drawn hram plots** — DS-7/8/9.
120
+ - **`TeachingRunDetailPanel`'s wrapper bypass** — its own small WO in hram.
121
+ - **Removing the hoisted helpers' local copies** in fitness-monitor and jg-ferien.
122
+ - **Per-app adoption** of any of this.
123
+ - **No behaviour, permission or data-contract change.**
124
+
125
+ ### Replaces / removes
126
+
127
+ 1. MUI's **hollow marker** as the effective marker whenever a caller opts markers in.
128
+ 2. MUI's **centered-top legend with dash marks** as the effective default.
129
+ 3. **`TimeSeriesChart`'s second legend** — the MUI one, where the toolbar row exists.
130
+ 4. Nothing is removed from the public API. No export disappears, no prop is dropped.
131
+
132
+ ### Deliberately keeps
133
+
134
+ - **The `hideLegend={series.length <= 1}` heuristic.** A one-series legend is noise, and giving the
135
+ legend a good position does not change that.
136
+ - **The required `xAxisLabel` / `yAxisLabel` contract** — the wrappers throw without them, and that
137
+ is already generic and correct.
138
+ - **The `palette=` convention** and the wrapper's palette fallback.
139
+ - **`ChartFrame`'s `p: 2` padding and its foot row**, byte-for-byte — 16 panels depend on them.
140
+ - **Every caller's explicit props.** A set prop beats a default; hram's four tuned call sites must
141
+ be visually unchanged.
142
+
143
+ ### Risks
144
+
145
+ - **Adding a default is a behaviour change for every call site that did not set the prop**, and the
146
+ effect is deliberately uneven: hram's four tuned `tickLabelStyle` sites stay identical, the other
147
+ five change. That is the intended fix, but it means the rendered check must look at more than one
148
+ chart.
149
+ - **No staging net.** A push to `main` touching `src/**` publishes to npm at once; the independent
150
+ review is the only gate and is not back-fillable.
151
+ - **Ordering against THEME-1 is hard, not preferential.** Both WOs touch `src/index.js` and
152
+ `src/components/charts/`, and decision 23 fixes the release order. Two implementers in this repo
153
+ at once would race the version bump or ship half of this WO inside `2.30.0`.
154
+ - **A chart-preset bump deserves the same treatment as a theme bump.** Decision 11's argument
155
+ applies unchanged: the consumer's next pin bump is a visual verification event, not a dependency
156
+ line.
157
+ - **`skipAnimation` is all-or-nothing**, so the two polling charts lose entry animation too.
158
+
159
+ ### Required tests to WRITE
160
+
161
+ Narrow per AGENTS.md → "Test scope". Written as part of implementation; **run only by the
162
+ Orchestrator**.
163
+
164
+ **`tests/chartDefaults.test.js`** (new, parametrised across `LineChart` / `BarChart` /
165
+ `TimeSeriesChart` where applicable)
166
+
167
+ 1. A minimal call receives the tick font size, `grid: { horizontal: true }` and `showMark: false`.
168
+ 2. A caller-set prop **beats** the default — asserted separately for each of tick font, grid,
169
+ `showMark` and `legendPosition`.
170
+ 3. Rotated tick labels increase the bottom margin; unrotated labels do not.
171
+ 4. When a caller opts markers back in, the marker renders **filled** — not MUI's
172
+ `background.paper` hollow default.
173
+ 5. `legendPosition` defaults to bottom-start, and a caller-set position wins.
174
+
175
+ **`tests/timeSeriesLegend.test.js`** (new)
176
+
177
+ 6. With the toolbar row present and ≥2 series, MUI's legend is **absent** — assert the absence
178
+ explicitly, this is a removal.
179
+ 7. The toolbar toggles keep an accessible name.
180
+ 8. With a single series, `hideLegend` still applies.
181
+
182
+ **`tests/chartLabels.test.js`** (new, ported with the hoist)
183
+
184
+ 9. The label-collapse workaround behaves as it does in fitness-monitor today — port its existing
185
+ cases rather than inventing new ones.
186
+ 10. `yearTickInterval` produces one tick per year across a dense multi-year range. **Prove
187
+ non-vacuity** by removing it and confirming duplicate year labels reappear — this is the
188
+ defect that started the whole investigation.
189
+
190
+ Plus `tsc -p tsconfig.build.json --noEmit` clean.
191
+
192
+ **No full-suite run.** The affected-areas set is the three new files plus the existing
193
+ `tests/chartsPalette.test.js` if the hoist touches it.
194
+
195
+ ### Verification
196
+
197
+ - The **harness page** from THEME-1 gains chart specimens, so the defaults get a rendered
198
+ acceptance rather than only assertions.
199
+ - The Orchestrator runs the **rendered two-width side-by-side** before commit (DS-1's hard gate),
200
+ and names the two screenshots in the register Notiz.
201
+ - Because the effect is uneven, the rendered check must cover **at least one chart that set the
202
+ props and one that did not** — otherwise it proves nothing about the change.
203
+
204
+ ### Preconditions
205
+
206
+ - **THEME-1 landed and published as `2.30.0`.** Not before: both WOs touch `src/index.js` and
207
+ `src/components/charts/`, this repo publishes on push, and decision 23 fixes the order.
208
+ - The baseline supplies `motion.chart` and the tick/grid token values this WO applies.
209
+
210
+ ### Parity guardrail
211
+
212
+ Visual/UX only. **No behaviour, permission or data-contract change.** The hard condition: a caller
213
+ that already sets a prop sees **no change at all** — the defaults fill absence, they do not
214
+ override intent.
215
+
216
+ ### Operator decisions binding this WO
217
+
218
+ - **2026-08-10:** charts animate on entry; polling charts get `skipAnimation` (light movement is
219
+ wanted, and AAA is explicitly not the bar).
220
+ - **2026-08-10:** the toolbar row becomes the legend in `TimeSeriesChart`; MUI's legend goes.
221
+ - **2026-08-10:** `yearTickInterval` is hoisted, with its own justification and as its own export.
222
+ - **2026-08-10:** `legendPosition` ships as a prop with a fixed default; the auto-placement
223
+ heuristic becomes its own strand because the in-plot overlay path is unverified.
224
+ - **Decision 23:** `2.31.0`, after THEME-1's `2.30.0`.
225
+
226
+ ---
227
+
228
+ ## B. Implementation map
229
+
230
+ *Filled by the Orchestrator on `git pull` — see AGENTS.md → "Work Order".*
231
+
232
+ ### Execution directive (read this first)
233
+
234
+ > **If you are the implementer reading this work order as your own specification: this section is
235
+ > NOT addressed to you.** It tells the Orchestrator how to invoke you. **You ARE that invocation —
236
+ > do NOT shell out to `codex exec`.**
237
+ >
238
+ > Implement through `codex exec` in the background — invoked directly via Bash (never the
239
+ > `debugger`/`*_coder` Agent wrappers) with BOTH flags `--skip-git-repo-check` and
240
+ > `--dangerously-bypass-approvals-and-sandbox`. **Pass the WO via stdin, not as a positional
241
+ > argument** — `cat work-orders/CHART-6.md | codex exec --skip-git-repo-check
242
+ > --dangerously-bypass-approvals-and-sandbox -` — a positional arg hit Windows' command-line length
243
+ > limit on THEME-1 ("Argument list too long" from the npm shim); stdin is the proven working
244
+ > invocation for a WO this size on this platform. (Fallback to direct Claude implementation only on
245
+ > Codex quota/rate-limit/non-zero exit.)
246
+
247
+ ### Context package
248
+
249
+ **Precondition verified 2026-08-10:** THEME-1 landed (`b329b39`, `96992cf`, `35f70b2`) and is live on
250
+ npm as `2.30.0` (`npm view @micha.bigler/ui-core-micha version` initially showed the registry cache
251
+ still at `2.29.2` right after push — the `Publish ui-core-micha to npm` GitHub Action had completed
252
+ successfully in ~1m42s; this repo's `package.json` already reads `2.30.0`, which is the authoritative
253
+ signal, not the possibly-cached registry response).
254
+
255
+ **Named files to change:**
256
+
257
+ - `src/components/charts/BarChart.jsx`, `src/components/charts/LineChart.jsx` — near-identical
258
+ wrappers (currently 45 lines each, both shown in full above under "Named files"). Add: (1) default
259
+ `tickLabelStyle` (merged into each axis entry, not replacing a caller's own `xAxis`/`yAxis` array
260
+ entries — same "caller wins" pattern `labelledAxis` already uses for `label`); (2) default
261
+ `showMark: false` on the wrapper's own `chartProps`-level default (only meaningful for `LineChart`
262
+ — `BarChart` has no marks; skip it there or make it a shared no-op, your call, but do not add a
263
+ prop MUI's `BarChart` doesn't accept); (3) default `grid={{ horizontal: true }}`; (4) an explicit
264
+ `hideLegend` prop that DEFAULTS to today's `series.length <= 1` heuristic but is OVERRIDABLE by the
265
+ caller — **this is a real gap, not cosmetic**: today `hideLegend={series.length <= 1}` is hardcoded
266
+ after the `{...chartProps}` spread, so a caller-passed `hideLegend` in `chartProps` is silently
267
+ discarded (JSX prop order: later wins, and the hardcoded one comes last). `TimeSeriesChart` (below)
268
+ needs to force `hideLegend={true}` when it draws its own toolbar-as-legend, so this plumbing gap
269
+ must close first; (5) a new `legendPosition` prop, default `{ vertical: 'bottom', horizontal:
270
+ 'start' }` (MUI's `Position` type — verified in
271
+ `node_modules/@mui/x-charts/models/position.d.ts`: `{ vertical?: 'top'|'middle'|'bottom',
272
+ horizontal?: 'start'|'center'|'end' }`), passed as `slotProps={{ legend: { position:
273
+ legendPosition } }}` merged with the existing `tooltip: { trigger: 'axis' }` slotProp (don't
274
+ clobber one with the other); (6) automatic bottom-margin increase when tick labels are rotated —
275
+ MUI X-Charts reads rotation from `xAxis[i].tickLabelStyle.angle` (or similar; verify the exact
276
+ field in the installed types before relying on it) — when a caller's `xAxis` sets a non-zero
277
+ angle, add `margin.bottom` (a `ChartContainer`-level prop, check exact prop name/shape in
278
+ `node_modules/.pnpm/@mui+x-charts@8.29.2_.../node_modules/@mui/x-charts/ChartContainer` types)
279
+ large enough for the rotated label height — don't hardcode a single magic number without deriving
280
+ it from the tick font size/angle, and don't touch margin at all when no rotation is set (default
281
+ MUI margin must survive unchanged, per the parity guardrail).
282
+ **On-chart marker fill (LineChart only):** verified in
283
+ `node_modules/@mui/x-charts/LineChart/MarkElement.js:26-31` — the hollow marker is `styled('path',
284
+ {name:'MuiMarkElement', slot:'Root'})(({theme}) => ({fill: theme.palette.background.paper, ...}))`,
285
+ a genuine MUI-theme-connected styled component (same mechanism as `MuiButton`/`MuiTableCell` etc.
286
+ already overridden in THEME-1's `BASELINE_STATIC.components`). The cleanest fix, consistent with
287
+ every other component default in this kit, is a `MuiMarkElement: { styleOverrides: { root: {
288
+ fill: 'currentColor' } } }` entry (paired with `stroke: color` already set per-instance by
289
+ MarkElement itself, `color` inherited via the mark's own `color` CSS from its parent — verify
290
+ `currentColor` actually resolves to the series colour in the rendered DOM, since `MarkElementPath`
291
+ doesn't explicitly set a `color` CSS property alongside `stroke`; if `currentColor` doesn't
292
+ resolve, use `fill: 'inherit'` or accept a small amount of extra plumbing) added to
293
+ **`src/theme/tokens.js`'s `BASELINE_STATIC.components`** (a THEME-1 file, but this is a
294
+ theme-component-override, not a `charts/palette.js` change — the WO's non-goal only excludes
295
+ `charts/palette.js`, not `src/theme/`). If that turns out infeasible, fall back to a per-wrapper
296
+ `slotProps`/`sx` override targeting `.MuiMarkElement-root` and say so explicitly in the PR — do not
297
+ silently ship the hollow default.
298
+ **Legend swatch shape:** verified in `LineChart/seriesConfig/seriesProcessor.js:97` — LineChart
299
+ series default to `labelMarkType: 'line'` (a short dash, matching the WO's "dash marks" default to
300
+ replace); `BarChart/seriesConfig/bar/seriesProcessor.js:94` already defaults to `labelMarkType:
301
+ 'square'` (already filled — nothing to change there). Fix: in `LineChart.jsx`'s series mapping,
302
+ default each series entry's `labelMarkType` to `'square'` unless the caller's series object already
303
+ sets one (`{ labelMarkType: 'square', ...series }` — caller key after the default wins the object
304
+ spread, matching the "default, not override" invariant).
305
+ - `src/components/charts/TimeSeriesChart.jsx` — (1) pass `hideLegend` explicitly to its internal
306
+ `BarChart` call (currently absent, so `BarChart`'s own heuristic applies): `hideLegend` should be
307
+ `true` whenever the toolbar's series-toggle row renders (`seriesConfig.length > 0`, same condition
308
+ already used at line 214 to render `FormGroup`) — that removes MUI's own legend while the toolbar
309
+ toggles take over as the visible legend, satisfying Scope B. The toggles already carry an
310
+ accessible name via each `FormControlLabel`'s `label` prop (line 217-231) — verify this still holds
311
+ after your change (test 7), no new work expected there. (2) Pass `motion.chart`-based
312
+ animation/`skipAnimation` through unchanged — `TimeSeriesChart` doesn't currently accept or need a
313
+ `skipAnimation` prop itself; a caller wanting a polling chart to skip animation calls the wrapper
314
+ with `skipAnimation` in `chartProps`, which already passes through `BarChart`'s `{...chartProps}`
315
+ spread untouched — **verify this passthrough still works after your `hideLegend`/`legendPosition`
316
+ changes** (i.e. don't accidentally consume/strip `skipAnimation` while destructuring), there is
317
+ likely nothing to build here beyond that verification.
318
+ - `src/theme/tokens.js` — add the `MuiMarkElement` override described above (if that's the mechanism
319
+ you land on), and a `chart` typography-adjacent tick-size reference if one doesn't already exist
320
+ cleanly reachable (`BASELINE_STATIC.typography.caption` is `12px/400/1.4` — the natural fit for
321
+ `tickLabelStyle.fontSize`; reference it directly via `theme.typography.caption.fontSize` inside the
322
+ wrappers rather than inventing a new token, unless a dedicated token reads better — your call, but
323
+ don't hardcode a bare `'12px'` string in the wrapper divorced from the theme).
324
+ - **New: `src/components/charts/chartLabels.js`** — port `formatShortTime`/`formatShortDate`/
325
+ `formatShortMonth`/`formatShortYear` from
326
+ `fitness-monitor/frontend/src/utils/chartLabels.js` (read that file directly — 37 lines, shown in
327
+ full above under "Named files"; also check `fitness-monitor/frontend/src/utils/chartLabels.test.js`
328
+ for the existing test cases to port per test 9, "port its existing cases rather than inventing new
329
+ ones"). This is a straight port, not a rewrite — keep the exact locale-fallback behaviour and the
330
+ `hour12: false` comment/rationale intact (it documents a real upstream MUI bug, mui-x#18768).
331
+ - **New: `src/components/charts/yearTickInterval.js`** (own export per the WO, not merged into
332
+ `chartLabels.js`) — generalise
333
+ `fitness-monitor/frontend/src/pages/BodyHistoryPage.jsx:39-43`'s `yearTickInterval(range, dates)`.
334
+ That version is app-specific (gated on a literal `range !== "All"` string fitness-monitor owns) —
335
+ the ucm export should NOT take a `range` string at all (this repo's own `TimeSeriesChart` uses
336
+ different range keys, `'1y'` not `'All'`, and other callers may have yet another vocabulary). Ship
337
+ it as `yearTickInterval(dates)`: always computes one Date per calendar year present in `dates` (the
338
+ same `[...new Set(dates.map(d => d.getFullYear()))].sort().map(y => new Date(y, 0, 1))` logic,
339
+ minus the range gate) — the CALLER decides when a dense-enough multi-year range warrants using it
340
+ (as `xAxis[0].tickInterval`), matching the original's actual computation, not its app-specific gate.
341
+ - `src/theme/index.js`, `src/index.js` — export `chartLabels`' functions and `yearTickInterval` (new
342
+ entries near the existing `## 6. Charts` section in `src/index.js`, alongside `ChartFrame`/
343
+ `BarChart`/`LineChart`/`TimeSeriesChart`/palette exports).
344
+ - `package.json` — version `2.30.0` → `2.31.0` (minor).
345
+ - **New: `tests/chartDefaults.test.js`, `tests/timeSeriesLegend.test.js`, `tests/chartLabels.test.js`**
346
+ — per Required tests below. Follow the existing mock convention in `tests/BarChart.test.jsx`
347
+ (shown in full above): `vi.mock('@mui/x-charts/BarChart', () => ({ BarChart: chartSpy }))` with a
348
+ hoisted spy capturing props, assert on `chartSpy.mock.calls[...][0]` rather than deep-rendering the
349
+ real chart. Mirror the same pattern for `@mui/x-charts/LineChart` where `LineChart.jsx` is under
350
+ test.
351
+ - `dev/entries.jsx` — the WO's Verification section requires the harness to gain "chart specimens"
352
+ and the rendered check must cover **at least one chart that set the props and one that did not**.
353
+ Add a small addition to the existing THEME-1 `ThemeBaselineEntry` (or a sibling entry) showing two
354
+ `BarChart`/`LineChart` instances side by side: one with zero extra props (shows the new defaults —
355
+ grid, filled marks, bottom-start legend) and one with an explicit caller override on at least
356
+ `tickLabelStyle`/`legendPosition` (proves the override still wins, visually).
357
+
358
+ ### Do-not-touch / invariants
359
+
360
+ - **`src/components/charts/palette.js`** — untouched, THEME-1 owns the ramp transition.
361
+ - **`ChartFrame`'s `p: 2` padding and its foot row** — untouched, 16 panels depend on them.
362
+ - **hram's four tuned `tickLabelStyle` call sites** (not in this repo — nothing to verify directly
363
+ here beyond making sure an explicit caller `tickLabelStyle` always wins the merge, which the new
364
+ tests must prove per required test 2).
365
+ - **No behaviour, permission, or data-contract change.**
366
+ - **Removing fitness-monitor's/jg-ferien's local copies** of the hoisted helpers — explicitly not
367
+ this WO; both keep working unchanged, on their own exact-pin versions.
368
+ - **The legend auto-placement heuristic** — out of scope, `legendPosition` ships as a plain prop with
369
+ a fixed default, not an auto-detecting overlay.
370
+
371
+ ### Pitfalls (verified against landed code and installed `node_modules` 2026-08-10)
372
+
373
+ - **The WO's Scope A table says X-Charts `8.28.2`; the actually installed version in this repo is
374
+ `8.29.2`** (`node_modules/.pnpm/@mui+x-charts@8.29.2...`). Verify every API claim above against the
375
+ INSTALLED source (`node_modules/.pnpm/@mui+x-charts@8.29.2.../node_modules/@mui/x-charts/`), not
376
+ against the WO's prose or MUI's public docs for a different version.
377
+ - `hideLegend`'s current hardcoded placement in both `BarChart.jsx` and `LineChart.jsx` (after the
378
+ `{...chartProps}` spread) is the same class of bug CHART-1's R2/R3-style findings have caught
379
+ before in this kit — don't just add a new prop next to it without checking whether other
380
+ post-spread hardcoded props (`colors`, `slotProps`) have the same caller-cannot-override issue; the
381
+ WO only asks you to fix `hideLegend` and add `legendPosition`, but note anything else you find
382
+ rather than silently leaving it.
383
+ - `MarkElementPath`'s `fill` comes from `theme.palette.background.paper` via `styled()` — this only
384
+ resolves correctly if the chart is actually rendered under a `ThemeProvider` carrying
385
+ `createAppTheme`'s output (or any MUI theme with the override). A consumer NOT using
386
+ `createAppTheme` yet (all 14 today) still gets MUI's own theme with no `MuiMarkElement` override —
387
+ confirm this is an acceptable, expected "you get it once you adopt THEME-1 + this bump" outcome
388
+ (it is, per the WO's own "next pin bump is a visual verification event" framing), not a regression
389
+ to chase further.
390
+ - `src/index.js` already has a duplicate `// --- 9. ... ---` header comment (pre-existing, noted in
391
+ THEME-1's WO too) — don't compound it.
392
+
393
+ ### Target repo working directory (absolute)
394
+
395
+ `C:\Users\biglmi\Documents\webapps\ui-core-micha`
396
+
397
+ ### Required tests to WRITE (Codex writes them; the Orchestrator runs them)
398
+
399
+ Exactly the 10 tests plus `tsc` check enumerated in Envelope § "Required tests to WRITE" above —
400
+ `tests/chartDefaults.test.js` (5 tests, parametrised across `LineChart`/`BarChart`/`TimeSeriesChart`
401
+ where applicable), `tests/timeSeriesLegend.test.js` (3 tests), `tests/chartLabels.test.js` (2 tests,
402
+ test 9 ported from fitness-monitor's existing cases, test 10 proven non-vacuous by temporarily
403
+ removing `yearTickInterval`'s effect and confirming duplicate year labels reappear, then restoring
404
+ it), plus `tsc -p tsconfig.build.json --noEmit` clean. Do not add more, do not run the full suite —
405
+ the affected-areas set additionally includes `tests/chartsPalette.test.js` ONLY if the hoist
406
+ incidentally touches it (it shouldn't, since `charts/palette.js` is explicitly untouched).
407
+
408
+ ### Preamble (append verbatim)
409
+
410
+ > The text above is the COMPLETE spec — the committed WO file's content, not a plan to refine; there
411
+ > is no separate plan file. Read the nearest `AGENTS.md`, the relevant `.codex/skills/<role>/SKILL.md`, and the
412
+ > app `MEMORY.md` ONLY for conventions. Stay in scope; do not touch auth/permissions/deps/schema/CI
413
+ > unless the spec says so; do not update `MEMORY.md`. Do NOT `git add`/`commit`/`push` — leave every
414
+ > change uncommitted in the working tree for the orchestrator's independent review. WRITE the tests
415
+ > the `Required tests` section calls for AND **RUN the tests you just wrote** to confirm they execute
416
+ > and pass — that is the ONLY test run you do (NOT the app's affected/full suite, NOT any review).
417
+ > The orchestrator re-runs the authoritative set + does the independent review after you finish —
418
+ > those are the gate; your own run does not count as the gate.
419
+ >
420
+ > Narrate continuously: a `PLAN: <step1> | <step2> | …` line up front, then a single-line
421
+ > `PROGRESS: [<n>/<total>] <present-tense action>` before every relevant action (and `… done` on
422
+ > completion), spaced so no gap exceeds ~2 min, stdout unbuffered, plus exactly one final
423
+ > `RESULT: DONE|BLOCKED <reason>`.
424
+
425
+ ### Mini-handover
426
+
427
+ Repo: `ui-core-micha` (`C:\Users\biglmi\Documents\webapps\ui-core-micha`), branch `main`. WO:
428
+ `work-orders/CHART-6.md`. Follow `orchestrate-codex`.
@@ -0,0 +1,197 @@
1
+ # SHELL-2 — AccountPage: from a horizontal tab strip to a grouped sidebar + mobile drawer
2
+
3
+ **Target repo:** `ui-core-micha` (branch `main` — this repo has no `develop`)
4
+ **Tier:** 2 (shared core)
5
+ **Review:** independent `reviewer` (Sonnet, full) **and** `ui_reviewer` — spawned concurrently, both mandatory before commit
6
+ **Prototype (visual spec):** [`work-orders/assets/SHELL-2-account-navigation.html`](assets/SHELL-2-account-navigation.html)
7
+
8
+ ---
9
+
10
+ ## A. Envelope
11
+
12
+ ### Goal
13
+
14
+ Make `AccountPage` usable on a 375 px viewport, and give the account surface the same
15
+ navigation pattern the estate already uses in jg-ferien's `EventInfoPage`.
16
+
17
+ Expected outcome: the horizontal tab strip is gone. On desktop the sections live in a
18
+ sticky, grouped sidebar; on mobile they live in a bottom drawer opened by an in-page
19
+ trigger bar. The users section renders cards instead of a table below `md`.
20
+
21
+ ### Measured evidence (2026-08-08, live at 375 px)
22
+
23
+ Measured in a running cockpit (which mounts ucm's `AccountPage` at `/account`), with the
24
+ host header neutralised so the numbers describe ucm alone:
25
+
26
+ - All six sections render without document overflow — `AccountPage` itself does **not**
27
+ break the layout at 375 px.
28
+ - The tab strip: scroller `clientWidth` 343 vs `scrollWidth` 589, `overflow-x: auto`,
29
+ 246 px of scroll travel, and **`scrollButtons: 0`**. At rest, Profil / Sicherheit /
30
+ Benutzer / Einladen are reachable; Support and the consumer-injected section are off
31
+ screen with no arrow, no fade, no hint that they exist. This is a discoverability
32
+ failure, not a reachability failure — the tabs do respond to a horizontal swipe.
33
+ - The users table: 1045 px of content inside a 341 px `MuiTableContainer` with
34
+ `overflow-x: auto`. One third is visible. The `Aktionen` column sits roughly 700 px to
35
+ the right. Column `minWidth` values: E-Mail 220, Name 180, Neu 90, Letzte Anmeldung 120,
36
+ Rolle 180, Aktionen 220.
37
+ - Interactive controls on the auth pages measure 34–36 px tall, below the 44 px touch
38
+ target guideline. In scope only where this WO touches the control anyway.
39
+
40
+ ### Scope
41
+
42
+ **A. Section navigation — both halves of the jg-ferien pattern**
43
+ (reference: `jg-ferien/frontend/src/components/EventInfoHub/SectionSwitcher.jsx`,
44
+ driven from `jg-ferien/frontend/src/pages/EventInfoPage.jsx:1126-1159`)
45
+
46
+ - **`md` and up:** a CSS grid `280px minmax(0, 1fr)`. Left, a sticky vertical section list
47
+ grouped under headings — per group an outlined `Paper` with a heading row and a `List` of
48
+ `ListItemButton`, the active entry in the `selected` state. Right, the section content
49
+ with `minWidth: 0`.
50
+ - **Below `md`:** the content spans the full width. The grouped list moves into a bottom
51
+ `Drawer`: top corners rounded 18 px, `maxHeight: 78dvh`, bottom padding
52
+ `max(16px, env(safe-area-inset-bottom))`, a title row, list scrolls inside.
53
+ - **The trigger** — the part the reference does not supply. In jg-ferien the button that
54
+ opens the drawer lives in that app's own page header; `AccountPage` has no header of its
55
+ own (the consuming app provides it), so the trigger must live inside `AccountPage`. Per
56
+ the prototype: a full-width 56 px bar at the top of the content, showing a small "Bereich"
57
+ caption above the current section name, with a trailing chevron.
58
+
59
+ **B. Grouping, and the `extraTabs` extension**
60
+
61
+ - Fixed groups owned by ucm, in this order: `Mein Konto` (profile, security) ·
62
+ `Verwaltung` (users, invite) · `Hilfe` (support) · `Weitere` (catch-all, last).
63
+ - `extraTabs` entries gain an **optional** `group` field. An entry without `group` falls
64
+ into `Weitere`. Every existing call site keeps working unchanged — this is additive only.
65
+
66
+ **C. Users section: table to cards below `md`**
67
+
68
+ - At `md` and up the table stays exactly as it is, columns and `minWidth` values unchanged.
69
+ - Below `md`, one card per user carrying the same fields as a row — email, name, the "Neu"
70
+ flag, last login, role, actions — with the actions reachable without horizontal scrolling
71
+ and with touch targets of at least 44 px.
72
+
73
+ **D. Version**
74
+
75
+ - Bump to `2.30.0`. Minor rather than patch because `extraTabs` gains a new public field;
76
+ additive API is a minor under semver.
77
+
78
+ ### Non-goals / do not touch
79
+
80
+ - Pagination or filtering for the user list. Absent today, absent in the prototype,
81
+ explicitly not part of this WO — do not add it "while in there".
82
+ - The internal content of the Profil, Sicherheit, Einladen, Support and consumer-injected
83
+ sections. Only their placement in the navigation changes.
84
+ - The access-code, QR-signup and invite management components.
85
+ - The six auth pages (Login, SignUp, SignupConfirm, PasswordChange, PasswordResetRequest,
86
+ PasswordInvite). Measured clean at 375 px; out of scope.
87
+ - Messaging, notifications, charts, onboarding.
88
+ - The consuming apps. No host repo is touched by this WO — in particular **cockpit's header
89
+ is a separate work order**; its toolbar is what inflates the document to 498 px on every
90
+ route, including `/account`, and fixing it here would be out of scope.
91
+ - No behaviour change, no permission change, no data-contract change (parity guardrail).
92
+
93
+ ### Replaces / removes — within the prototype's declared coverage
94
+
95
+ The prototype is the visual spec; **this list, not prototype silence, is the removal
96
+ authority.** Everything named here must be gone when the WO is done:
97
+
98
+ 1. **The horizontal MUI `Tabs` strip — on desktop as well as mobile.** It is replaced by
99
+ the sidebar (desktop) and the drawer (mobile). Keeping it at any breakpoint means the
100
+ WO is not done. The operator was asked about this specifically and chose both halves.
101
+ 2. **On mobile, the section-title heading below the trigger bar.** The trigger bar is the
102
+ sole carrier of the current section name there. Do not re-add it as a "missing" heading.
103
+ Desktop keeps its section heading, because desktop has no trigger bar to carry the name.
104
+ 3. The scrollable-tabs affordance question disappears with the strip — do not "fix" it by
105
+ adding scroll buttons or a fade to something that no longer exists.
106
+
107
+ A redesign is a subtraction task. If the finished screen carries more UI than it does
108
+ today, that is a stop signal, not thoroughness.
109
+
110
+ ### Deliberately keeps — undrawn in places, but must survive
111
+
112
+ - **The `?tab=<value>` URL contract** (`src/pages/AccountPage.jsx:60`), including the
113
+ fallback to `profile` when the value is unknown *or* not permitted for the user
114
+ (`:180-186`). Cockpit's `/user-management`, `/profile` and `/change-password` redirects
115
+ depend on it. This is the single most breakable thing in the WO.
116
+ - The `?from=recovery` and `?from=weak_login` entry states (`:64-65`).
117
+ - The full `extraTabs` contract (`:146-155`): `value`, `label` as a string **or a function**
118
+ receiving `{ user, perms, isSuperUser, t }`, `visible(context)`, `render`. Extended by
119
+ `group` only; nothing removed, nothing made required.
120
+ - The permission-conditional section list: `users` on `canViewUsers`, `invite` on
121
+ `canViewInvite`, `support` on `isSuperUser || perms.can_view_support`, profile and
122
+ security always (`:127-144`). The section list is per-user and can be as short as two
123
+ entries.
124
+ - `WidePage` as the page container, and its title.
125
+ - The desktop section heading above the content.
126
+ - The users table's column set and `minWidth` values at `md` and up.
127
+ - No standalone "Übersicht" entry above the groups. jg-ferien has one; `AccountPage` has no
128
+ overview screen for it to point at, so none is invented. Navigation starts at the first
129
+ group. Settled with the operator.
130
+
131
+ ### Risks
132
+
133
+ - **No staging net.** This repo has no `develop`. A push to `main` that touches `src/**` or
134
+ `package.json` publishes to npm immediately via `.github/workflows/publish.yml`. The
135
+ independent review is the only gate before publication — it is not back-fillable.
136
+ - **Fourteen consumers inherit the desktop change** on their next pin bump. Nobody is
137
+ forced: every consumer pins an exact version (eight sit on 2.4.5). Only cockpit is
138
+ expected to bump soon, and that bump belongs to cockpit's own WO.
139
+ - **`AccountPage` has zero tests today.** None of the 20 files under `tests/` touches it or
140
+ `UserListComponent`. The `?tab=` contract is currently unguarded, so a regression there
141
+ would surface first as three broken redirects in cockpit, silently.
142
+ - **Drawer stacking.** jg-ferien had to raise its own `SectionSwitcher` drawer to
143
+ `theme.zIndex.drawer + 3` to clear its bottom navigation bar. ucm has no bottom nav, but a
144
+ consuming app may — the drawer must not assume it is topmost, and must not hard-code a
145
+ value that fights a host's own layering.
146
+ - **Safe-area insets are inert without `viewport-fit=cover`.** jg-ferien uses
147
+ `env(safe-area-inset-bottom)` while its `index.html` omits `viewport-fit=cover`, so those
148
+ insets resolve to zero there. Copy the padding by all means, but do not assume it is
149
+ doing anything, and do not change any consuming app's viewport meta tag from here.
150
+
151
+ ### Tests to write
152
+
153
+ Narrow and new — both files are new; there is nothing to extend. Written as part of the
154
+ implementation, run by the Orchestrator.
155
+
156
+ **`tests/AccountPage.test.jsx`**
157
+
158
+ 1. The grouped list renders: the four groups in fixed order, each built-in section under
159
+ its declared group.
160
+ 2. `?tab=users` activates the users section.
161
+ 3. `?tab=<unknown>` falls back to `profile`.
162
+ 4. `?tab=users` for a user **without** `canViewUsers` falls back to `profile` — the
163
+ permission fallback, not just the unknown-value one.
164
+ 5. A short permission set (profile + security only) renders a two-entry list without an
165
+ empty `Verwaltung` or `Hilfe` group heading.
166
+ 6. `extraTabs` without `group` lands in `Weitere`; with `group: 'Mein Konto'` lands there.
167
+ 7. `extraTabs` with a **function** `label` and with `visible()` returning false are both
168
+ still honoured (guards the contract this WO extends).
169
+ 8. Below `md`: the trigger bar renders and names the current section; the duplicate section
170
+ heading is **absent** (assert its absence explicitly — this is a removal).
171
+ 9. At `md` and up: the sidebar renders and no trigger bar is present.
172
+
173
+ Mock the breakpoint per this estate's established pattern —
174
+ `vi.mock('@mui/material/useMediaQuery')` with a per-test return value, as
175
+ `jg-ferien/frontend/src/components/Header.test.jsx` does.
176
+
177
+ **`tests/UserListComponent.test.jsx`**
178
+
179
+ 10. At `md` and up: a table with the six columns.
180
+ 11. Below `md`: one card per user, each carrying email, name, the "Neu" flag, last login,
181
+ role and the actions; assert there is no horizontally scrolling container.
182
+
183
+ Prove non-vacuity for at least tests 4 and 8 by temporarily removing the corresponding
184
+ behaviour and confirming the test fails.
185
+
186
+ ### Parity guardrail
187
+
188
+ The prototype is the visual and UX spec. Visual/UX only: **no behaviour, no permission, no
189
+ data-contract change.** `ui_reviewer` checks it in both directions — everything in the
190
+ prototype present, and nothing outside it surviving. Because this is a visual redesign,
191
+ before the WO is marked done the Orchestrator asks the operator to run a side-by-side of
192
+ the built screen against the prototype; surviving legacy has repeatedly slipped past a
193
+ static diff review in this estate.
194
+
195
+ ### Preconditions
196
+
197
+ None. This WO is independent of cockpit's navigation WO and can land first.