Update index.html

This commit is contained in:
ADARSH 2025-07-05 22:54:21 +05:30 committed by GitHub
parent 59eb888677
commit 10fa6704ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1613,7 +1613,7 @@
this.bindEvents(); this.bindEvents();
this.handleResize(); this.handleResize();
await this.loadFileStructure(); await this.loadFileStructure();
this.updateStats(); this.filterAndRenderFiles();
this.renderCurrentView(); this.renderCurrentView();
} }
@ -1755,6 +1755,8 @@
if (this.allFiles.length === 0) { if (this.allFiles.length === 0) {
console.warn('No files found from server'); console.warn('No files found from server');
this.showNotification('No markdown files found', 'warning'); this.showNotification('No markdown files found', 'warning');
} else {
this.showNotification(`Successfully loaded ${this.allFiles.length} files`);
} }
} else { } else {
console.error('Failed to load file data from server:', response.status); console.error('Failed to load file data from server:', response.status);
@ -1765,6 +1767,7 @@
this.populateFolderFilter(); this.populateFolderFilter();
this.populateFolderNavigation(); this.populateFolderNavigation();
this.filteredFiles = [...this.allFiles]; this.filteredFiles = [...this.allFiles];
this.updateStats();
} catch (error) { } catch (error) {
console.error('Error loading file structure from server:', error); console.error('Error loading file structure from server:', error);
@ -1919,6 +1922,16 @@
const folderChart = document.getElementById('folderChart'); const folderChart = document.getElementById('folderChart');
if (!folderChart) return; if (!folderChart) return;
if (this.allFiles.length === 0) {
folderChart.innerHTML = `
<div style="text-align: center; color: var(--text-muted); padding: 20px;">
<i class="fas fa-folder-open" style="font-size: 24px; margin-bottom: 12px;"></i>
<p>No folders found</p>
</div>
`;
return;
}
const folders = [...new Set(this.allFiles.map(file => file.folder))].sort(); const folders = [...new Set(this.allFiles.map(file => file.folder))].sort();
folderChart.innerHTML = ''; folderChart.innerHTML = '';
@ -2152,16 +2165,22 @@
console.log('File loaded successfully from server:', filePath); console.log('File loaded successfully from server:', filePath);
this.fileContents.set(filePath, content); this.fileContents.set(filePath, content);
} else { } else {
console.error('Error loading file from server:', response.status); const errorText = await response.text();
throw new Error(`Server error: ${response.status}`); 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); this.showModal(filePath, content);
} catch (error) { } catch (error) {
console.error('Error loading file:', 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 { } finally {
this.showLoading(false); this.showLoading(false);
} }