Collapsible left sidebar + collapsible nav groups #396

Closed
opened 2026-07-17 01:27:44 +02:00 by timothy · 2 comments
Owner

Summary

The sidebar navigation changed in the Claude Design prototype (templates/chicorytv-admin/Shell.jsx, Sidebar). The flat ~40-item sidebar now (a) collapses to a 60px icon rail via a header toggle, and (b) groups labeled sections (Media, System, Editors) into collapsible accordions, default-collapsed, leaving only the always-open Primary group visible on load.

Design mockups are already synced — this issue captures scope + context for a future implementation session. Do not build ahead of the #388 sync.

Context for whoever picks it up

  • Inventory-driven, don't hardcode. Nav is generated from the route inventory (screens.js → CTV_NAV_GROUPS / CTV_SCREENS), mirroring web/src/app/routes.tsx. label: null = the always-open Primary group. Keep the prod implementation generated from the route inventory the same way.
  • Two persisted states (map to our persisted-UI-state convention — see spa-conventions.md):
    • localStorage["ctv.sidebar.collapsed"] — "1"/"0".
    • localStorage["ctv.sidebar.groups"] — JSON {groupKey: boolean}, default all labeled groups closed.
  • Rail (collapsed) state: icon-only; tooltips from route title; active highlight + badge-rendered-as-dot; hairline dividers between groups. Group-collapse (accordions) applies only in the expanded state.
  • Touches only the shell/nav — no screen logic.
  • Pairs with the pending "reduce settings/screens" IA decision — trimming routes shrinks this nav further for free.

Acceptance

  • Collapse animates without layout jump.
  • Groups toggle via a header chevron.
  • Both states survive reload (the two localStorage keys above).
  • Keyboard-reachable (toggle + group headers).
  • Active route marked in both states (expanded highlight + rail active indicator).

Blocked

Blocked on #388 (design-system sync epic) — all UI/SPA work is currently gated on it. This is a shell/nav mirror of the updated prototype, so it belongs to that sync stream.

Done-when

  • adversarial review passed
  • rail collapse + group accordions implemented, inventory-driven (no hardcoded nav)
  • both persisted states wired per the persisted-UI-state convention
  • keyboard-reachable + active-route marked in both states; animates without layout jump
  • live-E2E of collapse/expand + reload persistence
  • docs updated (spa-conventions.md if the shell/nav pattern changes)
## Summary The sidebar navigation changed in the Claude Design prototype (`templates/chicorytv-admin/Shell.jsx`, `Sidebar`). The flat ~40-item sidebar now (a) **collapses to a 60px icon rail** via a header toggle, and (b) **groups labeled sections (Media, System, Editors) into collapsible accordions**, default-collapsed, leaving only the always-open **Primary** group visible on load. Design mockups are already synced — this issue captures scope + context for a future implementation session. **Do not build ahead of the #388 sync.** ## Context for whoever picks it up - **Inventory-driven, don't hardcode.** Nav is generated from the route inventory (`screens.js` → `CTV_NAV_GROUPS` / `CTV_SCREENS`), mirroring `web/src/app/routes.tsx`. `label: null` = the always-open **Primary** group. Keep the prod implementation generated from the route inventory the same way. - **Two persisted states** (map to our persisted-UI-state convention — see `spa-conventions.md`): - `localStorage["ctv.sidebar.collapsed"]` — `"1"`/`"0"`. - `localStorage["ctv.sidebar.groups"]` — JSON `{groupKey: boolean}`, default **all labeled groups closed**. - **Rail (collapsed) state**: icon-only; tooltips from route `title`; active highlight + badge-rendered-as-dot; hairline dividers between groups. Group-collapse (accordions) applies **only in the expanded state**. - **Touches only the shell/nav** — no screen logic. - **Pairs with the pending "reduce settings/screens" IA decision** — trimming routes shrinks this nav further for free. ## Acceptance - Collapse **animates without layout jump**. - Groups toggle via a header **chevron**. - **Both states survive reload** (the two localStorage keys above). - **Keyboard-reachable** (toggle + group headers). - **Active route marked in both states** (expanded highlight + rail active indicator). ## Blocked Blocked on **#388** (design-system sync epic) — all UI/SPA work is currently gated on it. This is a shell/nav mirror of the updated prototype, so it belongs to that sync stream. ## Done-when - [x] adversarial review passed - [x] rail collapse + group accordions implemented, inventory-driven (no hardcoded nav) - [x] both persisted states wired per the persisted-UI-state convention - [x] keyboard-reachable + active-route marked in both states; animates without layout jump - [x] live-E2E of collapse/expand + reload persistence - [x] docs updated (spa-conventions.md if the shell/nav pattern changes)
timothy added the enhancementpriority: mediumfrontend labels 2026-07-17 01:27:44 +02:00
timothy added the in-progress label 2026-07-18 16:15:43 +02:00
Author
Owner

Claiming (Claude Code orchestrator session, 2026-07-18). Verified eligible: blocker #388 (design-system sync) is CLOSED so this is unblocked; no prior claim; pure shell/nav SPA work.

Selection note: the arc/review/priority: high tiers are empty; both open milestone issues are ineligible (#383 is an umbrella whose children #384/#385/#386 are all closed — likely just needs closing; #395 is blocked by open #381). Falling through to tier-5 unmilestoned priority: medium, lowest issue number → #396.

Claiming (Claude Code orchestrator session, 2026-07-18). Verified eligible: blocker #388 (design-system sync) is CLOSED so this is unblocked; no prior claim; pure shell/nav SPA work. Selection note: the arc/review/`priority: high` tiers are empty; both open milestone issues are ineligible (#383 is an umbrella whose children #384/#385/#386 are all closed — likely just needs closing; #395 is blocked by open #381). Falling through to tier-5 unmilestoned `priority: medium`, lowest issue number → #396.
Author
Owner

Closed via PR #448 (merged to main as 6e976644).

What was done

Collapsible left sidebar for the ChicoryTV SPA:

  • Header toggle → 60px icon rail (labels visually hidden but kept in the a11y tree + native title tooltip; numeric badge → corner dot; hairline dividers between groups; active-route indicator works in both states).
  • Collapsible accordions per labeled nav group (Media, System); the unlabeled Primary group is always open; labeled groups default-collapsed.
  • Inventory-driven from sidebarNavGroups (no hardcoded nav); grid-template-columns transition + prefers-reduced-motion.

Files changed

  • web/src/app/sidebarState.ts (+ .test.ts) — useSidebarState() hook + persistence.
  • web/src/app/AppShell.tsx, web/src/app/routes.tsx (group keys), web/src/components/navigation.tsx (NavItem title prop).
  • web/src/shell.css, web/src/components/components.css.
  • web/src/App.test.tsx — new describe('collapsible sidebar (#396)').
  • Docs: docs/spa-conventions.md §13, docs/decisions.md 2026-07-18.

Persistence (deviation, noted)

Two localStorage keys use the established ctv- hyphen convention rather than the issue's dotted ctv.sidebar.*: ctv-sidebar-collapsed ("1"/"0") and ctv-sidebar-groups (JSON {groupKey: boolean}, boolean = collapsed). Rationale in decisions.md 2026-07-18.

Verification

  • Build (tsc+vite), eslint, 855 vitest — green.
  • Cold adversarial review found 2 issues — (1) active route not marked when its group was default-collapsed on a deep-link/reload; (2) mobile empty-brand-bar — both fixed and re-verified.
  • Live-E2E (Playwright headless): default-collapsed groups, accordion expand persists, 60px rail with no horizontal scrollbar, reload restores rail + shows all 29 items, per-group state survives rail collapse, and /app/settings deep-link marks Settings active + auto-reveals System without persisting.

Deferred / follow-up

  • The committed design-system/templates/chicorytv-admin/Shell.jsx prototype is still the flat pre-change version; the collapse/accordion mockup lives in the Claude Design project. A back-sync of that prototype is out of #396's scope (belongs to the #388 design-mirror stream) and is noted here rather than done in this PR.

CI note

The merge was force-merged (operator-authorized): every real check passed green on 8cef07a6; the red status was a cancelled redundant re-run (an earlier decisions.md append-only job had been killed under runner saturation — its server log was missing — and was cleared by a selective rerun).

**Closed via PR #448** (merged to main as 6e976644). ### What was done Collapsible left sidebar for the ChicoryTV SPA: - **Header toggle → 60px icon rail** (labels visually hidden but kept in the a11y tree + native `title` tooltip; numeric badge → corner dot; hairline dividers between groups; active-route indicator works in both states). - **Collapsible accordions** per labeled nav group (Media, System); the unlabeled **Primary** group is always open; labeled groups **default-collapsed**. - Inventory-driven from `sidebarNavGroups` (no hardcoded nav); `grid-template-columns` transition + `prefers-reduced-motion`. ### Files changed - `web/src/app/sidebarState.ts` (+ `.test.ts`) — `useSidebarState()` hook + persistence. - `web/src/app/AppShell.tsx`, `web/src/app/routes.tsx` (group `key`s), `web/src/components/navigation.tsx` (`NavItem` `title` prop). - `web/src/shell.css`, `web/src/components/components.css`. - `web/src/App.test.tsx` — new `describe('collapsible sidebar (#396)')`. - Docs: `docs/spa-conventions.md` §13, `docs/decisions.md` 2026-07-18. ### Persistence (deviation, noted) Two `localStorage` keys use the established `ctv-` hyphen convention rather than the issue's dotted `ctv.sidebar.*`: **`ctv-sidebar-collapsed`** (`"1"`/`"0"`) and **`ctv-sidebar-groups`** (JSON `{groupKey: boolean}`, boolean = collapsed). Rationale in `decisions.md` 2026-07-18. ### Verification - Build (tsc+vite), eslint, 855 vitest — green. - Cold adversarial review found 2 issues — (1) active route not marked when its group was default-collapsed on a deep-link/reload; (2) mobile empty-brand-bar — **both fixed** and re-verified. - Live-E2E (Playwright headless): default-collapsed groups, accordion expand persists, 60px rail with no horizontal scrollbar, reload restores rail + shows all 29 items, per-group state survives rail collapse, and `/app/settings` deep-link marks Settings active + auto-reveals System without persisting. ### Deferred / follow-up - The committed `design-system/templates/chicorytv-admin/Shell.jsx` prototype is still the flat pre-change version; the collapse/accordion mockup lives in the Claude Design project. A back-sync of that prototype is out of #396's scope (belongs to the #388 design-mirror stream) and is noted here rather than done in this PR. ### CI note The merge was force-merged (operator-authorized): every real check passed green on 8cef07a6; the red status was a cancelled redundant re-run (an earlier `decisions.md append-only` job had been killed under runner saturation — its server log was missing — and was cleared by a selective rerun).
timothy removed the in-progress label 2026-07-18 17:26:38 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: timothy/ersatztv#396