diff --git a/src/components/DashboardShell.tsx b/src/components/DashboardShell.tsx index ea9e86d..4d37322 100644 --- a/src/components/DashboardShell.tsx +++ b/src/components/DashboardShell.tsx @@ -3,8 +3,9 @@ * Used for pages that need actual backend connectivity * (My Profile, My Portfolio, Verification) instead of the preview mock. */ -import { For, JSX, Show, createMemo, createSignal, onMount } from "solid-js"; +import { For, JSX, createMemo } from "solid-js"; import { AiChatWidget } from "./AiChatWidget"; +import NotificationBell from "./NotificationBell"; import { User, Briefcase, @@ -101,36 +102,6 @@ export default function DashboardShell(props: Props) { return k.charAt(0).toUpperCase() + k.slice(1).toLowerCase(); }); - const [unreadCount, setUnreadCount] = createSignal(0); - - // Fetch unread notification count - const fetchUnreadCount = async () => { - try { - const token = - typeof window !== "undefined" - ? window.sessionStorage.getItem("nxtgauge_access_token") || "" - : ""; - 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); - }); - return (
- +
-
+
0} fallback={ -
-

🔔

-

No notifications yet

+
+
+ + + +
+

No notifications yet

+

We will show updates here when they arrive.

} > {notifications().map((notification) => (
{ if (!notification.is_read) { @@ -153,20 +172,20 @@ export default function NotificationBell() { >
{/* Unread Dot */} -
+
-

+

{notification.title}

-

{notification.body}

-

+

{notification.body}

+

{formatTime(notification.created_at)}

@@ -176,10 +195,11 @@ export default function NotificationBell() {
-