|
|
@@ -1,26 +1,49 @@
|
|
|
import { Component } from '@angular/core';
|
|
|
-import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
|
-import { Observable } from 'rxjs';
|
|
|
-import { map, shareReplay } from 'rxjs/operators';
|
|
|
import { AuthService } from '@auth0/auth0-angular';
|
|
|
+import { MenuItem } from 'primeng/api';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-main-menu',
|
|
|
templateUrl: './main-menu.component.html',
|
|
|
- styleUrls: ['./main-menu.component.scss']
|
|
|
+ styleUrls: ['./main-menu.component.scss'],
|
|
|
})
|
|
|
export class MainMenuComponent {
|
|
|
-
|
|
|
- isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
|
|
|
- .pipe(
|
|
|
- map(result => result.matches),
|
|
|
- shareReplay()
|
|
|
- );
|
|
|
+ public menuItems: MenuItem[];
|
|
|
|
|
|
constructor(
|
|
|
- private breakpointObserver: BreakpointObserver,
|
|
|
private readonly authService: AuthService,
|
|
|
- ) { }
|
|
|
+ ) {
|
|
|
+ this.menuItems = [
|
|
|
+ {
|
|
|
+ label: 'Home',
|
|
|
+ routerLink: ['/']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'Tracks',
|
|
|
+ items: [
|
|
|
+ {
|
|
|
+ label: 'Search',
|
|
|
+ routerLink: ['/tracks']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'Create',
|
|
|
+ routerLink: ['/tracks/edit/new']
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'Events',
|
|
|
+ items: [{
|
|
|
+ label: 'Search',
|
|
|
+ routerLink: ['/events']
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: 'Logout',
|
|
|
+ command: () => this.logout()
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
|
|
|
public logout(): void {
|
|
|
this.authService.logout({
|