feat: replace account actions with menu
This commit is contained in:
+1347
-369
File diff suppressed because it is too large
Load Diff
+7
-4
@@ -53,10 +53,13 @@
|
||||
<button id="btn-load" type="button" class="ghost-btn">Load</button>
|
||||
<input id="file-load" type="file" accept="application/json" />
|
||||
<button id="btn-save" type="button" class="ghost-btn">Download</button>
|
||||
<button id="btn-admin" type="button" class="ghost-btn hidden">
|
||||
Admin
|
||||
</button>
|
||||
<button id="btn-logout" type="button" class="ghost-btn">Log out</button>
|
||||
<details class="account-menu">
|
||||
<summary class="ghost-btn">Account</summary>
|
||||
<div class="account-menu-popover">
|
||||
<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>
|
||||
<span class="autosave-chip" id="autosave-status"
|
||||
><span class="dot"></span
|
||||
|
||||
+2
-7
@@ -690,13 +690,8 @@ async function init() {
|
||||
fetch("/api/auth/me")
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((body) => {
|
||||
if (body?.user?.role === "admin") {
|
||||
const button = document.getElementById("btn-admin");
|
||||
button.classList.remove("hidden");
|
||||
button.onclick = () => {
|
||||
location.href = "/admin";
|
||||
};
|
||||
}
|
||||
if (body?.user?.role === "admin")
|
||||
document.getElementById("menu-admin").classList.remove("hidden");
|
||||
})
|
||||
.catch(() => {});
|
||||
initPrefillPanel({
|
||||
|
||||
Reference in New Issue
Block a user