feat(desktop): show only the tree in the Files pane until a file opens

HA
2d ago
+183-158

Why

Discord feedback on the new right pane area: the Files pane always reserved an empty "Select a file to view it here" column next to the tree, even with no file open, and closing a file closed the whole right area, tree included. Users want a pinned tree, with files shown only when needed.

What changed

  • Tree only: FilesTreePane renders just the tree. The placeholder and its string (all 17 catalogs) are removed.
  • Same pane: a file opened from the tree shows in the same pane, tree on the left, file on the right (FileViewLayout).
  • Close goes back to the tree: when a file pane is alone in its right-area tab, closing it (× or Close Pane) turns it back into the Files tree via the new returnFileToTree instead of closing the area. The unsaved-changes prompt runs first (moved into confirmFileClose); pinned files are unpinned first because replacePane skips pinned panes.
  • Width: while the active right tab is tree-only, the right area uses rightSidebarWidth (default 340px) instead of rightPaneAreaWidth.
  • FileViewTree moved up to usePaneRegistry/components/ (used by two components now).

Before/after screenshots: https://app.superset.sh/page/file-tree-right-pane-options-to-improve-the-experi-d7xh8j

Validation

  • Desktop dev build, driven over CDP: tree-only at 340px, then clicking a file opens it in the same pane, then × and Ctrl+Shift+W both return to tree-only at 340px, including for a pinned file.
  • bun test for returnFileToTree and openFileFromTree: 12 pass.
  • Desktop tsc --noEmit passes, biome clean, check:i18n 0 missing.

Notes for review

  • Any file alone in a right-area tab returns to the tree on close, including one opened with "Open in new tab". That can leave a second tree tab.
  • Not tested in the UI: the Save / Don't Save path for a dirty file. That prompt code is moved, not changed.

Summary by cubic

Makes the Files pane in the right area show only the tree until a file is opened, instead of always reserving an empty file-view column.

  • Opening a file from the tree shows it in the same pane, tree on the left, file on the right.
  • Closing a file that is alone in its right-area tab turns the pane back into the tree (with the unsaved-changes prompt first) instead of closing the whole right area. Pinned files are unpinned as part of this.
  • While the active right tab is tree-only, the right area uses the sidebar width (340px default) rather than the pane area width.
  • Removes the "Select a file to view it here" placeholder and its translations.
  • Moves FileViewTree into usePaneRegistry/components since two components now use it.

Note: Any file alone in a right-area tab returns to the tree on close, including files opened with "Open in new tab", which can leave a second tree tab. The dirty-file Save / Don't Save prompt was moved, not changed, and the Save / Don't Save path hasn't been tested in the UI.

Summary by CodeRabbit

  • New Features
    • File panes now work more seamlessly with the file tree, which can be collapsed and displayed alongside pane content.
    • Closing a file pane can return its file to the tree when it is the only pane in its tab.
  • Bug Fixes
    • Closing a modified file now prompts you to save, discard changes, or cancel. The pane stays open if you cancel or saving fails.