2026-05-11 18:42:05 +03:30
|
|
|
import { PwaInstallService } from '@/core/services/pwa-install.service';
|
2026-04-30 16:27:42 +03:30
|
|
|
import { Component, HostListener } from '@angular/core';
|
2025-01-07 17:29:51 +03:00
|
|
|
import { RouterModule } from '@angular/router';
|
2025-12-30 21:03:39 +03:30
|
|
|
import { ConfirmDialog } from 'primeng/confirmdialog';
|
2025-12-04 21:07:18 +03:30
|
|
|
import { ToastModule } from 'primeng/toast';
|
2026-05-11 18:42:05 +03:30
|
|
|
import { brandingConfig } from './app/branding/branding.config';
|
2025-01-07 12:16:16 +03:00
|
|
|
|
2025-01-03 12:52:44 +03:00
|
|
|
@Component({
|
2025-12-30 21:03:39 +03:30
|
|
|
selector: 'app-root',
|
|
|
|
|
standalone: true,
|
|
|
|
|
imports: [RouterModule, ToastModule, ConfirmDialog],
|
|
|
|
|
template: `
|
2026-05-16 14:49:22 +03:30
|
|
|
<p-toast [position]="toastPosition" [baseZIndex]="3000" />
|
2026-04-13 13:22:40 +03:30
|
|
|
<p-confirmDialog />
|
|
|
|
|
<router-outlet />
|
2025-12-30 21:03:39 +03:30
|
|
|
`,
|
2025-01-03 12:52:44 +03:00
|
|
|
})
|
2026-04-30 16:27:42 +03:30
|
|
|
export class AppComponent {
|
|
|
|
|
toastPosition: 'top-center' | 'bottom-right' = 'bottom-right';
|
|
|
|
|
|
2026-05-11 18:42:05 +03:30
|
|
|
constructor(private readonly pwaInstallService: PwaInstallService) {
|
2026-04-30 16:27:42 +03:30
|
|
|
this.updateToastPosition();
|
2026-05-11 18:42:05 +03:30
|
|
|
if (brandingConfig.enableInstallPrompt) {
|
|
|
|
|
this.pwaInstallService.init();
|
|
|
|
|
}
|
2026-04-30 16:27:42 +03:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@HostListener('window:resize')
|
|
|
|
|
onResize() {
|
|
|
|
|
this.updateToastPosition();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private updateToastPosition() {
|
|
|
|
|
this.toastPosition =
|
|
|
|
|
typeof window !== 'undefined' && window.innerWidth <= 768 ? 'top-center' : 'bottom-right';
|
|
|
|
|
}
|
|
|
|
|
}
|