Code mode: file tree with responsive collapse#570
Merged
Conversation
Adds a file tree on the left of the Code-mode tab strip at lg+, with all files pre-opened as tabs, tree-click activates existing tab or opens new, close X on tabs, no cross-capability persistence, collapse persisted via localStorage. No new deps; pure presentational FileTree + state moved into CodeMode. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
8 tasks: land prerequisite prose/padding work, buildTree utility (TDD), CodeMode state migration to openPaths+activePath, FileTree component (TDD), lg: responsive split + tree-click integration, tab close (×) + last-tab empty state, collapse toggle with localStorage, full verification. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…wrapper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pure function that converts flat file paths into a compact tree with VS-Code-style single-child folder merging and namespace-prefix peeling. All 6 unit tests green. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ashes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wrap file label in <span data-file-label> for text-overflow to work on flex children; move chip inside the button so clicking it fires onSelect; remove role="tree" from the outer <ul> (no treeitem/group/arrow-key support). Update both spec assertions to query [data-file-label]. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Places the FileTree to the left of the tab strip at lg:+ widths, hidden below. Wires onSelect to openPaths/activePath handlers so tree-clicks activate existing tabs or open and activate new ones. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds × close affordance on each Code-mode tab (visible on hover / active tab). Closing a tab removes it from openPaths, activates the left neighbor (or new leftmost if first was closed), and shows a "Select a file from the tree to begin." empty state when all tabs are closed. TDD: 2 new passing tests; 6 pre-existing tests updated to strip × from textContent comparisons. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Render <Tabs> only when openPaths.length > 0 and activePath !== null; show
empty-state as the exclusive alternative (eliminates Radix controlled→uncontrolled
warning on last-tab-close).
- value={activePath} without ?? undefined inside the guarded branch.
- Add tabIndex={0} and onKeyDown (Enter/Space) to close <span> for a11y.
- Remove unreachable ?? next[0] fallback in handleClose.
- Hoist getTabLabel(path) to a single const per map iteration.
- Add keyboard-close test (9 total in code-mode.spec.tsx).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…for smooth transition Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lg:widths (≥1024px); belowlg:the tree auto-hides and Code mode falls back to today's tabs-only layout.localStorageundercockpit:codeTree:collapsed; hydration-flash is suppressed via amountedgate so returning users don't see an animated collapse on reload.buildTree(paths)is a pure utility with VS Code-style "Compact Folders" — single-child folder chains merge into one row (e.g.angular/src/app)..cockpit-prose--wideand.cockpit-prose--codewidth modifiers, Code-modecockpit-prose--code56rem wrapper, API modepy-6for outer-pane consistency with Docs.Spec & plan
Test plan
🤖 Generated with Claude Code