diff --git a/dashboard/app/dashboard/layout.tsx b/dashboard/app/dashboard/layout.tsx index 3b4f83d..f035c5a 100644 --- a/dashboard/app/dashboard/layout.tsx +++ b/dashboard/app/dashboard/layout.tsx @@ -69,9 +69,15 @@ export default function DashboardLayout({ if (status === "unauthenticated") { signIn("discord"); } - - // Fetch global notification + + if (status !== "authenticated") return; + const fetchNotification = async () => { + // Only admins can read admin config — skip for everyone else + if (!isAdmin(session?.user?.id)) { + setGlobalNotification(null); + return; + } try { const config = await api.getAdminConfig(); setGlobalNotification(config.global_notification); @@ -79,8 +85,15 @@ export default function DashboardLayout({ console.error("Failed to fetch notifications:", err); } }; + fetchNotification(); - }, [status]); + + const onBroadcastUpdated = () => { + fetchNotification(); + }; + window.addEventListener("axiom:broadcast-updated", onBroadcastUpdated); + return () => window.removeEventListener("axiom:broadcast-updated", onBroadcastUpdated); + }, [status, session?.user?.id]); if (status === "loading" || status === "unauthenticated") { return ( @@ -367,7 +380,17 @@ export default function DashboardLayout({

Broadcast Metrics

- {/* Stats Grid */}
{statItems.map((stat) => (
@@ -144,9 +174,7 @@ export function AdminContent() { ))}
- {/* System Status Section */}
- {/* API Health */}
@@ -185,7 +213,6 @@ export function AdminContent() {
- {/* Global Config */}
@@ -195,6 +222,7 @@ export function AdminContent() {