Primo rilascio
This commit is contained in:
64
frontend/nursery-app/src/app/app.component.ts
Normal file
64
frontend/nursery-app/src/app/app.component.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { RouterLink, RouterOutlet } from '@angular/router';
|
||||
import { MatSidenav, MatSidenavModule } from '@angular/material/sidenav';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, shareReplay } from 'rxjs/operators';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AuthService } from './services/auth.service'; // Importa AuthService
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterOutlet,
|
||||
RouterLink,
|
||||
MatSidenavModule,
|
||||
MatListModule,
|
||||
MatToolbarModule,
|
||||
MatIconModule,
|
||||
MatButtonModule
|
||||
],
|
||||
standalone: true, // Assicurati che sia standalone
|
||||
templateUrl: './app.component.html',
|
||||
styleUrl: './app.component.scss',
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'Nursery Management';
|
||||
|
||||
@ViewChild('drawer') drawer!: MatSidenav;
|
||||
|
||||
isHandset$: Observable<boolean>;
|
||||
|
||||
|
||||
menuItems = [
|
||||
{ name: 'Insegnanti', icon: 'school', route: '/teachers' },
|
||||
{ name: 'Anni Scolastici', icon: 'calendar_today', route: '/school-years' },
|
||||
{ name: 'Contratti Insegnanti', icon: 'description', route: '/contracts' },
|
||||
{ name: 'Strutture', icon: 'business', route: '/structures' },
|
||||
{ name: 'Bambini', icon: 'child_care', route: '/children' },
|
||||
{ name: 'Definizione Turni', icon: 'schedule', route: '/shifts' }
|
||||
];
|
||||
|
||||
constructor(
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
public authService: AuthService
|
||||
) {
|
||||
this.isHandset$ = this.breakpointObserver.observe(Breakpoints.Handset)
|
||||
.pipe(
|
||||
map(result => result.matches),
|
||||
shareReplay()
|
||||
);
|
||||
}
|
||||
|
||||
toggleDrawer(): void {
|
||||
this.isHandset$.subscribe(isHandset => {
|
||||
if (isHandset) {
|
||||
this.drawer.toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user