fix: conflit showProgressBar/hideProgressBar/showWelcome — doublons locaux vs imports dans legacy.js
This commit is contained in:
+1
-131
@@ -29,22 +29,9 @@ export { initSidebarTabs, initConfigModal, initHelpModal, initRecentTab } from '
|
||||
export { initSyncStatus } from './sync.js';
|
||||
export { DashboardRecentWidget } from './dashboard.js';
|
||||
|
||||
// =========================================================================
|
||||
// Progress bar helpers (used by showWelcome)
|
||||
// =========================================================================
|
||||
|
||||
function showProgressBar() {
|
||||
const bar = document.getElementById("search-progress-bar");
|
||||
if (bar) bar.classList.add("active");
|
||||
}
|
||||
|
||||
function hideProgressBar() {
|
||||
const bar = document.getElementById("search-progress-bar");
|
||||
if (bar) bar.classList.remove("active");
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// loadVaultSettings
|
||||
// Helpers
|
||||
// =========================================================================
|
||||
|
||||
async function loadVaultSettings() {
|
||||
@@ -308,123 +295,6 @@ function initSearch() {
|
||||
});
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// showWelcome
|
||||
// =========================================================================
|
||||
|
||||
function showWelcome() {
|
||||
hideProgressBar();
|
||||
|
||||
// Restore or rebuild the dashboard with tabbed sections
|
||||
const area = document.getElementById("content-area");
|
||||
const home = document.getElementById("dashboard-home");
|
||||
|
||||
if (area && !home) {
|
||||
area.innerHTML = `
|
||||
<div id="dashboard-home" class="dashboard-home" role="region" aria-label="Tableau de bord">
|
||||
<!-- Dashboard Tabs -->
|
||||
<div class="dashboard-tabs">
|
||||
<button class="dashboard-tab active" data-tab="stats">
|
||||
<i data-lucide="bar-chart-3" style="width:14px;height:14px"></i> Statistiques
|
||||
</button>
|
||||
<button class="dashboard-tab" data-tab="bookmarks">
|
||||
<i data-lucide="bookmark" style="width:14px;height:14px"></i> Bookmarks
|
||||
</button>
|
||||
<button class="dashboard-tab" data-tab="recent">
|
||||
<i data-lucide="clock" style="width:14px;height:14px"></i> Récents
|
||||
</button>
|
||||
<button class="dashboard-tab" data-tab="shared">
|
||||
<i data-lucide="share-2" style="width:14px;height:14px"></i> Partagés
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Stats Panel -->
|
||||
<div id="dashboard-panel-stats" class="dashboard-panel active">
|
||||
<div id="dashboard-stats-grid" class="dashboard-stats-grid">
|
||||
<div class="dashboard-stats-loading">Chargement...</div>
|
||||
</div>
|
||||
<div id="dashboard-conflicts-container" style="margin-top:16px"></div>
|
||||
</div>
|
||||
|
||||
<!-- Bookmarks Panel -->
|
||||
<div id="dashboard-panel-bookmarks" class="dashboard-panel">
|
||||
<div id="dashboard-bookmarks-grid" class="dashboard-recent-grid"></div>
|
||||
<div id="dashboard-bookmarks-empty" class="dashboard-recent-empty">
|
||||
<i data-lucide="pin"></i>
|
||||
<span>Aucun bookmark</span>
|
||||
<p>Épinglez des fichiers pour les retrouver ici.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Recent Panel -->
|
||||
<div id="dashboard-panel-recent" class="dashboard-panel">
|
||||
<div class="dashboard-header">
|
||||
<div class="dashboard-title-row">
|
||||
<span id="dashboard-count" class="dashboard-badge"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dashboard-recent-grid" class="dashboard-recent-grid"></div>
|
||||
<div id="dashboard-loading" class="dashboard-loading">
|
||||
<div class="skeleton-card"></div><div class="skeleton-card"></div><div class="skeleton-card"></div>
|
||||
<div class="skeleton-card"></div><div class="skeleton-card"></div><div class="skeleton-card"></div>
|
||||
</div>
|
||||
<div id="dashboard-recent-empty" class="dashboard-recent-empty hidden">
|
||||
<i data-lucide="inbox"></i>
|
||||
<span>Aucun fichier récent</span>
|
||||
<p>Ouvrez un fichier pour le voir apparaître ici</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shared Panel -->
|
||||
<div id="dashboard-panel-shared" class="dashboard-panel">
|
||||
<div id="dashboard-shared-grid" class="dashboard-recent-grid"></div>
|
||||
<div id="dashboard-shared-empty" class="dashboard-recent-empty">
|
||||
<i data-lucide="share-2"></i>
|
||||
<span>Aucun document partagé</span>
|
||||
<p>Partagez un document pour le voir apparaître ici</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
// Re-initialize widgets and dashboard tabs
|
||||
DashboardRecentWidget.init();
|
||||
initDashboardTabs();
|
||||
safeCreateIcons();
|
||||
} else if (home) {
|
||||
// Dashboard already exists, show it with default tab
|
||||
home.style.display = "";
|
||||
// Reset tabs to default
|
||||
document.querySelectorAll(".dashboard-tab").forEach(t => t.classList.remove("active"));
|
||||
document.querySelectorAll(".dashboard-panel").forEach(p => p.classList.remove("active"));
|
||||
const defaultTab = document.querySelector('.dashboard-tab[data-tab="stats"]');
|
||||
const defaultPanel = document.getElementById("dashboard-panel-stats");
|
||||
if (defaultTab) defaultTab.classList.add("active");
|
||||
if (defaultPanel) defaultPanel.classList.add("active");
|
||||
}
|
||||
|
||||
// Load all widgets (they handle missing elements gracefully)
|
||||
if (typeof DashboardStatsWidget !== "undefined") {
|
||||
DashboardStatsWidget.load();
|
||||
}
|
||||
if (typeof DashboardConflictsWidget !== "undefined") {
|
||||
DashboardConflictsWidget.load();
|
||||
}
|
||||
DashboardRecentWidget.load(state.selectedContextVault);
|
||||
if (typeof DashboardBookmarkWidget !== "undefined") {
|
||||
DashboardBookmarkWidget.load(state.selectedContextVault);
|
||||
}
|
||||
if (typeof DashboardSharedWidget !== "undefined") {
|
||||
DashboardSharedWidget.load();
|
||||
}
|
||||
|
||||
// Load saved searches sidebar
|
||||
loadSavedSearches();
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// goHome
|
||||
// =========================================================================
|
||||
|
||||
function goHome() {
|
||||
const searchInput = document.getElementById("search-input");
|
||||
if (searchInput) searchInput.value = "";
|
||||
|
||||
Reference in New Issue
Block a user