refactor(admin): generalize breadcrumb fallback to handle unknown single-segment routes
This commit is contained in:
@@ -54,17 +54,15 @@ const AdminTop = ({ isMobileMenuOpen, setIsMobileMenuOpen, user, onLogout, appNa
|
||||
return crumbs;
|
||||
}
|
||||
|
||||
if (first === 'profile') {
|
||||
crumbs.push({ label: pageTitle });
|
||||
return crumbs;
|
||||
}
|
||||
|
||||
const allItems = navigationSections.flatMap(s => s.items);
|
||||
const navItem = allItems.find(item => item.href.replace('/admin/', '').split('/')[0] === first);
|
||||
const hasSubPage = segments.length > 1;
|
||||
|
||||
if (navItem) {
|
||||
crumbs.push({ label: navItem.name, href: hasSubPage ? navItem.href : undefined });
|
||||
} else if (!hasSubPage) {
|
||||
crumbs.push({ label: pageTitle });
|
||||
return crumbs;
|
||||
}
|
||||
|
||||
if (second === 'new') {
|
||||
|
||||
Reference in New Issue
Block a user