import React from 'react'; import type { EditorAnnotation } from '../types'; import { cn } from '../lib/utils'; // EditorAnnotationCard is SHARED across surfaces: // - the plan/annotate AnnotationPanel (flat surface-1 cards), and // - the code-review ReviewSidebar (bordered cards, sitting next to // renderAnnotationCard's `p-2.5 rounded border border-transparent // hover:bg-muted/30` code cards). // The `variant` prop keeps each surface visually cohesive: // - 'plan' → flat surface-1 hover (matches the plan AnnotationCard restyle) // - 'code-review' → bordered + muted hover (matches code-review's code cards) type EditorAnnotationVariant = 'plan' | 'code-review'; interface EditorAnnotationCardProps { annotation: EditorAnnotation; /** Omit to render the card read-only (no delete affordance). */ onDelete?: () => void; variant?: EditorAnnotationVariant; } export const EditorAnnotationCard: React.FC = ({ annotation, onDelete, variant = 'plan' }) => { const lineRange = annotation.lineStart === annotation.lineEnd ? `L${annotation.lineStart}` : `L${annotation.lineStart}-${annotation.lineEnd}`; return (
{/* Header: type word + file:line + delete */}
Editor {annotation.filePath}:{lineRange} {onDelete && ( )}
{/* Selected text */}

{annotation.selectedText}

{/* Comment */} {annotation.comment && (

{annotation.comment}

)}
); };