From ff040fa1b51e08aea3b39da839d074ef828ea76c Mon Sep 17 00:00:00 2001 From: Jesse_Chen Date: Sat, 18 Jul 2026 21:42:04 +0800 Subject: [PATCH] docs: plan chat header sidebar trigger --- .../2026-07-18-chat-header-sidebar-trigger.md | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 docs/superpowers/plans/2026-07-18-chat-header-sidebar-trigger.md diff --git a/docs/superpowers/plans/2026-07-18-chat-header-sidebar-trigger.md b/docs/superpowers/plans/2026-07-18-chat-header-sidebar-trigger.md new file mode 100644 index 00000000..af10a200 --- /dev/null +++ b/docs/superpowers/plans/2026-07-18-chat-header-sidebar-trigger.md @@ -0,0 +1,260 @@ +# Chat Header Sidebar Trigger Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make the production chat session title left-aligned and render the existing sidebar toggle as a visible, accessible control. + +**Architecture:** Keep sidebar state in the existing provider and make the shared `SidebarTrigger` responsible for its stable `PanelLeft` glyph. Lay out the chat header as a three-column grid so the trigger, flexible title column, and credit control have deterministic positions at every breakpoint. + +**Tech Stack:** Next.js 16, React 19, TypeScript, Lucide React, CSS, Node test runner. + +## Global Constraints + +- Keep exactly one visible sidebar trigger beside the active session title. +- Keep the trigger target at least 44px and preserve localized `aria-label` and `aria-expanded` state. +- Preserve Command/Control+B, desktop/tablet widths, mobile drawer behavior, session data, requests, and account behavior. +- Keep long and CJK titles inside the flexible column with ellipsis and no credit-control displacement. +- Keep sidebar state changes immediate and the glyph stable. +- Do not modify unrelated dependency or lockfile content. + +--- + +### Task 1: Visible Shared Sidebar Trigger + +**Files:** +- Modify: `frontend/tests/sidebar-contract.test.ts` +- Modify: `frontend/src/components/ui/sidebar.tsx` +- Modify: `frontend/src/components/app-sidebar.tsx` + +**Interfaces:** +- Consumes: `SidebarProviderContextValue`, `SidebarTriggerProps`, and the existing `toggleSidebar()` action. +- Produces: `SidebarTrigger`, a 44px button with a stable `PanelLeft` child, localized accessible state, and composed click behavior. + +- [ ] **Step 1: Write failing trigger and composition assertions** + +Add these assertions to `frontend/tests/sidebar-contract.test.ts`: + +```ts +assert.match(sidebar, /PanelLeft/); +assert.doesNotMatch(sidebar, /PanelLeftClose|PanelLeftOpen/); +assert.match(sidebar, /