Admin view in the web UI

This commit is contained in:
Ian Gulliver
2026-10-14 21:06:30 -07:00
parent b2bd894677
commit 4a2bbe0859
34 changed files with 838 additions and 214 deletions
+5 -3
View File
@@ -1,10 +1,12 @@
import { h, replace } from "./dom.js";
import { activeTasks, findTask, onEach, state } from "./state.js";
export function mountNavbar(root, showInbox) {
export function mountNavbar(root, show) {
const crumb = h("button", { class: "crumb", title: "Switch task (⌘K)" });
crumb.onclick = openSwitcher;
const inbox = h("button", { class: "inbox-count" });
inbox.onclick = showInbox;
inbox.onclick = () => show("inbox");
const admin = h("button", { class: "nav-link" }, "Admin");
admin.onclick = () => show("admin");
const conn = h("span", { class: "connection down", title: "connecting" });
const me = h("span", { class: "me" });
const render = () => {
@@ -19,7 +21,7 @@ export function mountNavbar(root, showInbox) {
replace(me, state.me?.display_name ?? "");
};
onEach(["me", "projects", "tasks", "inbox", "selection", "connection"], render);
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), inbox, conn, me);
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), inbox, admin, conn, me);
render();
addEventListener("keydown", (e) => {
if (e.key === "k" && (e.metaKey || e.ctrlKey)) {