diff --git a/src/components/admin/DashboardDesignPreview.tsx b/src/components/admin/DashboardDesignPreview.tsx index 1f89d1f..e73d9b7 100644 --- a/src/components/admin/DashboardDesignPreview.tsx +++ b/src/components/admin/DashboardDesignPreview.tsx @@ -1041,6 +1041,32 @@ export default function DashboardDesignPreview(props: { }) { const [isVerified, setIsVerified] = createSignal(false); const [verificationPending, setVerificationPending] = createSignal(false); + const [unreadCount, setUnreadCount] = createSignal(0); + + // Fetch unread notification count + const fetchUnreadCount = async () => { + try { + const token = getToken(); + if (!token) return; + const res = await fetch('/api/me/notifications/unread-count', { + headers: { Authorization: `Bearer ${token}` }, + credentials: 'include', + }); + if (res.ok) { + const data = await res.json(); + setUnreadCount(data.unread_count || 0); + } + } catch (e) { + console.error('Failed to fetch unread count:', e); + } + }; + + // Start polling on mount + onMount(() => { + fetchUnreadCount(); + const interval = setInterval(fetchUnreadCount, 30000); + return () => clearInterval(interval); + }); const isProfessionalRoleKey = (roleKey: string) => { const role = normalizeRoleKey(roleKey); @@ -6657,7 +6683,12 @@ export default function DashboardDesignPreview(props: {