From c18275bf9b61d78402c81899f2bec88cfe21280d Mon Sep 17 00:00:00 2001 From: iamkiddy Date: Thu, 4 Dec 2025 19:44:27 +0000 Subject: [PATCH 1/2] Update Navbar component to conditionally render Dashboard links based on user roles and current route. This enhancement improves navigation clarity for authenticated users by preventing duplicate links in the Navbar. --- components/Navbar.tsx | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 671db62..4e430f1 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -23,7 +23,9 @@ export function Navbar() { const router = useRouter(); const pathname = usePathname(); const isUserDashboard = pathname?.startsWith("/user/dashboard"); + const isAdminDashboard = pathname?.startsWith("/admin/dashboard"); const isUserSettings = pathname?.startsWith("/user/settings"); + const isAdminSettings = pathname?.startsWith("/admin/settings"); const isUserRoute = pathname?.startsWith("/user/"); const { isAuthenticated, logout, user, isAdmin } = useAuth(); @@ -140,13 +142,15 @@ export function Navbar() { )} {isAuthenticated && ( <> - - - Dashboard - + {!(isUserDashboard || isAdminDashboard || isUserSettings || isAdminSettings) && ( + + + Dashboard + + )}