64 lines
2.4 KiB
TypeScript
64 lines
2.4 KiB
TypeScript
import { CommonModule } from '@angular/common';
|
|
import { Component, HostListener } from '@angular/core';
|
|
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
|
import { KeycloakService } from 'keycloak-angular';
|
|
|
|
import { filter } from 'rxjs/operators';
|
|
import build from '../build';
|
|
import { ConfirmationComponent } from './components/confirmation/confirmation.component';
|
|
import { ConfirmationService } from './components/confirmation/confirmation.service';
|
|
import { FooterComponent } from './components/footer/footer.component';
|
|
import { HeaderComponent } from './components/header/header.component';
|
|
import { MessageContainerComponent } from './components/message/message-container.component';
|
|
import { SearchModalComponent } from './components/search-modal/search-modal.component';
|
|
import { LoadingService } from './services/loading.service';
|
|
import { UserService } from './services/user.service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
standalone: true,
|
|
imports: [CommonModule, RouterOutlet, HeaderComponent, FooterComponent, MessageContainerComponent, SearchModalComponent, ConfirmationComponent],
|
|
providers: [],
|
|
templateUrl: './app.component.html',
|
|
styleUrl: './app.component.scss',
|
|
})
|
|
export class AppComponent {
|
|
build = build;
|
|
title = 'bizmatch';
|
|
actualRoute = '';
|
|
|
|
public constructor(
|
|
public loadingService: LoadingService,
|
|
private router: Router,
|
|
private activatedRoute: ActivatedRoute,
|
|
private keycloakService: KeycloakService,
|
|
private userService: UserService,
|
|
private confirmationService: ConfirmationService,
|
|
) {
|
|
this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
|
|
let currentRoute = this.activatedRoute.root;
|
|
while (currentRoute.children[0] !== undefined) {
|
|
currentRoute = currentRoute.children[0];
|
|
}
|
|
// Hier haben Sie Zugriff auf den aktuellen Route-Pfad
|
|
this.actualRoute = currentRoute.snapshot.url[0].path;
|
|
});
|
|
}
|
|
ngOnInit() {}
|
|
@HostListener('window:keydown', ['$event'])
|
|
handleKeyboardEvent(event: KeyboardEvent) {
|
|
// this.router.events.subscribe(event => {
|
|
// if (event instanceof NavigationEnd) {
|
|
// initFlowbite();
|
|
// }
|
|
// });
|
|
if (event.shiftKey && event.ctrlKey && event.key === 'V') {
|
|
this.showVersionDialog();
|
|
}
|
|
}
|
|
|
|
showVersionDialog() {
|
|
this.confirmationService.showConfirmation({ message: `App Version: ${this.build.timestamp}`, buttons: 'none' });
|
|
}
|
|
}
|