import { useState } from 'react'; import type { Suggestion } from './api'; const typeConfig = { info: { icon: '💡', color: 'blue', bg: 'bg-blue-50', border: 'border-blue-200', text: 'text-blue-700', bar: 'bg-blue-500' }, warning: { icon: '⚠️', color: 'orange', bg: 'bg-orange-50', border: 'border-orange-200', text: 'text-orange-700', bar: 'bg-orange-500' }, action: { icon: '✅', color: 'green', bg: 'bg-green-50', border: 'border-green-200', text: 'text-green-700', bar: 'bg-green-500' }, insight: { icon: '🔍', color: 'purple', bg: 'bg-purple-50', border: 'border-purple-200', text: 'text-purple-700', bar: 'bg-purple-500' }, }; interface SuggestionCardProps { suggestion: Suggestion; onDismiss: (id: string) => void; onAct: (id: string, actionIndex: number) => void; } export function SuggestionCard({ suggestion, onDismiss, onAct }: SuggestionCardProps) { const [expanded, setExpanded] = useState(false); const config = typeConfig[suggestion.suggestion_type] || typeConfig.info; const confidencePercent = Math.round(suggestion.confidence * 100); return (
{/* Header */}
{config.icon}

{suggestion.title}

{/* Content */}

{suggestion.content}

{/* Confidence Bar */}
{confidencePercent}%
{/* Actions */} {suggestion.actions && suggestion.actions.length > 0 && (
{suggestion.actions.slice(0, expanded ? undefined : 2).map((action, idx) => ( ))} {suggestion.actions.length > 2 && ( )}
)} {/* Acted upon badge */} {suggestion.is_acted_upon && (
✓ Ausgeführt
)}
); }