Skip to content

Commit ba13455

Browse files
authored
🤖 refactor: remove file explorer (#3208)
Summary Removes the right sidebar file explorer and its file viewer tab flow wholesale. The sidebar now keeps only the remaining static tabs plus terminal tabs, and persisted runtime layouts and saved layout presets sanitize legacy explorer/file tabs instead of re-injecting or discarding them. Implementation - Deleted Explorer/FileViewer components, tests, stories, cache, and file-explorer utilities. - Removed explorer/file tabs from sidebar tab types, tab registry/labels, layout defaults, layout preset schemas, stories, CSS theme tokens, and e2e split-layout expectations. - Preserved legacy saved layout presets by stripping removed explorer/file tabs during preset normalization. - Kept a small file-read utility for immersive review's existing file-content overlay path. Validation - `make static-check` - `bun test src/common/types/uiLayouts.test.ts` - `bun test src/browser/utils/fileRead.test.ts` - `bun test src/browser/utils/rightSidebarLayout.test.ts` - `bun test src/browser/contexts/WorkspaceContext.test.tsx` - `make fmt-check` - `make typecheck` - `make lint` Risks Medium risk around persisted right-sidebar layout compatibility; legacy explorer/file tabs are stripped at parse/normalization time and removed-only tabsets fall back to Stats. --- _Generated with `mux` • Model: `openai:gpt-5.5` • Thinking: `high` • Cost: `536175{MUX_COSTS_USD:-0}`_ <!-- mux-attribution: model=openai:gpt-5.5 thinking=high costs=15.74 -->
1 parent 6b361ff commit ba13455

34 files changed

Lines changed: 388 additions & 3748 deletions

src/browser/contexts/WorkspaceContext.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ describe("WorkspaceContext", () => {
733733
root: {
734734
type: "tabset",
735735
id: "tabset-1",
736-
tabs: ["costs", "explorer", "terminal:t1"],
736+
tabs: ["costs", "review", "terminal:t1"],
737737
activeTab: "terminal:t1",
738738
},
739739
};
@@ -759,10 +759,10 @@ describe("WorkspaceContext", () => {
759759
throw new Error("Expected cleaned right sidebar layout to be a tabset");
760760
}
761761

762-
// "explorer" becomes active because removeTabEverywhere picks the adjacent
762+
// "review" becomes active because removeTabEverywhere picks the adjacent
763763
// tab after the removed terminal tab.
764-
expect(cleanedLayout.root.tabs).toEqual(["costs", "explorer"]);
765-
expect(cleanedLayout.root.activeTab).toBe("explorer");
764+
expect(cleanedLayout.root.tabs).toEqual(["costs", "review"]);
765+
expect(cleanedLayout.root.activeTab).toBe("review");
766766
expect(
767767
readPersistedState<Record<string, string>>(terminalTitlesKey, { stale: "title" })
768768
).toEqual({});

src/browser/features/RightSidebar/CodeReview/HunkViewer.tsx

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ interface HunkViewerProps {
4949
includeUncommitted: boolean;
5050
/** Action callbacks for inline review notes */
5151
reviewActions?: ReviewActionCallbacks;
52-
/** Callback to open a file in a new tab */
53-
onOpenFile?: (relativePath: string) => void;
5452
}
5553

5654
function renderHighlightedFilePath(
@@ -128,7 +126,6 @@ export const HunkViewer = React.memo<HunkViewerProps>(
128126
diffBase,
129127
reviewActions,
130128
includeUncommitted,
131-
onOpenFile,
132129
}) => {
133130
// Ref for the hunk container to track visibility
134131
const hunkRef = React.useRef<HTMLDivElement>(null);
@@ -192,14 +189,6 @@ export const HunkViewer = React.memo<HunkViewerProps>(
192189
[hunk.filePath, searchConfig]
193190
);
194191

195-
const handleOpenFile = React.useCallback(
196-
(event: React.MouseEvent<HTMLButtonElement>) => {
197-
event.stopPropagation();
198-
onOpenFile?.(hunk.filePath);
199-
},
200-
[onOpenFile, hunk.filePath]
201-
);
202-
203192
// Persist manual expand/collapse state across remounts per workspace
204193
// Maps hunkId -> isExpanded for user's manual preferences
205194
// Enable listener to synchronize updates across all HunkViewer instances
@@ -337,23 +326,9 @@ export const HunkViewer = React.memo<HunkViewerProps>(
337326
</TooltipContent>
338327
</Tooltip>
339328
)}
340-
{onOpenFile ? (
341-
<TooltipIfPresent tooltip={hunk.filePath} side="top" align="start">
342-
<button
343-
type="button"
344-
onClick={handleOpenFile}
345-
className={cn(
346-
"text-foreground min-w-0 truncate bg-transparent p-0 text-left",
347-
"hover:text-link focus-visible:text-link cursor-pointer border-none"
348-
)}
349-
aria-label={`Open ${hunk.filePath} in new tab`}
350-
>
351-
<span>{highlightedFilePath}</span>
352-
</button>
353-
</TooltipIfPresent>
354-
) : (
329+
<TooltipIfPresent tooltip={hunk.filePath} side="top" align="start">
355330
<div className="text-foreground min-w-0 truncate">{highlightedFilePath}</div>
356-
)}
331+
</TooltipIfPresent>
357332
<div className="text-muted ml-auto flex shrink-0 items-center gap-1.5 whitespace-nowrap">
358333
{!isPureRename && (
359334
<>

src/browser/features/RightSidebar/CodeReview/ImmersiveReviewView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
matchesKeybind,
4242
} from "@/browser/utils/ui/keybinds";
4343
import { stopKeyboardPropagation } from "@/browser/utils/events";
44-
import { buildReadFileScript, processFileContents } from "@/browser/utils/fileExplorer";
44+
import { buildReadFileScript, processFileContents } from "@/browser/utils/fileRead";
4545
import { TooltipIfPresent } from "@/browser/components/Tooltip/Tooltip";
4646
import {
4747
parseReviewLineRange,

src/browser/features/RightSidebar/CodeReview/ReviewPanel.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ interface ReviewPanelProps {
107107
isTouchImmersive?: boolean;
108108
/** Allow parent to switch touch/mobile immersive affordances before entering immersive UI. */
109109
onTouchImmersiveChange?: (isTouch: boolean) => void;
110-
/** Callback to open a file in a new tab */
111-
onOpenFile?: (relativePath: string) => void;
112110
}
113111

114112
interface ReviewSearchState {
@@ -344,7 +342,6 @@ export const ReviewPanel: React.FC<ReviewPanelProps> = ({
344342
onStatsChange,
345343
isTouchImmersive = false,
346344
onTouchImmersiveChange,
347-
onOpenFile,
348345
}) => {
349346
const originFetchRef = useRef<OriginFetchState | null>(null);
350347
const { api } = useAPI();
@@ -1733,7 +1730,6 @@ export const ReviewPanel: React.FC<ReviewPanelProps> = ({
17331730
diffBase={filters.diffBase}
17341731
includeUncommitted={filters.includeUncommitted}
17351732
reviewActions={reviewActions}
1736-
onOpenFile={onOpenFile}
17371733
/>
17381734
);
17391735
})

src/browser/features/RightSidebar/ExplorerTab.test.tsx

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)