Skip to content

Commit ca6983c

Browse files
committed
ui(review): global diff-settings cog in toolbar + aligned file headers
- DiffOptionsPopover moves out of every FileHeader into the top toolbar, right of the action buttons (settings cog, shadcn-style popover unchanged). The options were always global config — rendering them per-file implied a per-file scope that never existed. - Trigger restyled to toolbar sizing (matches sidebar toggles, active state while open). - SemanticFileBadge: fixed badge min-width + fixed-width count so 1- vs 2-digit counts don't skew the header button column; files with no semantic changes render an invisible same-size ghost so all headers stay aligned when sem is available.
1 parent 3755858 commit ca6983c

5 files changed

Lines changed: 29 additions & 6 deletions

File tree

packages/review-editor/App.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ConfirmDialog } from '@plannotator/ui/components/ConfirmDialog';
66
import { Settings } from '@plannotator/ui/components/Settings';
77
import { FeedbackButton, ApproveButton, ExitButton } from '@plannotator/ui/components/ToolbarButtons';
88
import { AgentReviewActions } from './components/AgentReviewActions';
9+
import { DiffOptionsPopover } from './components/DiffOptionsPopover';
910
import { useUpdateCheck } from '@plannotator/ui/hooks/useUpdateCheck';
1011
import { storage } from '@plannotator/ui/utils/storage';
1112
import { CompletionOverlay } from '@plannotator/ui/components/CompletionOverlay';
@@ -2231,6 +2232,11 @@ const ReviewApp: React.FC = () => {
22312232
</button>
22322233
)}
22332234

2235+
{/* Global diff display options. These settings apply to every
2236+
file's diff, so they live once in the toolbar instead of being
2237+
repeated in every FileHeader. */}
2238+
<DiffOptionsPopover />
2239+
22342240
<div className="w-px h-5 bg-border/50 mx-1 hidden md:block" />
22352241

22362242
{/* Sidebar tab toggles */}

packages/review-editor/components/DiffOptionsPopover.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export const DiffOptionsPopover: React.FC = () => {
103103
<Popover.Root>
104104
<Popover.Trigger asChild>
105105
<button
106-
className="text-xs text-muted-foreground hover:text-foreground rounded hover:bg-muted transition-colors flex items-center px-1.5 py-1"
106+
className="p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-all flex items-center data-[state=open]:bg-primary/15 data-[state=open]:text-primary"
107107
title="Diff display options"
108108
>
109-
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
109+
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
110110
<path strokeLinecap="round" strokeLinejoin="round" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
111111
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
112112
</svg>

packages/review-editor/components/FileHeader.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React, { useEffect, useRef, useState } from 'react';
2-
import { DiffOptionsPopover } from './DiffOptionsPopover';
32
import { SemanticFileBadge } from './SemanticFileBadge';
43

54
interface FileHeaderProps {
@@ -215,7 +214,6 @@ export const FileHeader: React.FC<FileHeaderProps> = ({
215214
)}
216215
</button>
217216
<SemanticFileBadge filePath={filePath} />
218-
<DiffOptionsPopover />
219217
</div>
220218
</div>
221219
);

packages/review-editor/components/SemanticFileBadge.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ export const SemanticFileBadge: React.FC<{ filePath: string }> = ({ filePath })
3939
};
4040

4141
const count = changes.length + binaryChanges.length;
42-
if (!state || !available || loading || count === 0) return null;
42+
if (!state || !available) return null;
43+
// Sem is available but this file has no named changes (or is still
44+
// resolving): reserve the badge's exact footprint so the header buttons stay
45+
// column-aligned across files with and without a badge.
46+
if (loading || count === 0) {
47+
return <span className="semantic-file-badge semantic-file-badge-ghost" aria-hidden="true" />;
48+
}
4349

4450
const openChange = (change: SemanticDiffChange) => {
4551
state.openDiffFile(change.filePath);

packages/review-editor/index.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,16 @@ diffs-container {
449449
padding: 0 0.5rem;
450450
}
451451
452-
/* "sem · N" pill in a diff file header */
452+
/* "sem · N" pill in a diff file header. Fixed min-width (and a fixed-width
453+
count, below) so 1- vs 2-digit counts — and files with no badge at all,
454+
via the ghost — never skew the header button column across files. */
453455
.semantic-file-badge {
454456
display: inline-flex;
455457
align-items: center;
458+
justify-content: center;
456459
gap: 0.3125rem;
457460
height: 1.5rem;
461+
min-width: 4.125rem;
458462
padding: 0 0.4375rem;
459463
border: 0;
460464
border-radius: var(--radius-sm);
@@ -467,6 +471,13 @@ diffs-container {
467471
transition: color 120ms ease, background 120ms ease;
468472
}
469473
474+
/* Invisible spacer with the badge's exact footprint, rendered when sem is
475+
available but a file has no named changes — keeps headers aligned. */
476+
.semantic-file-badge-ghost {
477+
visibility: hidden;
478+
pointer-events: none;
479+
}
480+
470481
.semantic-file-badge:hover,
471482
.semantic-file-badge[data-state="open"] {
472483
color: var(--foreground);
@@ -484,11 +495,13 @@ diffs-container {
484495
}
485496

486497
.semantic-file-badge-count {
498+
min-width: 1.5em;
487499
padding: 0.0625rem 0.3125rem;
488500
border-radius: calc(var(--radius-sm) - 2px);
489501
background: oklch(from var(--primary) l c h / 0.14);
490502
color: var(--primary);
491503
font-variant-numeric: tabular-nums;
504+
text-align: center;
492505
}
493506

494507
/* Hover popover — same terminal rows as the panel, shadcn surface */

0 commit comments

Comments
 (0)