Skip to content

Commit dc8c398

Browse files
backnotpropclaude
andcommitted
feat: annotatable diff view with diff context in feedback
Add annotation support to the plan clean diff view so users can select text in added/removed/modified sections and leave feedback. Annotations carry a diffContext field that flows through export, sharing, and drafts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e1bd27a commit dc8c398

9 files changed

Lines changed: 508 additions & 64 deletions

File tree

packages/editor/App.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,18 +1152,16 @@ const App: React.FC = () => {
11521152
showCancel
11531153
/>
11541154
<div className="min-h-full flex flex-col items-center px-2 py-3 md:px-10 md:py-8 xl:px-16">
1155-
{/* Annotation Toolstrip (hidden during plan diff) */}
1156-
{!isPlanDiffActive && (
1157-
<div className="w-full mb-3 md:mb-4 flex items-center justify-start" style={{ maxWidth: planMaxWidth }}>
1158-
<AnnotationToolstrip
1159-
inputMethod={inputMethod}
1160-
onInputMethodChange={handleInputMethodChange}
1161-
mode={editorMode}
1162-
onModeChange={handleEditorModeChange}
1163-
taterMode={taterMode}
1164-
/>
1165-
</div>
1166-
)}
1155+
{/* Annotation Toolstrip */}
1156+
<div className="w-full mb-3 md:mb-4 flex items-center justify-start" style={{ maxWidth: planMaxWidth }}>
1157+
<AnnotationToolstrip
1158+
inputMethod={inputMethod}
1159+
onInputMethodChange={handleInputMethodChange}
1160+
mode={editorMode}
1161+
onModeChange={handleEditorModeChange}
1162+
taterMode={taterMode}
1163+
/>
1164+
</div>
11671165

11681166
{/* Plan Diff View or Normal Plan View */}
11691167
{isPlanDiffActive && planDiff.diffBlocks && planDiff.diffStats ? (
@@ -1177,6 +1175,11 @@ const App: React.FC = () => {
11771175
baseVersionLabel={planDiff.diffBaseVersion != null ? `v${planDiff.diffBaseVersion}` : undefined}
11781176
baseVersion={planDiff.diffBaseVersion ?? undefined}
11791177
maxWidth={planMaxWidth}
1178+
annotations={annotations}
1179+
onAddAnnotation={handleAddAnnotation}
1180+
onSelectAnnotation={handleSelectAnnotation}
1181+
selectedAnnotationId={selectedAnnotationId}
1182+
mode={editorMode}
11801183
/>
11811184
) : (
11821185
<Viewer

packages/ui/components/AnnotationPanel.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,15 @@ const AnnotationCard: React.FC<{
384384
{config.label}
385385
</span>
386386
</div>
387+
{annotation.diffContext && (
388+
<span className={`text-[9px] px-1.5 py-0.5 rounded font-medium ${
389+
annotation.diffContext === 'added' ? 'bg-success/10 text-success' :
390+
annotation.diffContext === 'removed' ? 'bg-destructive/10 text-destructive' :
391+
'bg-amber-500/10 text-amber-600 dark:text-amber-400'
392+
}`}>
393+
{annotation.diffContext}
394+
</span>
395+
)}
387396
<span className="text-[10px] text-muted-foreground/50">
388397
{formatTimestamp(annotation.createdA)}
389398
</span>

0 commit comments

Comments
 (0)