import { PwaInstallService } from '@/core/services/pwa-install.service';
import { Component, HostListener } from '@angular/core';
import { RouterModule } from '@angular/router';
import { ConfirmDialog } from 'primeng/confirmdialog';
import { ToastModule } from 'primeng/toast';
import { brandingConfig } from './app/branding/branding.config';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterModule, ToastModule, ConfirmDialog],
template: `
`,
})
export class AppComponent {
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
constructor(private readonly pwaInstallService: PwaInstallService) {
this.updateToastPosition();
if (brandingConfig.enableInstallPrompt) {
this.pwaInstallService.init();
}
}
@HostListener('window:resize')
onResize() {
this.updateToastPosition();
}
private updateToastPosition() {
this.toastPosition =
typeof window !== 'undefined' && window.innerWidth <= 768 ? 'top-center' : 'bottom-right';
}
}