diff --git a/frontend/src/app/pages/dashboard-root/dashboard-root.component.html b/frontend/src/app/pages/dashboard-root/dashboard-root.component.html index 23eb2c3..e7728ac 100644 --- a/frontend/src/app/pages/dashboard-root/dashboard-root.component.html +++ b/frontend/src/app/pages/dashboard-root/dashboard-root.component.html @@ -1,97 +1,120 @@ -
- -
-
- -
-
-
Logo
-
- - -
- -
- -
+ +
-
    -
  • - - -
    -
    - - {{ item.name }} -
    - - â–¶ - -
    - -
      -
    • - {{ subItem }} -
    • -
    -
  • -
-
- + ? 'bg-primary w-48 md:w-16 transition-all duration-300 ease-in-out' + : 'bg-primary w-48 md:w-48 transition-all duration-300 ease-in-out' + " + class="transform h-full z-20 overflow-y-auto fixed md:relative">
+ [ngClass]="showMobileMenu ? 'justify-center' : 'justify-between'" + class="p-1 w-full h-16 bg-base-100 flex items-center relative"> +
+
+ @if (!isCollapsed && !isDesktopCollapsed) { +
Logo
+ } - -
Hauptinhalt hier
+ @if (!isCollapsed && !showMobileMenu) { + + } +
+
+
+
+ +
+
+
+ +
+
+ +
+

isCollapsed: {{ isCollapsed }}

+

showMobileMenu: {{ showMobileMenu }}

+

isDesktopCollapsed: {{ isDesktopCollapsed }}

+
+
+ +
diff --git a/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts b/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts index aec9cfb..2da5013 100644 --- a/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts +++ b/frontend/src/app/pages/dashboard-root/dashboard-root.component.ts @@ -3,14 +3,15 @@ import { ChangeDetectionStrategy, Component, HostListener, + OnInit, } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; interface MenuItem { name: string; icon: SafeHtml; - subItems: string[]; open?: boolean; + active?: boolean; } @Component({ @@ -22,7 +23,7 @@ interface MenuItem { styleUrl: './dashboard-root.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, }) -export class DashboardRootComponent { +export class DashboardRootComponent implements OnInit { public isCollapsed: boolean = false; public isDesktopCollapsed: boolean = false; public showMobileMenu: boolean = false; @@ -34,37 +35,38 @@ export class DashboardRootComponent { .bypassSecurityTrustHtml(` `), - subItems: [], }, ]; public constructor(private sanitizer: DomSanitizer) {} + public ngOnInit(): void { + this.onResize(); + } + @HostListener('window:resize', ['$event']) public onResize(): void { - if (!this.userHasInteracted) { - this.isCollapsed = window.innerWidth < 768; + if (window.innerWidth >= 768) { + this.showMobileMenu = false; + this.isCollapsed = false; } else { - if (window.innerWidth > 768) { - this.isCollapsed = false; - this.userHasInteracted = false; - } + this.isDesktopCollapsed = false; + this.isCollapsed = true; + this.showMobileMenu = false; } } public toggleSidebar(): void { - this.isCollapsed = !this.isCollapsed; - this.showMobileMenu = !this.isCollapsed; + if (window.innerWidth < 768) { + this.showMobileMenu = !this.showMobileMenu; + this.isCollapsed = !this.showMobileMenu; + } else { + this.isDesktopCollapsed = !this.isDesktopCollapsed; + } this.userHasInteracted = true; } public toggleDesktopSidebar(): void { this.isDesktopCollapsed = !this.isDesktopCollapsed; } - - public toggleSubMenu(item: any): void { - if (item.subItems.length) { - item.open = !item.open; - } - } }