From 09a7dd353dbb5b5fe140b21272a82f8fd3a3557a Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 8 Oct 2026 00:46:05 +0000 Subject: [PATCH] Update static/js/04-main.js --- static/js/04-main.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/static/js/04-main.js b/static/js/04-main.js index afab36f..4ec49f2 100644 --- a/static/js/04-main.js +++ b/static/js/04-main.js @@ -2,6 +2,31 @@ "use strict"; window.Glow = window.Glow || {}; +Glow.presenceModeLabel = mode => { + switch (String(mode || "").toLowerCase()) { + case "silent": + return "silent"; + case "focus": + return "focus"; + case "dnd": + return "do not disturb"; + default: + return "online"; + } +}; + +const originalUpdateAuthUI = Glow.updateAuthUI; +Glow.updateAuthUI = () => { + if (typeof originalUpdateAuthUI === "function") { + originalUpdateAuthUI(); + } + const user = Glow.state.currentUser; + if (user && Glow.els.headerAccount) { + const mode = Glow.presenceModeLabel(user.presence_mode); + Glow.els.headerAccount.textContent = `${user.username} · ${user.role} · ${mode}`; + } +}; + Glow.loadRooms = async () => { const previousSlug = Glow.state.activeRoom?.slug; const data = await Glow.apiRequest("/api/rooms");