diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index 1d34aefc..d946b5aa 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -41,49 +41,51 @@ - @for (item of navItems; track item.label) { - @if ( - (!item.adminOnly || - credentialService.isEffectiveSuperAdmin() || - credentialService.isEffectiveAdmin()) && - (!item.superAdminOnly || credentialService.isEffectiveSuperAdmin()) - ) { - @if (item.type === 'link') { - @if (collapsed()) { - - {{ item.icon }} - - } @else { - - {{ item.icon }} - {{ item.label }} - - } - } @else if (item.type === 'separator') { + @for (itemGroup of navItemGroups; track $index) { +
+ @if ( + (!itemGroup.adminOnly || + credentialService.isEffectiveSuperAdmin() || + credentialService.isEffectiveAdmin()) && + (!itemGroup.superAdminOnly || + credentialService.isEffectiveSuperAdmin()) + ) { @if (!collapsed()) { } + @for (item of itemGroup.items; track item.label) { + @if (collapsed()) { + + {{ item.icon }} + + } @else { + + {{ item.icon }} + {{ item.label }} + + } + } } - } +
}
diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index ce9c80aa..66abe19e 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -16,7 +16,6 @@ import { MatDialog } from '@angular/material/dialog'; import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component'; type NavItem = { - type: 'link' | 'separator'; label: string; icon: string; route: string; @@ -26,6 +25,13 @@ type NavItem = { superAdminOnly?: boolean; }; +type NavItemGroup = { + label: string; + items: NavItem[]; + adminOnly?: boolean; + superAdminOnly?: boolean; +}; + @Component({ selector: 'app-menu', imports: [ @@ -52,16 +58,15 @@ export class AppMenuComponent { matrixParams: 'ignored', fragment: 'ignored', }; + navItems: NavItem[] = [ { - type: 'link', label: 'Dashboard', icon: 'dashboard', route: '/dashboard', disabled: false, }, { - type: 'link', label: 'Personen', icon: 'groups', route: '/persons', @@ -71,14 +76,12 @@ export class AppMenuComponent { disabled: false, }, { - type: 'link', label: 'News', icon: 'newspaper', route: '/news', disabled: false, }, { - type: 'link', label: 'Institutionen', icon: 'apartment', route: '/institutions', @@ -92,7 +95,6 @@ export class AppMenuComponent { }, }, { - type: 'link', label: 'Projekte', icon: 'work', route: '/projects', @@ -107,15 +109,6 @@ export class AppMenuComponent { }, }, { - type: 'separator', - label: 'Verwaltung', - icon: '', - route: '', - disabled: false, - adminOnly: true, - }, - { - type: 'link', label: 'Accounts', icon: 'manage_accounts', route: '/accounts', @@ -123,7 +116,6 @@ export class AppMenuComponent { adminOnly: true, }, { - type: 'link', label: 'Organisationen', icon: 'domain', route: '/organizations', @@ -131,6 +123,26 @@ export class AppMenuComponent { superAdminOnly: true, }, ]; + navItemGroups: NavItemGroup[] = [ + { + label: 'Navigation', + items: this.navItems.filter( + (item) => !item.adminOnly && !item.superAdminOnly, + ), + }, + { + label: 'Administration', + items: this.navItems.filter( + (item) => item.adminOnly && !item.superAdminOnly, + ), + adminOnly: true, + }, + { + label: 'Super Administration', + items: this.navItems.filter((item) => item.superAdminOnly), + superAdminOnly: true, + }, + ]; constructor( public credentialService: CredentialService,