Repository navigation
feat(desktop): right pane file tabs with preview and pinned states - #8964
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
…pane Files tab The Files tab now shows a code area with a tab strip next to the tree. A single click opens a file in the preview tab (italic), which the next single click replaces. Double-clicking the file or its tab, or editing it, pins the tab so it stays open. Open files stay real panes. The panes store can now keep panes in a tab but out of its layout: stackPane shows a new pane in another pane's slot, activating a stacked pane swaps it into view, and closing or moving the visible one hands its slot to its nearest stacked sibling instead of collapsing the split. Close guards, pane reuse and persisted layouts keep working as before.
Files open as tabs in the right pane's tab bar. A single click on a file in the tree opens it in the preview tab (italic title), which the next single click replaces. A file pins when you double-click it in the tree, double-click its tab, click inside its view, or edit it. Clicking an open file again only switches to it. Quick open pins. Each file view keeps the standard pane header. The tree sits inside the view with a toggle in the header, and a breadcrumb chip floats over the code. "Files" opens the same view with no file yet. Right pane tabs can no longer be renamed; a double-click pins instead. The file header drops its always-on Save, Copy path, Reveal and Open in editor buttons for Save while unsaved and the Open in menu. The panes package gains Workspace options for this (renameTabs, onTabDoubleClick, isPreviewTab). The stacked-panes store change from the first commit is reverted.
Pinning a right-pane preview tab took a double-click. Workspace's onTabDoubleClick becomes onTabClick, which runs after the click selects the tab; the right pane pins the tab's preview panes there. A drag never fires a click, so reordering a preview tab leaves it a preview.
The tree only moved keyboard focus to the open file, and only when its row was already loaded, so the row matching the tab was never shown selected. It now reveals the open file the way Reveal in sidebar does: expand its folders, select only its row and scroll it into view, each time the open file changes.
A file or folder deleted from the Files tree now closes every file pane showing it, or anything under it, in both pane areas. Deletes from outside the app keep the 'File was deleted on disk' banner, so unsaved edits are not thrown away.
The tree inside a right pane file view keeps its own row: search (an icon), Refresh and Collapse all, then Open in and the tree toggle. New File and New Folder come from the context menu; right-clicking empty tree space offers them for the project root. With the tree hidden, Open in and the toggle sit in the pane header.
… toggle With the tree hidden, the right pane file view shows a small floating pill at its top right (Open in, search, show tree) where the tree's row was, instead of moving those into the pane header.
Shows the workspace's repo in a dropdown at the top of the tree. It lists only the primary repo for now; multi-repo workspaces follow.
…resizable Open in and the tree toggle float at the file view's top right and stay put whether the tree shows or not. The tree keeps its own search, Refresh and Collapse all, sits flush against the pane edge, and its width is resizable. The view stays mounted when the tree toggles.
…ed corner The resizable tree starts under Open in and the tree toggle, flush with the pane's right and bottom edges, with a rounded top-left corner. The resize handle is the card's left edge.
…iew's tree Pierre opens a context menu only on rows, and a large repo's tree has no empty space to right-click, so the root needs its own buttons.
…ker hides with one repo host-service gains workspace.repositories, the shape multi-repo workspaces will return; for now it lists the workspace's one repository. The file view's repo picker shows only for two or more, and hides the same way on a host without the procedure.
A tab click pins only a preview tab, so browser and other unpinned panes keep being reused. Opening a file in a new tab from the tree goes through openFileFromTree, so an open file is focused instead of duplicated. The tree toggle moves under its one user.
… renames A click opens a file as the preview, a second click on it pins it, and a double-click renames it, as in the sidebar tree. The tree's double-click-to-pin override is gone.
… its content In the right pane, the unsaved dot moves into the breadcrumb next to the file name and Save floats with Open in, instead of both sitting in the pane header. Other file panes keep them in the header.
The file view's breadcrumb shows as many trailing crumbs as fit before the floating actions (keeping 64px clear) and folds the rest into an ellipsis. Clicking a crumb opens its parent folder as a small tree, with the path to the current file expanded and the file highlighted; picking a file opens it as the preview.
Clicking the ellipsis shows the folders it folds away, top to bottom; picking one opens that folder's level as a tree, like its crumb would.
The breadcrumb renders beside the floating actions instead of inside the code panel, so how many crumbs fit depends only on those actions and toggling the tree no longer changes it. The tree panel stays mounted and collapses or expands with a short width transition; dragging it closed also hides it.
The dirty dot and the Save button keep their space while hidden, so the breadcrumb fits the same number of crumbs before and after an edit.
60e0168 to
8a3b776
Compare
…eckout folder Reading project.repoName tripped the guard that keeps cached GitHub snapshot fields out of host-service queries.
[Medium impact] The main reach is the desktop workspace’s right-pane file workflow. Fix the missing file controls in saved split layouts before merging. Findings
Fix with agent prompt### Issue 1
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FileViewLayout/FileViewLayout.tsx:55-58
For a restored right-pane tab containing both `files` and `file` panes, this return removes the breadcrumb and floating buttons. `FilePaneHeaderExtras` also hides Save and Open in for right-pane files, while `showDirty` hides the header dot. The file therefore has no Save button, Open in menu, or visible unsaved marker. Skip only the duplicate tree, not the file controls.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
### Issue 2
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/FilesTab.tsx:451-458
After a user selects a nested folder or file, right-clicking blank space leaves that selection intact. These calls omit the parent, so `startCreating` uses the selected folder or the selected file's parent instead of the workspace root. The new item appears in the wrong directory. Pass `rootPath` explicitly to both root-menu actions.
### Issue 3
apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FileViewLayout/components/FileBreadcrumb/FileBreadcrumb.tsx:41-47
Terminal file links can open absolute paths outside the checkout. `toRelativeWorkspacePath` returns those paths unchanged, but this code still prepends `rootPath`. With root `/repo` and file `/tmp/example.txt`, the file's breadcrumb menu lists `/repo/tmp` instead of `/tmp`. Users see the wrong folder or an empty list. Build the trail from the absolute path when the file is outside the workspace.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds preview and pinned file tabs in the right pane.
A saved split layout can lose its file controls and unsaved marker. Two smaller issues affect root-menu creation and breadcrumbs for files outside the checkout. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tree or breadcrumb file click] --> B{File already open?}
B -->|Yes| C[Select and pin file]
B -->|No| D{Empty Files pane?}
D -->|Yes| E[Replace Files pane]
D -->|No| F{Preview exists?}
F -->|Yes| G[Replace preview path]
F -->|No| H[Add preview tab]
I[Quick open] --> J[Open file and pin it]
E --> K[File view]
G --> K
H --> K
K --> L[Breadcrumb and floating buttons]
K --> M[Collapsible file tree]
Reviews (1) · Last reviewed commit: "fix(host-service): workspace.repositorie..." · Reviewed by Greptile |
| const tabHasTreePane = | ||
| context.pane.kind !== "files" && | ||
| Object.values(context.tab.panes).some((pane) => pane.kind === "files"); | ||
| if (!showTree || tabHasTreePane) return children; |
There was a problem hiding this comment.
Saved layouts lose file controls
For a restored right-pane tab containing both files and file panes, this return removes the breadcrumb and floating buttons. FilePaneHeaderExtras also hides Save and Open in for right-pane files, while showDirty hides the header dot. The file therefore has no Save button, Open in menu, or visible unsaved marker. Skip only the duplicate tree, not the file controls.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FileViewLayout/FileViewLayout.tsx
Line: 55-58
Comment:
**Saved layouts lose file controls**
For a restored right-pane tab containing both `files` and `file` panes, this return removes the breadcrumb and floating buttons. `FilePaneHeaderExtras` also hides Save and Open in for right-pane files, while `showDirty` hides the header dot. The file therefore has no Save button, Open in menu, or visible unsaved marker. Skip only the duplicate tree, not the file controls.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| <DropdownMenuItem | ||
| onSelect={() => setTimeout(() => void startCreating("file"), 0)} | ||
| > | ||
| <FilePlus /> | ||
| <Trans>New File...</Trans> | ||
| </DropdownMenuItem> | ||
| <DropdownMenuItem | ||
| onSelect={() => setTimeout(() => void startCreating("folder"), 0)} |
There was a problem hiding this comment.
Root menu uses selected folder
After a user selects a nested folder or file, right-clicking blank space leaves that selection intact. These calls omit the parent, so startCreating uses the selected folder or the selected file's parent instead of the workspace root. The new item appears in the wrong directory. Pass rootPath explicitly to both root-menu actions.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/components/WorkspaceSidebar/components/FilesTab/FilesTab.tsx
Line: 451-458
Comment:
**Root menu uses selected folder**
After a user selects a nested folder or file, right-clicking blank space leaves that selection intact. These calls omit the parent, so `startCreating` uses the selected folder or the selected file's parent instead of the workspace root. The new item appears in the wrong directory. Pass `rootPath` explicitly to both root-menu actions.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const relativePath = rootPath | ||
| ? toRelativeWorkspacePath(rootPath, filePath) | ||
| : filePath; | ||
| const segments = relativePath.split(/[\\/]/).filter(Boolean); | ||
| const base = rootPath?.replace(/[\\/]+$/, "") ?? ""; | ||
| const pathOf = (count: number) => | ||
| [base, ...segments.slice(0, count)].join("/") || "/"; |
There was a problem hiding this comment.
Outside files show wrong folders
Terminal file links can open absolute paths outside the checkout. toRelativeWorkspacePath returns those paths unchanged, but this code still prepends rootPath. With root /repo and file /tmp/example.txt, the file's breadcrumb menu lists /repo/tmp instead of /tmp. Users see the wrong folder or an empty list. Build the trail from the absolute path when the file is outside the workspace.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/renderer/routes/_authenticated/_dashboard/v2-workspace/$workspaceId/hooks/usePaneRegistry/components/FileViewLayout/components/FileBreadcrumb/FileBreadcrumb.tsx
Line: 41-47
Comment:
**Outside files show wrong folders**
Terminal file links can open absolute paths outside the checkout. `toRelativeWorkspacePath` returns those paths unchanged, but this code still prepends `rootPath`. With root `/repo` and file `/tmp/example.txt`, the file's breadcrumb menu lists `/repo/tmp` instead of `/tmp`. Users see the wrong folder or an empty list. Build the trail from the absolute path when the file is outside the workspace.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
What
Files in the right pane open as tabs in the right pane's tab bar, using the preview/pin model editors use. All of it is behind the
right-pane-areaflag, except the file header change noted below.Opening and pinning
File view layout (the pane header stays the standard one)
File header change everywhere (flag off too)
Screenshots at this head: to follow.
How
@superset/panesWorkspaceoptions:renameTabs(off in the right pane),onTabClick(runs after select; the right pane pins preview tabs with it),isPreviewTab(italic title). The center pane is unchanged.openFileFromTree(9 tests) holds the tree rules: pin an already open file; turn the empty Files view into the file; replace the preview; otherwise add a tab.FileViewLayoutwraps file panes in the right pane store: breadcrumb, floating buttons, and a collapsibleResizablePanelGroupfor the tree. Old saved layouts with a separate Files pane still render; the file view hides its own tree there.workspace.repositories(additive, 3 tests) returns{ id, path, name, primary }[], one primary repo for now, named after its checkout folder. The picker treats an error from an older host as "one repo". Multi-repo comes later with a hostworkspace_repositoriestable (FK to workspaces) that replaces the hidden sibling workspace rows cloud boxes use today.V2OpenInMenuButtontakespathand an optionalbranch, and ahotkeysoption so per-file buttons don't bind the workspace hotkeys.Notes
Verification
openFileFromTree9 cases;workspace.repositories3 cases; panes 140 pass; host-service workspace router 336 pass, plus the snapshot-field guard. Full desktop suite: 8795 pass, 38 fail, all in git/shell main-process tests this PR doesn't touch, failing withposix_spawn EAGAINwhile the dev app ran; one of those files passes alone.check:i18nclean. Typecheck shows only the existing auth typing errors inpackages/auth/packages/trpc.workspace.repositories.