import { useState } from 'react' import { AlertCircle, AlertTriangle, ChevronDown, ChevronUp } from 'lucide-react' import { cn } from '@/lib/utils' import type { ValidationError } from '@/store/treeEditorStore' interface ValidationSummaryProps { errors: ValidationError[] onSelectNode: (nodeId: string) => void } export function ValidationSummary({ errors, onSelectNode }: ValidationSummaryProps) { const [isExpanded, setIsExpanded] = useState(true) const errorItems = errors.filter(e => e.severity === 'error') const warningItems = errors.filter(e => e.severity === 'warning') if (errors.length === 0) return null const handleErrorClick = (error: ValidationError) => { if (error.nodeId) { onSelectNode(error.nodeId) } } return (
0 ? 'border-destructive/50 bg-destructive/5' : 'border-yellow-500/50 bg-yellow-50 dark:bg-yellow-900/10' )} > {/* Header */} {/* Error/Warning List */} {isExpanded && (
{/* Errors */} {errorItems.map((error, index) => ( ))} {/* Warnings */} {warningItems.map((warning, index) => ( ))}
)}
) }