import { useState } from 'react'; import { Sparkles, ChevronDown, ChevronUp, Check, AlertTriangle } from 'lucide-react'; import { cn } from '../../lib/cn'; import { Avatar } from '../core/Avatar'; import { AIDecisionCard } from './AIDecisionCard'; import type { AIDecisionCardProps } from './AIDecisionCard'; export interface AiSuggestionPanelProps extends AIDecisionCardProps { /** Eyebrow heading above the card. @default "AI suggestion" */ label?: string; /** Start as a one-line strip, expandable to the full card. @default true */ collapsible?: boolean; className?: string; } /** * Sidebar framing for an AI employee's decision inside an activity form. * Defaults to a compact one-line strip (avatar · name · confidence · summary) * so it sits comfortably beside small forms, and expands to the full * AIDecisionCard on click. Pass `collapsible={false}` to always show the card. */ export function AiSuggestionPanel({ label = 'AI suggestion', collapsible = true, className, ...card }: AiSuggestionPanelProps) { const [open, setOpen] = useState(!collapsible); const { employee = 'Aria', confidence = 0.85, threshold = 0.7, summary, } = card; const autonomous = confidence >= threshold; const accent = autonomous ? 'var(--status-autonomous)' : 'var(--status-escalated)'; const accentSoft = autonomous ? 'var(--status-autonomous-soft)' : 'var(--status-escalated-soft)'; const pct = Math.round(Math.max(0, Math.min(1, confidence)) * 100); return (
{label}
{collapsible && open && ( )}
{open ? ( ) : ( )}
); }