From fc4d30285e836d2850bda16a5ebff7c61f301f84 Mon Sep 17 00:00:00 2001 From: Pranav Pillai Date: Sun, 26 Apr 2026 18:30:35 -0500 Subject: [PATCH] Remove notifications and user profile from header --- components/layout/Header.tsx | 144 +---------------------------------- 1 file changed, 1 insertion(+), 143 deletions(-) diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index 2d77d90..4ae7f66 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -1,60 +1,12 @@ "use client"; import Link from "next/link"; -import { useRouter } from "next/navigation"; -import { useEffect, useMemo, useRef, useState } from "react"; -import { apiFetch } from "@/lib/api"; -import type { AlertListResponse, AlertItem } from "@/lib/types/alert"; import { useSidebar } from "./SidebarContext"; -import { useNotifications } from "./NotificationContext"; import { useTheme } from "./ThemeContext"; -import { User, Settings, Info, ChevronDown, Bell } from "lucide-react"; export function Header() { - const router = useRouter(); const { compactMode, toggle } = useSidebar(); - const { notifHighRisk, notifMediumRisk } = useNotifications(); const { isDark, toggle: toggleTheme } = useTheme(); - const [isProfileOpen, setIsProfileOpen] = useState(false); - const [isBellOpen, setIsBellOpen] = useState(false); - const [allAlerts, setAllAlerts] = useState([]); - - useEffect(() => { - apiFetch("/alerts") - .then((res) => setAllAlerts(res.data)) - .catch(() => {}); - }, []); - - function handleGoToAlerts() { - setIsBellOpen(false); - router.push("/alerts-settings"); - } - - const visibleNarratives = useMemo(() => { - return allAlerts.filter((n) => { - if (n.risk_level === "High" && notifHighRisk) return true; - if (n.risk_level === "Medium" && notifMediumRisk) return true; - return false; - }); - }, [allAlerts, notifHighRisk, notifMediumRisk]); - - const badgeCount = visibleNarratives.length; - - const profileWrapRef = useRef(null); - const bellWrapRef = useRef(null); - - useEffect(() => { - function onPointerDown(e: PointerEvent) { - if (profileWrapRef.current && e.target instanceof Node && !profileWrapRef.current.contains(e.target)) { - setIsProfileOpen(false); - } - if (bellWrapRef.current && e.target instanceof Node && !bellWrapRef.current.contains(e.target)) { - setIsBellOpen(false); - } - } - document.addEventListener("pointerdown", onPointerDown); - return () => document.removeEventListener("pointerdown", onPointerDown); - }, []); return (
@@ -83,10 +35,8 @@ export function Header() { - {/* Right: Theme toggle + Notifications + Profile */} + {/* Right: Theme toggle ONLY */}
- - {/* Sun / Moon toggle */} - -
- - - {isBellOpen && ( -
-
-

Notifications

-

{badgeCount} narrative alert{badgeCount !== 1 ? "s" : ""} detected

-
-
- {visibleNarratives.length === 0 ? ( -

No active alerts

- ) : visibleNarratives.map((n) => ( -
- -
-

{n.title}

-

{n.description}

-
-
- ))} -
-
- -
-
- )} -
- - {/* Profile Dropdown */} -
- - - {isProfileOpen && ( -
-
-

Signed in as

-

admin@cs4485.com

-
- -
- -
- -
- -
- -
-
- )} -
);