import type { Suggestion, SuggestionType } from '../../api/client' // Per-type accent color + human label, mirroring the design tokens. const TYPE_META: Record = { grammar: { color: 'var(--color-mint)', label: 'Grammar' }, phrasing: { color: 'var(--color-peach)', label: 'Phrasing' }, idiom: { color: 'var(--color-lavender)', label: 'Idiom' }, clarity: { color: 'var(--color-sky)', label: 'Clarity' }, voice: { color: 'var(--color-honey)', label: 'Voice' }, } interface Props { suggestion: Suggestion style: React.CSSProperties onAccept: (s: Suggestion) => void onDismiss: (s: Suggestion) => void onPointerEnter: () => void onPointerLeave: () => void } // SuggestionCard is the hover panel for a single suggestion: a colored type tag, // the original → replacement diff, the friendly explanation, and accept/dismiss // actions. Voice flags carry no replacement, so the diff row is hidden and only // Dismiss is offered (awareness-only). export function SuggestionCard({ suggestion, style, onAccept, onDismiss, onPointerEnter, onPointerLeave, }: Props) { const meta = TYPE_META[suggestion.type] const hasReplacement = suggestion.replacement.trim() !== '' return (
{meta.label} {hasReplacement && (
{suggestion.original} {suggestion.replacement}
)}

{suggestion.explanation}

{hasReplacement && ( )}
) }