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-red-400/30 bg-red-400/5'
: 'border-yellow-400/30 bg-yellow-400/5'
)}
>
{/* Header */}
{/* Error/Warning List */}
{isExpanded && (
{/* Errors */}
{errorItems.map((error, index) => (
))}
{/* Warnings */}
{warningItems.map((warning, index) => (
))}
)}
)
}