From c4d1624e3213d71d275176cefda03b3c2e9b8e80 Mon Sep 17 00:00:00 2001 From: 7JankiPanchal Date: Fri, 27 Feb 2026 22:28:10 +0530 Subject: [PATCH 1/2] Fix navbar duplication and clean routing structure --- src/App.tsx | 2 +- src/components/layout/Navbar.tsx | 187 +++++++++++++++------------ src/contexts/AuthContext.tsx | 111 +++++++--------- src/contexts/NotificationContext.tsx | 77 +++++++++++ src/main.tsx | 7 +- src/pages/Login.tsx | 5 +- 6 files changed, 242 insertions(+), 147 deletions(-) create mode 100644 src/contexts/NotificationContext.tsx diff --git a/src/App.tsx b/src/App.tsx index 03e4b51..913f7d7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -56,7 +56,7 @@ const AppRoutes = () => { return ( <> - {isAuthenticated && } + {/* Public Landing Page / Dashboard */} : } /> diff --git a/src/components/layout/Navbar.tsx b/src/components/layout/Navbar.tsx index b3f18a1..1fac7e1 100644 --- a/src/components/layout/Navbar.tsx +++ b/src/components/layout/Navbar.tsx @@ -12,6 +12,7 @@ import { Settings, Code, Menu, + Bell, } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; @@ -31,16 +32,20 @@ import { } from "@/components/ui/sheet"; import { useTheme } from "@/contexts/ThemeContext"; import { useAuth } from "@/contexts/AuthContext"; +import { useNotifications } from "@/contexts/NotificationContext"; const Navbar: React.FC = () => { const { theme, toggleTheme } = useTheme(); const { user, logout, isAuthenticated } = useAuth(); + const { notifications, unreadCount, markAsRead, markAllAsRead } = + useNotifications(); + const navigate = useNavigate(); const [mobileOpen, setMobileOpen] = useState(false); const handleLogout = () => { logout(); - navigate("/login"); // Redirect after logout + navigate("/login"); }; const mobileNavLinks = [ @@ -53,18 +58,22 @@ const Navbar: React.FC = () => { ]; return ( -