From 7a0bd5424c10574a55f937236ee1bbea600627f3 Mon Sep 17 00:00:00 2001 From: hyunho Date: Wed, 25 Mar 2026 13:59:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=ED=8C=9D=EC=98=A4=EB=B2=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/public/app.js | 45 +++++++++++++++++++++++++++++++++++++- frontend/public/index.html | 1 + frontend/public/styles.css | 35 +++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/frontend/public/app.js b/frontend/public/app.js index a262f4c..fc86aa7 100755 --- a/frontend/public/app.js +++ b/frontend/public/app.js @@ -6,6 +6,7 @@ const loginForm = document.getElementById("login-form"); const loginMessage = document.getElementById("login-message"); const logoutBtn = document.getElementById("logout-btn"); const userBadge = document.getElementById("user-badge"); +const userPopover = document.getElementById("user-popover"); const currentViewTitle = document.getElementById("current-view-title"); const navButtons = Array.from(document.querySelectorAll(".header-center [data-view]")); const organizationFrame = document.getElementById("organization-frame"); @@ -37,6 +38,14 @@ function clearSession() { sessionStorage.removeItem(sessionKey); } +function hideUserPopover() { + userPopover?.classList.add("hidden"); +} + +function toggleUserPopover() { + userPopover?.classList.toggle("hidden"); +} + function setActiveView(view) { const previousView = currentView; currentView = view in viewLabels ? view : "organization"; @@ -71,8 +80,29 @@ function renderAuth() { dashboardPanel.classList.toggle("hidden", !authenticated); if (authenticated) { const displayName = session.user.display_name || "접속자"; - userBadge.innerHTML = `${displayName}-`; + const rank = "-"; + userBadge.innerHTML = `${displayName}${rank}`; userBadge.title = `${displayName} / -`; + if (userPopover) { + userPopover.innerHTML = ` +
+ 이름 + ${displayName} +
+
+ 직급 + ${rank} +
+
+ 권한 + ${session.user.role || "-"} +
+
+ 아이디 + ${session.user.username || "-"} +
+ `; + } } } @@ -100,15 +130,28 @@ if (loginForm) { if (logoutBtn) { logoutBtn.addEventListener("click", () => { clearSession(); + hideUserPopover(); renderAuth(); }); } +if (userBadge) { + userBadge.addEventListener("click", (event) => { + event.stopPropagation(); + toggleUserPopover(); + }); +} + navButtons.forEach((button) => { button.addEventListener("click", () => { + hideUserPopover(); setActiveView(button.dataset.view || "organization"); }); }); +document.addEventListener("click", () => { + hideUserPopover(); +}); + setActiveView(currentView); renderAuth(); diff --git a/frontend/public/index.html b/frontend/public/index.html index 2c1b438..07b37f5 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -51,6 +51,7 @@
+