From 1326513451ef1cebbc05f284634d9a33a7558576 Mon Sep 17 00:00:00 2001 From: Mengisteab Date: Tue, 16 Jun 2026 08:34:22 +0000 Subject: [PATCH] adding bread crump navigation --- apps/portal/src/app/layouts/PortalLayout.tsx | 79 ++++++++++++++++---- 1 file changed, 65 insertions(+), 14 deletions(-) diff --git a/apps/portal/src/app/layouts/PortalLayout.tsx b/apps/portal/src/app/layouts/PortalLayout.tsx index 2ffd9f214..4f803416a 100644 --- a/apps/portal/src/app/layouts/PortalLayout.tsx +++ b/apps/portal/src/app/layouts/PortalLayout.tsx @@ -1,7 +1,9 @@ import { ActionIcon, + Anchor, AppShell, Burger, + Card, Group, Indicator, Menu, @@ -93,10 +95,15 @@ export function PortalLayout() { const [navOpened, { toggle: toggleNav, close: closeNav }] = useDisclosure(); const [sidebarCollapsed, { toggle: toggleSidebar }] = useDisclosure(false); - const meta = PAGE_META[location.pathname] ?? { - title: 'EMA Portal', - subtitle: 'Ethiopian Maritime Authority', - }; + // Breadcrumb trail: always rooted at "Home", then any matched page segments. + const segments = location.pathname.split('/').filter(Boolean); + const crumbs = [ + { label: 'Home', path: '/dashboard' }, + ...segments + .map((_, i) => '/' + segments.slice(0, i + 1).join('/')) + .filter((path) => PAGE_META[path] && path !== '/dashboard') + .map((path) => ({ label: PAGE_META[path].title, path })), + ]; const go = (item: NavItem) => { if (item.soon) { @@ -122,16 +129,60 @@ export function PortalLayout() { {/* ---- Header ---------------------------------------------------- */} - - -
- - {meta.title} - - - {meta.subtitle} - -
+ + + {/* Mobile: toggle the nav drawer */} + + {/* Desktop: toggle the sidebar collapse */} + + + + {/* Breadcrumbs: Home > … */} + + {crumbs.map((crumb, i) => { + const isLast = i === crumbs.length - 1; + return ( + + {i > 0 && ( + + > + + )} + {isLast ? ( + + {crumb.label} + + ) : ( + navigate(crumb.path)} + style={{ cursor: 'pointer' }} + > + {crumb.label} + + )} + + ); + })} +