@@ -12,15 +12,10 @@ import {
1212 Database ,
1313 Layers ,
1414 Terminal ,
15- Brain ,
16- Shield ,
1715 Cog ,
1816 BookOpen ,
19- Play ,
2017 ArrowLeft ,
21- ExternalLink ,
2218 ChevronDown ,
23- Sparkles ,
2419} from 'lucide-react'
2520import Editor from '@monaco-editor/react'
2621import { codebaseApi } from '@/api/client'
@@ -151,10 +146,31 @@ export function CodebaseExplorerPage() {
151146 enabled : ! ! selectedFile ,
152147 } )
153148
154- // Get module node from tree
155- const getModuleNode = useCallback ( ( moduleName : string ) : ModuleNode | null => {
149+ // Get module node from tree - supports nested paths like "modules/rl"
150+ const getModuleNode = useCallback ( ( modulePath : string ) : ModuleNode | null => {
156151 if ( ! tree ) return null
157- return tree . root . children . find ( c => c . name === moduleName ) || null
152+
153+ // Helper to recursively find a node by its full path
154+ const findNode = ( node : ModuleNode , targetPath : string ) : ModuleNode | null => {
155+ const fullPath = node . path . replace ( 'fusion/' , '' )
156+ if ( fullPath === targetPath ) return node
157+ for ( const child of node . children ) {
158+ const found = findNode ( child , targetPath )
159+ if ( found ) return found
160+ }
161+ return null
162+ }
163+
164+ // First try direct child lookup for top-level modules
165+ const directChild = tree . root . children . find ( c => c . name === modulePath )
166+ if ( directChild ) return directChild
167+
168+ // Otherwise search recursively for nested paths
169+ for ( const child of tree . root . children ) {
170+ const found = findNode ( child , modulePath )
171+ if ( found ) return found
172+ }
173+ return null
158174 } , [ tree ] )
159175
160176 const selectedModuleNode = selectedModule ? getModuleNode ( selectedModule ) : null
@@ -289,7 +305,6 @@ export function CodebaseExplorerPage() {
289305 onClick = { startTour }
290306 className = "flex items-center gap-2 rounded-lg bg-fusion-600 px-4 py-2 text-sm font-medium text-white hover:bg-fusion-700"
291307 >
292- < Sparkles className = "h-4 w-4" />
293308 Take a Tour
294309 </ button >
295310 ) }
@@ -437,29 +452,35 @@ export function CodebaseExplorerPage() {
437452 ) }
438453
439454 { /* Module View */ }
440- { viewMode === 'module' && selectedModuleNode && moduleInfo && (
455+ { viewMode === 'module' && selectedModuleNode && (
441456 < div >
442457 { /* Module Header Card */ }
443- < div className = { `mb-6 rounded-xl border-2 p-6 ${ moduleInfo . bgColor } ` } >
458+ < div className = { `mb-6 rounded-xl border-2 p-6 ${ moduleInfo ? .bgColor || 'bg-gray-50 dark:bg-gray-800 border-gray-200 dark:border-gray-700' } ` } >
444459 < div className = "flex items-start gap-4" >
445- < moduleInfo . icon className = { `h-12 w-12 ${ moduleInfo . color } ` } />
460+ { moduleInfo ? (
461+ < moduleInfo . icon className = { `h-12 w-12 ${ moduleInfo . color } ` } />
462+ ) : (
463+ < Layers className = "h-12 w-12 text-gray-600" />
464+ ) }
446465 < div className = "flex-1" >
447466 < h2 className = "text-xl font-bold text-gray-900 dark:text-gray-100" >
448- { selectedModule }
467+ { selectedModuleNode . name }
449468 </ h2 >
450469 < p className = "mt-1 text-gray-600 dark:text-gray-300" >
451- { moduleInfo . description }
470+ { moduleInfo ? .description || selectedModuleNode . description || `Explore the ${ selectedModuleNode . name } module` }
452471 </ p >
453- < div className = "mt-3 flex flex-wrap gap-2" >
454- { moduleInfo . highlights . map ( ( h ) => (
455- < span
456- key = { h }
457- className = "rounded-full bg-white/80 px-3 py-1 text-sm font-medium text-gray-700 dark:bg-gray-800/80 dark:text-gray-300"
458- >
459- { h }
460- </ span >
461- ) ) }
462- </ div >
472+ { moduleInfo ?. highlights && (
473+ < div className = "mt-3 flex flex-wrap gap-2" >
474+ { moduleInfo . highlights . map ( ( h ) => (
475+ < span
476+ key = { h }
477+ className = "rounded-full bg-white/80 px-3 py-1 text-sm font-medium text-gray-700 dark:bg-gray-800/80 dark:text-gray-300"
478+ >
479+ { h }
480+ </ span >
481+ ) ) }
482+ </ div >
483+ ) }
463484 </ div >
464485 </ div >
465486 </ div >
0 commit comments