feat: replace account actions with menu

This commit is contained in:
2026-07-29 23:25:49 -04:00
parent 089ee6916f
commit 8f82000e31
3 changed files with 1356 additions and 380 deletions
+1282 -304
View File
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -53,10 +53,13 @@
<button id="btn-load" type="button" class="ghost-btn">Load</button> <button id="btn-load" type="button" class="ghost-btn">Load</button>
<input id="file-load" type="file" accept="application/json" /> <input id="file-load" type="file" accept="application/json" />
<button id="btn-save" type="button" class="ghost-btn">Download</button> <button id="btn-save" type="button" class="ghost-btn">Download</button>
<button id="btn-admin" type="button" class="ghost-btn hidden"> <details class="account-menu">
Admin <summary class="ghost-btn">Account</summary>
</button> <div class="account-menu-popover">
<button id="btn-logout" type="button" class="ghost-btn">Log out</button> <a id="menu-admin" class="hidden" href="/admin">Admin</a>
<button id="btn-logout" type="button">Log out</button>
</div>
</details>
<button id="btn-print" type="button" class="primary-btn">Print</button> <button id="btn-print" type="button" class="primary-btn">Print</button>
<span class="autosave-chip" id="autosave-status" <span class="autosave-chip" id="autosave-status"
><span class="dot"></span ><span class="dot"></span
+2 -7
View File
@@ -690,13 +690,8 @@ async function init() {
fetch("/api/auth/me") fetch("/api/auth/me")
.then((r) => (r.ok ? r.json() : null)) .then((r) => (r.ok ? r.json() : null))
.then((body) => { .then((body) => {
if (body?.user?.role === "admin") { if (body?.user?.role === "admin")
const button = document.getElementById("btn-admin"); document.getElementById("menu-admin").classList.remove("hidden");
button.classList.remove("hidden");
button.onclick = () => {
location.href = "/admin";
};
}
}) })
.catch(() => {}); .catch(() => {});
initPrefillPanel({ initPrefillPanel({