feat(desktop): make Pinned and Sessions sidebar sections collapsible like Projects
Summary
The Pinned and Sessions sidebar sections now collapse exactly like the Projects header: click the header strip to toggle, with the chevron cue that stays visible while collapsed (per the GH #6009 convention) so hidden rows read as hidden rather than missing. Collapse state persists per section.
Refactor
- New shared
DashboardSidebarSectionHeaderrenders the top-level section header strip (label, chevron, right-aligned action slot);DashboardSidebarWorkspacesHeader(Projects),DashboardSidebarPinnedSection, andDashboardSidebarSessionsSectionall use it now. sidebar-workspaces-collapsestore generalized tosidebar-sections-collapseholdingcollapsed: { pinned, sessions, workspaces }. The legacy localStorage key is kept with a v0→v1persistmigration, so an already-collapsed projects list carries over; persisted-key registry updated.
Behavior notes
- Collapsed sections hide their rows (and unregister their sortables), matching collapsed project groups — drops don't target a collapsed section.
- The empty-Pinned drop zone still renders mid-drag regardless of collapse, so the first drag-to-pin always has a landing target.
- Sessions rows stay hidden when either its own collapse or the global Projects-list collapse is active; the Sessions "+" now stops propagation so it doesn't toggle the header.
Verification
Typecheck, lint, and persisted-key registry tests pass. Verified end-to-end over CDP against this worktree's dev app with trusted input: hover→chevron, collapse/expand each section, both-collapsed → location.reload() → still collapsed (store: {"collapsed":{"pinned":true,"sessions":true,"workspaces":false},"version":1}), console.error hooked throughout — zero entries. 27s screen recording captured.
Summary by cubic
Makes Pinned and Sessions sidebar sections collapsible with the same UX as Projects. Previously only Projects collapsed; now each section toggles via its header, shows the chevron while collapsed, and remembers its own state.
-
Review notes
- Introduces
DashboardSidebarSectionHeaderand uses it for Projects, Pinned, and Sessions. - Replaces
useSidebarWorkspacesCollapseStorewithuseSidebarSectionsCollapseStoreconsumers. - Collapsing unmounts rows and unregisters sortables; drops cannot target a collapsed section. The empty Pinned drop zone still renders mid-drag so the first pin always has a target. The Sessions “+” stops event propagation to avoid toggling; Sessions rows also hide when Projects is collapsed.
- Introduces
-
Persistence/migration
- Generalizes persisted state to
{ collapsed: { pinned, sessions, workspaces } }under the legacysidebar-workspaces-collapsekey with a v0→v1 migration that mapsisCollapsedtocollapsed.workspaces. - Persisted-key registry updated; no migration action required.
- Generalizes persisted state to
Summary by CodeRabbit
- New Features
- Added collapsible sidebar sections for pinned items, sessions, and workspaces.
- Added consistent section headers with chevrons, optional actions, and keyboard accessibility.
- Sidebar collapse preferences are now saved between sessions.
- Preserved drop zones and section actions when content is collapsed or hidden.