Skip to content

Commit 138ba3a

Browse files
Tighten multi-file diff sidebar layout
Remove file status pills from diff accordion headers and box changed-file navigators in commit and PR diff surfaces.
1 parent 4aab028 commit 138ba3a

2 files changed

Lines changed: 6 additions & 27 deletions

File tree

src/features/git/components/diff/git-diff-editor-stack.tsx

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,6 @@ const statusTextClass: Record<string, string> = {
8888
renamed: "text-git-renamed",
8989
};
9090

91-
const statusBadgeClass: Record<string, string> = {
92-
added: "bg-git-added/12 text-git-added",
93-
deleted: "bg-git-deleted/12 text-git-deleted",
94-
modified: "bg-git-modified/12 text-git-modified",
95-
renamed: "bg-git-renamed/12 text-git-renamed",
96-
};
97-
9891
function getDiffSectionKey(multiDiff: MultiFileDiff, diff: GitDiff, index: number): string {
9992
return multiDiff.fileKeys?.[index] ?? `${diff.file_path}:${index}`;
10093
}
@@ -421,7 +414,7 @@ const DiffFileSection = memo(function DiffFileSection({
421414
const fontSize = editorFontSize * zoomLevel;
422415
const lineHeight = calculateLineHeight(fontSize, editorLineHeight);
423416
const iconSize = Math.max(12, Math.min(16, Math.round(fontSize * 0.72)));
424-
const badgeHeight = Math.max(16, Math.round(fontSize + 4));
417+
const headerHeight = lineHeight + 6;
425418
const headerStyle = useMemo(
426419
() => ({
427420
fontSize: `${fontSize}px`,
@@ -430,14 +423,6 @@ const DiffFileSection = memo(function DiffFileSection({
430423
}),
431424
[editorFontFamily, fontSize, lineHeight],
432425
);
433-
const badgeStyle = useMemo(
434-
() => ({
435-
fontSize: `${Math.max(11, fontSize - 2)}px`,
436-
height: `${badgeHeight}px`,
437-
lineHeight: `${badgeHeight}px`,
438-
}),
439-
[badgeHeight, fontSize],
440-
);
441426
const handleToggle = useCallback(() => {
442427
onToggle(sectionKey);
443428
}, [onToggle, sectionKey]);
@@ -468,7 +453,7 @@ const DiffFileSection = memo(function DiffFileSection({
468453
type="button"
469454
onClick={handleToggle}
470455
className="relative z-50 flex shrink-0 items-center justify-center text-text-lighter hover:bg-hover/30 hover:text-text"
471-
style={{ width: `${lineHeight}px`, height: `${lineHeight}px` }}
456+
style={{ width: `${headerHeight}px`, height: `${headerHeight}px` }}
472457
aria-label={expanded ? "Collapse file diff" : "Expand file diff"}
473458
aria-expanded={expanded}
474459
>
@@ -478,7 +463,7 @@ const DiffFileSection = memo(function DiffFileSection({
478463
type="button"
479464
onClick={handleOpenFile}
480465
className="relative z-50 flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden py-0 pr-2 text-left hover:bg-hover/30"
481-
style={{ height: `${lineHeight}px` }}
466+
style={{ height: `${headerHeight}px` }}
482467
aria-label={`Open ${filePath}`}
483468
>
484469
<ThemedFileIcon
@@ -500,14 +485,6 @@ const DiffFileSection = memo(function DiffFileSection({
500485
<span className="ml-auto flex shrink-0 items-center gap-1.5">
501486
{additions > 0 ? <span className="text-git-added">+{additions}</span> : null}
502487
{deletions > 0 ? <span className="text-git-deleted">-{deletions}</span> : null}
503-
<Badge
504-
size="compact"
505-
variant="muted"
506-
className={`rounded-full px-1.5 py-0.5 capitalize ${statusBadgeClass[status]}`}
507-
style={badgeStyle}
508-
>
509-
{status}
510-
</Badge>
511488
</span>
512489
</button>
513490
</div>
@@ -896,6 +873,7 @@ const GitDiffEditorStack = memo(function GitDiffEditorStack({
896873
ariaLabel="Changed files"
897874
viewMode={fileNavigatorViewMode}
898875
onViewModeChange={setFileNavigatorViewMode}
876+
className="my-2 ml-2 h-auto self-stretch rounded-md border border-border/70 bg-secondary-bg/20"
899877
borderless
900878
searchMode="fuzzy"
901879
/>
@@ -907,7 +885,7 @@ const GitDiffEditorStack = memo(function GitDiffEditorStack({
907885
data-diff-stack-scroll-container
908886
onWheelCapture={handleStackWheelCapture}
909887
>
910-
<div className="flex min-w-0 max-w-full flex-col gap-1.5 rounded-md">
888+
<div className="flex min-w-0 max-w-full flex-col gap-2 rounded-md">
911889
{multiDiff.files.map((diff, index) => {
912890
const sectionKey = getDiffSectionKey(multiDiff, diff, index);
913891

src/features/github/components/pr-files-panel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export const PRFilesPanel = memo(
158158
viewMode={fileNavigatorViewMode}
159159
onViewModeChange={setFileNavigatorViewMode}
160160
borderless
161+
className="my-2 ml-2 h-auto self-stretch rounded-md border border-border/70 bg-secondary-bg/20"
161162
searchMode="fuzzy"
162163
/>
163164
) : null}

0 commit comments

Comments
 (0)