Skip to content

Commit ac0e086

Browse files
committed
Enhance DiffPanel component for improved terminology and functionality
- Introduce latestSelectedTurnId to track the most recent change. - Update button aria-labels and text from "turn" to "change" for clarity. - Modify titles and messages to reflect changes instead of turns, improving user understanding. - Adjust layout and styling for better presentation of change information.
1 parent 76d8a80 commit ac0e086

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

apps/web/src/components/DiffPanel.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
331331
[activeCwd],
332332
);
333333

334+
const latestSelectedTurnId = orderedTurnDiffSummaries[0]?.turnId ?? null;
335+
334336
const selectTurn = (turnId: TurnId) => {
335337
if (!activeThread) return;
336338
void navigate({
@@ -433,7 +435,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
433435
)}
434436
onClick={() => scrollTurnStripBy(-180)}
435437
disabled={!canScrollTurnStripLeft}
436-
aria-label="Scroll turn list left"
438+
aria-label="Scroll change list left"
437439
>
438440
<ChevronLeftIcon className="size-3.5" />
439441
</button>
@@ -447,7 +449,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
447449
)}
448450
onClick={() => scrollTurnStripBy(180)}
449451
disabled={!canScrollTurnStripRight}
450-
aria-label="Scroll turn list right"
452+
aria-label="Scroll change list right"
451453
>
452454
<ChevronRightIcon className="size-3.5" />
453455
</button>
@@ -470,7 +472,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
470472
: "border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80",
471473
)}
472474
>
473-
<div className="text-[10px] leading-tight font-medium">All turns</div>
475+
<div className="text-[10px] leading-tight font-medium">All changes</div>
474476
</div>
475477
</button>
476478
{orderedTurnDiffSummaries.map((summary) => (
@@ -479,7 +481,15 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
479481
type="button"
480482
className="shrink-0 rounded-md"
481483
onClick={() => selectTurn(summary.turnId)}
482-
title={summary.turnId}
484+
title={`${
485+
summary.turnId === latestSelectedTurnId
486+
? "Latest change"
487+
: `Change ${
488+
summary.checkpointTurnCount ??
489+
inferredCheckpointTurnCountByTurnId[summary.turnId] ??
490+
"?"
491+
}`
492+
}${formatShortTimestamp(summary.completedAt, settings.timestampFormat)}`}
483493
data-turn-chip-selected={summary.turnId === selectedTurn?.turnId}
484494
>
485495
<div
@@ -490,14 +500,17 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
490500
: "border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80",
491501
)}
492502
>
493-
<div className="flex items-center gap-1">
503+
<div className="flex flex-col gap-0.5">
494504
<span className="text-[10px] leading-tight font-medium">
495-
Turn{" "}
496-
{summary.checkpointTurnCount ??
497-
inferredCheckpointTurnCountByTurnId[summary.turnId] ??
498-
"?"}
505+
{summary.turnId === latestSelectedTurnId
506+
? "Latest"
507+
: `Change ${
508+
summary.checkpointTurnCount ??
509+
inferredCheckpointTurnCountByTurnId[summary.turnId] ??
510+
"?"
511+
}`}
499512
</span>
500-
<span className="text-[9px] leading-tight opacity-70">
513+
<span className="text-[9px] leading-tight opacity-60">
501514
{formatShortTimestamp(summary.completedAt, settings.timestampFormat)}
502515
</span>
503516
</div>
@@ -546,15 +559,15 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
546559
<DiffPanelShell mode={mode} header={headerRow}>
547560
{!activeThread ? (
548561
<div className="flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70">
549-
Select a thread to inspect turn diffs.
562+
Select a thread to inspect changes.
550563
</div>
551564
) : !isGitRepo ? (
552565
<div className="flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70">
553-
Turn diffs are unavailable because this project is not a git repository.
566+
Changes are unavailable because this project is not a git repository.
554567
</div>
555568
) : orderedTurnDiffSummaries.length === 0 ? (
556569
<div className="flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70">
557-
No completed turns yet.
570+
No captured changes yet.
558571
</div>
559572
) : (
560573
<>
@@ -569,7 +582,7 @@ export default function DiffPanel({ mode = "inline" }: DiffPanelProps) {
569582
)}
570583
{!renderablePatch ? (
571584
isLoadingCheckpointDiff ? (
572-
<DiffPanelLoadingState label="Loading checkpoint diff..." />
585+
<DiffPanelLoadingState label="Loading changes..." />
573586
) : (
574587
<div className="flex h-full items-center justify-center px-3 py-2 text-xs text-muted-foreground/70">
575588
<p>

apps/web/src/lib/providerReactQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function normalizeCheckpointErrorMessage(error: unknown): string {
6161

6262
const lower = message.toLowerCase();
6363
if (lower.includes("not a git repository")) {
64-
return "Turn diffs are unavailable because this project is not a git repository.";
64+
return "Changes are unavailable because this project is not a git repository.";
6565
}
6666

6767
if (

0 commit comments

Comments
 (0)