@@ -5,7 +5,7 @@ import { useUiMessages } from "../lib/i18n";
55
66interface SidebarProps {
77 nodes : GraphNode [ ] ;
8- onSelectPath : ( path : string , nodeIds : Set < number > ) => void ;
8+ onSelectPath : ( path : string , nodeIds : Set < number > , node ?: GraphNode ) => void ;
99 selectedPath : string | null ;
1010}
1111
@@ -61,7 +61,7 @@ function flattenSingleChild(dir: DirNode): DirNode {
6161
6262function TreeItem ( { dir, depth, onSelect, selectedPath } : {
6363 dir : DirNode ; depth : number ;
64- onSelect : ( path : string , ids : Set < number > ) => void ;
64+ onSelect : ( path : string , ids : Set < number > , node ?: GraphNode ) => void ;
6565 selectedPath : string | null ;
6666} ) {
6767 const [ expanded , setExpanded ] = useState ( false ) ;
@@ -72,7 +72,7 @@ function TreeItem({ dir, depth, onSelect, selectedPath }: {
7272 return (
7373 < div >
7474 < button
75- onClick = { ( ) => { setExpanded ( ! expanded ) ; onSelect ( dir . fullPath , dir . nodeIds ) ; } }
75+ onClick = { ( ) => { setExpanded ( ! expanded ) ; onSelect ( dir . fullPath , dir . nodeIds , undefined ) ; } }
7676 className = { `flex items-center gap-1.5 w-full text-left px-3 py-[5px] text-[12px] transition-colors ${
7777 isSelected ? "bg-primary/10 text-primary" : "text-foreground/60 hover:text-foreground/80 hover:bg-white/[0.03]"
7878 } `}
@@ -90,7 +90,7 @@ function TreeItem({ dir, depth, onSelect, selectedPath }: {
9090 { sortedNodes . map ( ( gn ) => (
9191 < button
9292 key = { gn . id }
93- onClick = { ( ) => onSelect ( dir . fullPath + "/" + gn . name , new Set ( [ gn . id ] ) ) }
93+ onClick = { ( ) => onSelect ( dir . fullPath + "/" + gn . name , new Set ( [ gn . id ] ) , gn ) }
9494 className = "flex items-center gap-1.5 w-full text-left px-3 py-[3px] text-[11px] text-foreground/40 hover:text-foreground/60 hover:bg-white/[0.02] transition-colors"
9595 style = { { paddingLeft : `${ ( depth + 1 ) * 16 + 12 } px` } }
9696 >
@@ -148,7 +148,7 @@ export function Sidebar({ nodes, onSelectPath, selectedPath }: SidebarProps) {
148148 filtered . map ( ( n ) => (
149149 < button
150150 key = { n . id }
151- onClick = { ( ) => onSelectPath ( n . file_path ?? "" , new Set ( [ n . id ] ) ) }
151+ onClick = { ( ) => onSelectPath ( n . file_path ?? "" , new Set ( [ n . id ] ) , n ) }
152152 className = "flex items-center gap-2 w-full text-left px-4 py-1.5 text-[11px] hover:bg-white/[0.03] transition-colors"
153153 >
154154 < span className = "w-[5px] h-[5px] rounded-full shrink-0" style = { { backgroundColor : n . color } } />
0 commit comments