diff --git a/frontend/app.js b/frontend/app.js index ce0bf92..27e9f6c 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -330,6 +330,7 @@ li.addEventListener("click", () => { const input = document.getElementById("search-input"); input.value = entry; + input.dispatchEvent(new Event('input', { bubbles: true })); this.hide(); _triggerAdvancedSearch(entry); }); @@ -391,6 +392,7 @@ } else { input.value = (current ? current + " " : "") + "tag:" + item.tag + " "; } + input.dispatchEvent(new Event('input', { bubbles: true })); this.hide(); input.focus(); _triggerAdvancedSearch(input.value); @@ -944,17 +946,22 @@ } userMenu.innerHTML = '' + (user.display_name || user.username) + '' + - (user.role === 'admin' - ? '' - : '') + ''; safeCreateIcons(); const logoutBtn = document.getElementById('logout-btn'); if (logoutBtn) logoutBtn.addEventListener('click', () => AuthManager.logout()); - const adminBtn = document.getElementById('admin-btn'); - if (adminBtn) adminBtn.addEventListener('click', () => AdminPanel.show()); + const adminRow = document.getElementById('admin-menu-row'); + if (adminRow) { + if (user.role === 'admin') { + adminRow.classList.remove('hidden'); + // Important: use an inline function to ensure we don't bind multiple identical listeners on rerenders, or clean up before + adminRow.onclick = () => { closeHeaderMenu(); AdminPanel.show(); }; + } else { + adminRow.classList.add('hidden'); + } + } }, // ── Initialization ────────────────────────────────────────────── @@ -3862,6 +3869,10 @@ panel.remove(); return; } + // Auto reconnect if disconnected when user opens the panel + if (IndexUpdateManager.getState() === "disconnected") { + IndexUpdateManager.connect(); + } panel = document.createElement("div"); panel.id = "sync-panel"; panel.className = "sync-panel"; diff --git a/frontend/index.html b/frontend/index.html index 0a0c65b..f252ab7 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -212,6 +212,15 @@ Clair +