feat(desktop): right pane file tabs with preview and pinned states

Merged
SA
4d ago
+1413-186

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-area flag, except the file header change noted below.

Opening and pinning

  • Click a file in the tree: it opens in the preview tab (italic title). The next click on another file replaces it in place.
  • Click an open file again in the tree: pins it.
  • Double-click a file in the tree: renames it, as in the sidebar.
  • Click the preview's tab once: pins it.
  • Click inside the file view or edit the file: pins it.
  • Quick open (⌘P) opens files pinned.
  • Right pane tabs can't be renamed (no double-click rename, no Rename in the menu).

File view layout (the pane header stays the standard one)

  • Breadcrumb chip floats at the top left of the content, with the file icon and an unsaved dot.
    • It shows as many crumbs as fit, keeping 64px clear of the buttons on the right; the rest collapse into "…".
    • Clicking a crumb opens a popover tree of that folder. Clicking "…" lists the hidden folders; picking one shows its tree.
    • The unsaved dot and Save keep their space while hidden, so editing doesn't change the crumbs.
  • Floating buttons at the top right, in the same spot whether the tree shows or not: Save (filled, only while there are unsaved changes), Open in for the file, and the tree toggle.
  • Tree below the buttons, flush to the right and bottom edges, with a rounded top-left corner.
    • Resizable; double-click the divider to reset the width. Dragging it closed turns the toggle off.
    • Opens and closes with a 200ms animation.
    • Row on top: "Search files" (opens quick open), New File, New Folder, Refresh, Collapse all. Right-click empty space for New File / New Folder at the root.
  • Repo picker above the tree, hidden unless the workspace has 2+ repos. For now the host returns only the primary repo, so it never shows (see How).
  • "Files" with no file open shows an empty section next to the tree.

File header change everywhere (flag off too)

  • Copy path, Reveal in Finder and Open in editor are replaced by the existing Open in split button, used for the file. Its menu has the editors, Finder and Copy path. Cloud workspaces keep a plain Copy path button.
  • Save shows only while the file has unsaved changes.
  • In the right pane, Save and the unsaved dot live in the content, not the header or tab.

Screenshots at this head: to follow.

How

  • @superset/panes Workspace options: 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.
  • FileViewLayout wraps file panes in the right pane store: breadcrumb, floating buttons, and a collapsible ResizablePanelGroup for the tree. Old saved layouts with a separate Files pane still render; the file view hides its own tree there.
  • New host-service procedure 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 host workspace_repositories table (FK to workspaces) that replaces the hidden sibling workspace rows cloud boxes use today.
  • V2OpenInMenuButton takes path and an optional branch, and a hotkeys option so per-file buttons don't bind the workspace hotkeys.

Notes

  • Tree search opens quick open. Filtering in place would only see folders already loaded, since the tree loads lazily.
  • Tree width and the toggle are in memory and reset on restart (no localStorage).
  • Each file tab has its own tree, so switching tabs resets scroll and open folders; the current file is revealed.
  • Pierre trees has no empty-space context menu, so the root New File / New Folder menu is ours. A beta.6 bump is a separate PR.

Verification

  • Tests: openFileFromTree 9 cases; workspace.repositories 3 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 with posix_spawn EAGAIN while the dev app ran; one of those files passes alone.
  • Checks: Biome and check:i18n clean. Typecheck shows only the existing auth typing errors in packages/auth / packages/trpc.
  • In the dev app over CDP (flag on):
    • one click on an open preview in the tree pins it;
    • one click on a preview tab pins it;
    • divider double-click resets the tree width;
    • long paths collapse into "…", crumb popovers open their folder, "…" lists the hidden trail;
    • toggling the tree leaves the breadcrumb in place while the tree animates (sampled per frame).
  • Not yet clicked through: root empty-space menu, tree highlight of the open file, double-click rename in the right pane tree, cloud workspace Copy path fallback, an older host without workspace.repositories.