68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import { CommonModule } from '@angular/common';
|
|
import { Component, HostListener } from '@angular/core';
|
|
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
|
import onChange from 'on-change';
|
|
import { ConfirmationService } from 'primeng/api';
|
|
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
import { ProgressSpinnerModule } from 'primeng/progressspinner';
|
|
import { filter } from 'rxjs/operators';
|
|
import { ListingCriteria } from '../../../bizmatch-server/src/models/main.model';
|
|
import build from '../build';
|
|
import { FooterComponent } from './components/footer/footer.component';
|
|
import { HeaderComponent } from './components/header/header.component';
|
|
import { KeycloakService } from './services/keycloak.service';
|
|
import { LoadingService } from './services/loading.service';
|
|
import { UserService } from './services/user.service';
|
|
import { createDefaultListingCriteria } from './utils/utils';
|
|
@Component({
|
|
selector: 'app-root',
|
|
standalone: true,
|
|
imports: [CommonModule, RouterOutlet, HeaderComponent, ProgressSpinnerModule, FooterComponent, ConfirmDialogModule],
|
|
providers: [ConfirmationService],
|
|
templateUrl: './app.component.html',
|
|
styleUrl: './app.component.scss',
|
|
})
|
|
export class AppComponent {
|
|
build = build;
|
|
title = 'bizmatch';
|
|
actualRoute = '';
|
|
listingCriteria: ListingCriteria = onChange(createDefaultListingCriteria(), (path, value, previousValue, applyData) => {
|
|
sessionStorage.setItem('criteria', JSON.stringify(value));
|
|
});
|
|
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) {
|
|
if (event.shiftKey && event.ctrlKey && event.key === 'V') {
|
|
this.showVersionDialog();
|
|
}
|
|
}
|
|
|
|
showVersionDialog() {
|
|
this.confirmationService.confirm({
|
|
target: event.target as EventTarget,
|
|
message: `App Version: ${this.build.timestamp}`,
|
|
header: 'Version Info',
|
|
icon: 'pi pi-info-circle',
|
|
accept: () => {},
|
|
reject: () => {},
|
|
});
|
|
}
|
|
}
|