52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
import { CommonModule } from '@angular/common';
|
|
import { Component, HostListener } from '@angular/core';
|
|
import { ActivatedRoute, NavigationEnd, Router, RouterOutlet } from '@angular/router';
|
|
import { filter } from 'rxjs';
|
|
import build from '../build';
|
|
import { ConfirmationComponent } from './components/confirmation.component';
|
|
import { EMailComponent } from './components/email/email.component';
|
|
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 { ConfirmationService } from './services/confirmation.service';
|
|
import { LoadingService } from './services/loading.service';
|
|
import { UserService } from './services/user.service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
imports: [CommonModule, RouterOutlet, HeaderComponent, FooterComponent, MessageContainerComponent, SearchModalComponent, ConfirmationComponent, EMailComponent],
|
|
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 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];
|
|
}
|
|
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.showConfirmation({
|
|
message: `App Version: ${this.build.timestamp}`,
|
|
buttons: 'none',
|
|
});
|
|
}
|
|
}
|