diff --git a/frontend/src/components/shared/Sidebar.tsx b/frontend/src/components/shared/Sidebar.tsx index d3da998..59a0e17 100644 --- a/frontend/src/components/shared/Sidebar.tsx +++ b/frontend/src/components/shared/Sidebar.tsx @@ -133,10 +133,7 @@ const baseNavigationItems: NavigationItem[] = [ text: 'Issues', icon: , path: '/issues', - subItems: [ - { text: 'Meine Issues', path: '/issues?tab=0' }, - { text: 'Alle Issues', path: '/issues?tab=1' }, - ], + // subItems computed dynamically in navigationItems useMemo permission: 'issues:create', }, ]; @@ -198,10 +195,17 @@ function Sidebar({ mobileOpen, onMobileClose }: SidebarProps) { if (hasPermission('shop:view_overview')) { shopSubItems.push({ text: 'Übersicht', path: `/shop?tab=${shopTabIdx}` }); shopTabIdx++; } shopSubItems.push({ text: 'Katalog', path: `/shop?tab=${shopTabIdx}` }); + // Build Issues sub-items dynamically (tab order must match Issues.tsx) + const issuesSubItems: SubItem[] = [{ text: 'Meine Issues', path: '/issues?tab=0' }]; + if (hasPermission('issues:view_all')) { + issuesSubItems.push({ text: 'Alle Issues', path: '/issues?tab=1' }); + } + const items = baseNavigationItems .map((item) => { if (item.path === '/fahrzeuge') return fahrzeugeItem; if (item.path === '/shop') return { ...item, subItems: shopSubItems }; + if (item.path === '/issues') return { ...item, subItems: issuesSubItems }; return item; }) .filter((item) => !item.permission || hasPermission(item.permission));