From 10fa6704eeb847b8fb1c61a455fdf9a91b653272 Mon Sep 17 00:00:00 2001 From: ADARSH <64017655+0x0806@users.noreply.github.com> Date: Sat, 5 Jul 2025 22:54:21 +0530 Subject: [PATCH] Update index.html --- index.html | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index b0f8566..252602e 100644 --- a/index.html +++ b/index.html @@ -1613,7 +1613,7 @@ this.bindEvents(); this.handleResize(); await this.loadFileStructure(); - this.updateStats(); + this.filterAndRenderFiles(); this.renderCurrentView(); } @@ -1755,6 +1755,8 @@ if (this.allFiles.length === 0) { console.warn('No files found from server'); this.showNotification('No markdown files found', 'warning'); + } else { + this.showNotification(`Successfully loaded ${this.allFiles.length} files`); } } else { console.error('Failed to load file data from server:', response.status); @@ -1765,6 +1767,7 @@ this.populateFolderFilter(); this.populateFolderNavigation(); this.filteredFiles = [...this.allFiles]; + this.updateStats(); } catch (error) { console.error('Error loading file structure from server:', error); @@ -1919,6 +1922,16 @@ const folderChart = document.getElementById('folderChart'); if (!folderChart) return; + if (this.allFiles.length === 0) { + folderChart.innerHTML = ` +
+ +

No folders found

+
+ `; + return; + } + const folders = [...new Set(this.allFiles.map(file => file.folder))].sort(); folderChart.innerHTML = ''; @@ -2152,16 +2165,22 @@ console.log('File loaded successfully from server:', filePath); this.fileContents.set(filePath, content); } else { - console.error('Error loading file from server:', response.status); - throw new Error(`Server error: ${response.status}`); + const errorText = await response.text(); + console.error('Error loading file from server:', response.status, errorText); + throw new Error(`Server error: ${response.status} - ${errorText}`); } } + if (!content) { + throw new Error('File content is empty'); + } + this.showModal(filePath, content); } catch (error) { console.error('Error loading file:', error); - this.showModal(filePath, 'Error loading file content: ' + error.message); + this.showNotification(`Failed to load file: ${error.message}`, 'error'); + this.showModal(filePath, `Error loading file content: ${error.message}`); } finally { this.showLoading(false); }