1- import { useMemo } from 'react'
2- import { AlertCircle , CheckCircle2 } from 'lucide-react'
1+ import { useMemo , useState } from 'react'
2+ import { AlertCircle , CheckCircle2 , ChevronDown , ChevronUp } from 'lucide-react'
33import { cn } from '@/lib/utils'
44import { useComponentStore } from '@/store/componentStore'
55import { getNodeValidationWarnings } from '@/utils/connectionValidation'
@@ -19,13 +19,16 @@ interface ValidationDockProps {
1919 onNodeClick : ( nodeId : string ) => void
2020}
2121
22+ const COLLAPSE_THRESHOLD = 3 // Collapse when more than 3 issues
23+
2224export function ValidationDock ( {
2325 nodes,
2426 edges,
2527 mode,
2628 onNodeClick,
2729} : ValidationDockProps ) {
2830 const { getComponent } = useComponentStore ( )
31+ const [ isExpanded , setIsExpanded ] = useState ( false )
2932
3033 // Only show validation in design mode
3134 const isDesignMode = mode === 'design'
@@ -60,6 +63,7 @@ export function ValidationDock({
6063
6164 const totalIssues = validationIssues . length
6265 const hasIssues = totalIssues > 0
66+ const shouldCollapse = totalIssues > COLLAPSE_THRESHOLD
6367
6468 // Don't show dock if not in design mode
6569 if ( ! isDesignMode ) {
@@ -82,13 +86,38 @@ export function ValidationDock({
8286 >
8387 { hasIssues ? (
8488 < >
85- < div className = "flex items-center gap-2 px-2.5 py-1.5 border-b border-border/50" >
86- < AlertCircle className = "h-3 w-3 text-red-500 shrink-0" />
87- < span className = "text-[11px] font-medium" >
88- { totalIssues } { totalIssues === 1 ? 'issue' : 'issues' }
89- </ span >
90- </ div >
91- < div className = "divide-y divide-border/50" >
89+ < button
90+ type = "button"
91+ onClick = { ( ) => shouldCollapse && setIsExpanded ( ! isExpanded ) }
92+ className = { cn (
93+ 'w-full flex items-center justify-between gap-2 px-2.5 py-1.5 border-b border-border/50' ,
94+ shouldCollapse && 'cursor-pointer hover:bg-muted/50 transition-colors'
95+ ) }
96+ >
97+ < div className = "flex items-center gap-2" >
98+ < AlertCircle className = "h-3 w-3 text-red-500 shrink-0" />
99+ < span className = "text-[11px] font-medium" >
100+ { totalIssues } { totalIssues === 1 ? 'issue' : 'issues' }
101+ </ span >
102+ </ div >
103+ { shouldCollapse && (
104+ < div className = "flex items-center gap-1 text-muted-foreground" >
105+ < span className = "text-[10px]" > { isExpanded ? 'Collapse' : 'Expand' } </ span >
106+ { isExpanded ? (
107+ < ChevronDown className = "h-3 w-3" />
108+ ) : (
109+ < ChevronUp className = "h-3 w-3" />
110+ ) }
111+ </ div >
112+ ) }
113+ </ button >
114+ < div
115+ className = { cn (
116+ 'divide-y divide-border/50 overflow-hidden transition-all duration-200' ,
117+ shouldCollapse && ! isExpanded && 'max-h-0' ,
118+ ( ! shouldCollapse || isExpanded ) && 'max-h-[300px] overflow-y-auto'
119+ ) }
120+ >
92121 { validationIssues . map ( ( issue , index ) => (
93122 < button
94123 key = { `${ issue . nodeId } -${ index } ` }
0 commit comments