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>
|
<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
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user