Repository navigation
feat(ui): embeddable read-only DiffFileTree shared with the code-review tree - #1678
Merged
Merged
Conversation
…iew file tree Move the review's pure tree builder, folder-expansion state and row atoms into @plannotator/ui and render the review's tree from them; add the DiffFileTree component (files / selectedPath / onSelect) with ARIA tree semantics and tree-scoped keyboard navigation for hosts.
1 task
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.
Adds
@plannotator/ui/components/DiffFileTree, a read-only file tree a host can put beside its own per-file diff list (asked for by Pando). It is the code-review tree, not a copy: the shared parts moved frompackages/review-editorinto@plannotator/ui, and the review now renders from them. No release and no version bumps.The export
files: { path; oldPath?; status: 'added' | 'modified' | 'deleted' | 'renamed' | 'binary'; additions; deletions }[],selectedPath: string | null,onSelect(path).defaultExpanded('all'default,'none', or folder paths),label(accessible name, default "Changed files"),className.role="tree"/treeitemwitharia-level,aria-expanded,aria-selectedand one tab stop.j, ArrowUp/k, Home and End select files in tree order, the same keys the review uses. ArrowRight/ArrowLeft open and close folders.filesarray with the same content, folder state is kept. It resets only when the content changes.What moved where
packages/review-editor@plannotator/uiutils/buildFileTree.tsutils/diffFileTree.ts(genericbuildDiffFileTree<F>); the review file is now a re-export shim with its old namesFileTree.tsxfolder-expansion statehooks/useDiffFileTreeExpansion.tsFileTreeNode.tsxfolder button, file-row layout, indentcomponents/DiffFileTree.tsx:DiffFileTreeFolderRow,DiffFileTreeFileRowContent,diffFileTreeIndentFileRowBits.tsxChangeTypeLetter,DiffCountscomponents/DiffFileTree.tsx, re-exported fromFileRowBitsThese stay in the review only: viewed and stage controls, the hide-viewed filter, annotation badge and tint, scroll highlight, the context menu, double-click, pickers, search, nav rows, and the window-wide j/k shortcut. The review's rows keep their DOM exactly as before; no ARIA roles were added there.
Verification
bun run typecheck(including the strict-consumer config, which now covers a compile-only consumer of the new export), fullbun test(5927 pass, 0 fail), and the CI DOM list with the newDiffFileTree.test.tsx(1392 pass). The DOM allowlist guard passes.bun run --cwd packages/ui smoke:packagenow also requires and importsDiffFileTreefrom the packed tarball.bun run --cwd apps/review build && bun run build:hook./tmp(tempPLANNOTATOR_DATA_DIR, headless Chromium 1243 with--use-mock-keychain --password-store=basic) and ranplannotator review --patch-fileon the same fixture: merged chains, A/D/R/M files, nested folders. I took the sidebar screenshot three times: at rest, afterj j, and after collapsing a folder. All three screenshots and the sidebarouterHTMLwere byte-identical between main and this branch.Not verified in a browser: the standalone
DiffFileTreeinside a host page. Its behavior is covered by the DOM tests.