Repository navigation
feat(task-panel): add per-task collapsible notes, changed-files, and shell sections - #383
truongthinh1412 wants to merge 12 commits into
Conversation
399dc82 to
36c3f82
Compare
- hide the sticky notes tour footer inside the collapse wrapper so it cannot paint over the header row while collapsed (display:none|contents wrapper around the editor container and the footer, expanded layout unchanged) - drop the duplicate changed-files body id: the collapse wrapper is the aria-controls target, the inner grid wrapper loses it - floor the notes/files zone by summing its panes: every non-both-expanded state now stacks them as a plain full-width column, so one collapsed side never leaves a dead strip and the both-collapsed floor is two header rows (62px); the section roots drop height:100% while collapsed to match - render the horizontal notes-split only when both sides are expanded and revert its children to the plain expanded-floor panels, deleting the width-floor variants (maxAutoSize can no longer leak as max-width) - gate the change-tour FeatureHint on the section being expanded - auto-expand the shell section when shells grow while collapsed and also clear the persisted flag when the last shell closes on its own - share one SectionCollapseToggle across notes/changed-files/shell headers; its pointerdown stops propagation so the section root cannot steal focus
- buildMainGrid omits collapsed cells/rows in both layouts: notes/changed-files rows only while expanded, the shell toolbar row and terminal rows only while the shell section is not collapsed - samePanelKindIn no longer maps onto a target task whose shell section is collapsed; pickTargetTerminalFamilyPanel takes the target id and returns null for it, so cross-task arrows fall through to the grid fallback - setTaskSectionCollapsed drops the task's panel focus when the section being hidden holds it (shell:N and shell-toolbar:N included), mirroring setProjectsCollapsed's hidden-row cleanup - move the shell-toolbar panel prefix helpers into focused-panel.ts so ui.ts reuses them without a cycle through focus.ts
…collapses Split mode now always keeps the left column (AI terminals + prompt) in the navigation grid however the right column collapses: the toolbar row rides with the AI panes even when no shell rows exist, so an arrow press from the AI terminal or the prompt always has a next cell instead of stranding. The stack layout keeps its collapsed notes/files/shell-row filtering but makes the shell toolbar row unconditional — the toolbar stays visible and interactive while the shell section is collapsed. buildMainGrid is exported for an exhaustive parametrized grid-invariant suite over both layouts and the full collapse-combination matrix, plus the regression pair: the AI terminal never strands (title/prompt within two presses in split), and the prompt always walks back onto an AI terminal.
- SectionCollapseToggle restores DOM focus in a microtask after toggling: the panel tree reparents the section body and Chromium drops native focus, which let the panel's setTimeout(0) auto-focus steal the keyboard. The toggle also gains its class and a hover rule matching the toolbar buttons' intent. - Dispatching a bookmark from a collapsed shell toolbar expands the section first: the reuse path writes into an existing shell without spawning, so the growth effect never fired and the command ran out of sight. closeShell no longer retargets panel focus onto surviving shells while the section is collapsed (the flag is read locally in tasks.ts — importing ui would cycle through navigation). - ResizablePanel hides handles whose grip cannot follow the pointer: a noPin child pins the handle's own position, so when the sole absorber sits beyond the handle the drag would only trade space between panes the grip is not between. - Collapsed shell terminals drop their WebGL context (visible=false), and the notes/changed-files header clicks no longer write panel focus while collapsed; collapsed headers get flex-shrink 0 so a stacked column with overflow hidden cannot shrink them below their floor. - Split-right sizing: a collapsed shell section caps notes' default size and cards' auto max like the empty-shell state. - COLLAPSED_SECTION_MIN_HEIGHT moves 31 -> 32: the parallel-code look's border-box heading is 32px and 31 clipped it by a pixel; the shell toggle row gets the toolbar's 5px left inset, and the growth client test re-collapses before shrinking so the count===0 clear is genuinely exercised.
|
🔧 Needs changes – labelled Thanks for the PR! This adds collapse toggles to the notes, changed-files and shell sections of a task panel, saved per task. It's carefully done and well tested. One behaviour needs fixing before merge: collapsing a section throws away the size the user dragged it to. Should fix before merge
Nits
Automated review pass (Claude Code). Anything unclear or wrong – say so and I'll take a look. |
|
Collapsible sections fit #204 – thanks. Two things before merging:
Ping me when that's in. |
- Preserve dragged panel sizes across section collapse: PanelChild gains a collapsed flag — content-sized like noPin for styling and drag, but the stale-pin cleanup never deletes a collapsed child's pin, nor a sibling's while it is only the sole absorber because absorberIds rerouted around the collapse. Expanding restores the user's size in the stack and split layouts (covered by save/collapse/expand tests). - Show a hint in the collapsed Notes header when a plan or tour exists (Plan available / Tour available / Plan & tour available), mirroring the summary the collapsed Changed Files header keeps, so Review Plan and the tours are not lost behind the collapse. - Keep the shell toolbar a keyboard target while the shell section is collapsed (cross-task landing and panel-focus retention), hide handles beside a sentinel absorber, restore toggle focus via the clicked node, route the collapse key through taskSectionCollapseKey in tests and mocks, and merge the duplicate focused-panel import in focus.ts.
|
Thank you so much for the careful review — and for spelling out the size-loss scenario so clearly, that made it easy to reproduce and fix! 🙏 Both items (and the import nit) are addressed in
Verified locally: |
- jumpToWaitingTask reveals a collapsed shell section before focusing the asking shell:N panel: the tray can list a shell question while the terminal is display:none and its grid row is gone, which stranded the keyboard (and left closeShell's guard pointing at a dead panel). - "Open terminal" (toolbar button, Enter, and the global shortcut) expands the section synchronously before spawning, like runBookmark: the growth effect only fires after the new TerminalView mounted, so its PTY would otherwise start inside display:none at 80x24. - ResizablePanel: a collapsed absorber's dormant pin no longer counts toward the asymmetric-pin self-heal, and that heal (like the sole absorber one) waits while any sibling is collapsed, so a pin can never be purged merely because a sibling collapsed. - Shell toolbar inset only applies when the collapse toggle renders. - focus.test.ts: the layout matrix prints "stack layout"/"split layout" instead of "false mode"/"true mode".
… path - addShellToTask clears the shell-section collapse key next to shellAgentIds.push, so every spawn path (Open terminal, Run buttons, cloud sessions, setup shells) reveals the row before the terminal mounts; the setup shell now shares that function instead of pushing into shellAgentIds itself. - Drop the hand-copied expands in App.tsx and TaskShellSection's openShell. The bookmark reuse path keeps its own expand, since it writes into an existing shell and spawns nothing. - Drop the ResizablePanel absorber-role-flip test: it passed on the parent version too, so it does not guard this change; the sibling-pin test is the one that fails without the fix.
Description
Implements item 1 of #204 ("Reduce task panel density: collapsible sections and title-bar badge consolidation"): a collapse toggle in the header of each secondary section of a task panel — notes, changed files, and the shell section — persisted per task. Items 2 (width-derived default collapse), 3 (badge consolidation) and 4 (coordinator-line merge) of the issue remain open and are not addressed by this PR.
What the toggles do
display: none/display: contents) rather than unmounted, so DOM state persists,aria-controlstargets always exist, xterm terminals are never disposed, andChangedFilesListkeeps reporting counts to TaskPanel while collapsed.panelUserSizemap (keystask:${taskId}:collapsed:${section}, collapse stores 1, expand deletes the key — absence means expanded, so existing users see zero change). The key format is owned byfocused-panel.ts(the same seam asisShellToolbarPanel; importingui.tsfromtasks.tswould cycle).ResizablePanelwiring: collapsed cells never hold a flex-absorber role (minSize floors drop,noPinwhile collapsed,defaultSizesuppressed,absorberIdsfiltered or substituted with a safe sentinel). The horizontal notes-split renders only when both sides are expanded; any collapse stacks the sections as a plain full-width column. The zone's vertical floor usesnotesFilesZoneFloor(sum semantics: a collapsed header + the expanded sibling's floor).buildMainGridand the pointerdown focus write, so arrow-key navigation and panel focus never land on a hidden body.Verification highlights
Issues Resolved
Contributes to #204 (implements item 1: collapsible secondary sections; issue stays open for items 2–4)
Check List