@@ -64,6 +64,7 @@ function getFolderFromTree(pathParts) {
6464 if ( ! tree ) return null ;
6565 if ( pathParts . length === 1 ) return tree ;
6666
67+ // Start searching from index 1 (skip platform name)
6768 const node = findInTree ( tree , pathParts , 1 ) ;
6869 return node ? ( node . children || [ ] ) : null ;
6970}
@@ -78,6 +79,7 @@ function hasFiles(pathParts) {
7879 if ( ! tree ) return false ;
7980 if ( pathParts . length === 1 ) return false ;
8081
82+ // Start searching from index 1 (skip platform name)
8183 const node = findInTree ( tree , pathParts , 1 ) ;
8284 return node ? node . has_files : false ;
8385}
@@ -93,7 +95,8 @@ function countItemsFromTree(pathParts) {
9395 for ( const node of nodes ) {
9496 if ( node . has_files ) {
9597 count ++ ;
96- } else if ( node . children ) {
98+ }
99+ if ( node . children ) {
97100 countRecursive ( node . children ) ;
98101 }
99102 }
@@ -194,6 +197,8 @@ function renderFolder() {
194197 return ;
195198 }
196199
200+ console . log ( 'Rendering folder:' , state . currentPath , 'Items:' , items ) ;
201+
197202 // Set title
198203 const titleParts = state . currentPath . map ( capitalize ) ;
199204 document . getElementById ( 'folder-title' ) . textContent = titleParts . join ( ' / ' ) ;
@@ -213,6 +218,8 @@ function renderFolder() {
213218 const fullPath = [ ...state . currentPath , item . name ] ;
214219 const count = countItemsFromTree ( fullPath ) ;
215220
221+ console . log ( 'Card for' , item . name , 'fullPath:' , fullPath , 'count:' , count , 'has_files:' , item . has_files , 'children:' , item . children ) ;
222+
216223 card . innerHTML = `
217224 <div class="folder-card-title">${ item . name } </div>
218225 <div class="folder-card-path">${ fullPath . join ( '/' ) } </div>
0 commit comments