This commit is contained in:
estifanos
2026-07-31 07:59:15 +00:00
parent fca732e399
commit b5858c37be

View File

@@ -46,9 +46,14 @@ export function AppSidebar({
}: AppSidebarProps) {
const { t } = useTranslation();
// Prefer an exact `to` match so sibling routes sharing a path prefix
// (e.g. /vessel-registration and /vessel-registration/transfer) don't
// both light up. Prefix matching is the fallback, for sub-pages that
// aren't themselves in the nav (e.g. /vessel-registration/apply).
const exactMatch = navItems.find((i) => i.to === activePath);
const activeNavItem = (item: NavItem) =>
!!item.to &&
(activePath === item.to || activePath.startsWith(`${item.to}/`));
(exactMatch ? item === exactMatch : activePath.startsWith(`${item.to}/`));
return (
<>