diff --git a/src/app/pages/aviso/aviso.page.html b/src/app/pages/aviso/aviso.page.html index 859203c..90c768e 100644 --- a/src/app/pages/aviso/aviso.page.html +++ b/src/app/pages/aviso/aviso.page.html @@ -109,8 +109,8 @@ -
-
+
+
@@ -139,8 +139,8 @@
-
-
+
+
@@ -185,7 +185,7 @@ -
+
= IMPORT diff --git a/src/app/pages/aviso/aviso.page.scss b/src/app/pages/aviso/aviso.page.scss index 84d00cf..83622d8 100644 --- a/src/app/pages/aviso/aviso.page.scss +++ b/src/app/pages/aviso/aviso.page.scss @@ -409,10 +409,7 @@ ion-title { left: 4%; /* 5% * 0.8 */ } - .problem, - .passport { - width: 100%; - } + /* Benutzerdefinierte Segmente anpassen */ .custom-segment { @@ -449,4 +446,12 @@ ion-title { .legendecontainer { margin-left: 8%; /* 10% * 0.8 */ } + + .problem { + width: 22%; + } + + .passport { + width: 32%; + } } diff --git a/src/app/pages/aviso/aviso.page.ts b/src/app/pages/aviso/aviso.page.ts index dc9b016..6629d57 100644 --- a/src/app/pages/aviso/aviso.page.ts +++ b/src/app/pages/aviso/aviso.page.ts @@ -91,6 +91,7 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit { private dateSubscription: Subscription = new Subscription(); private durationSubscription: Subscription = new Subscription(); + private pageRotationSubscription: Subscription | null = null; standort = ''; standortID = 0; @@ -603,23 +604,33 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit { this.currentPageIndex = 0; } this.updateAvisoStatesAndCycles(); + + } private startPageRotation(): void { + // Prüfen, ob wir überhaupt mehrere Seiten haben if (!this.avisoTvSettings || this.avisoTvSettings.length === 0) { console.warn('avisoTvSettings ist nicht verfügbar oder leer'); return; } if (this.pages.length <= 1) { - // Nur eine Seite + // Nur eine Seite => keine Rotation return; } + const seitenwechselInSek = this.avisoTvSettings[0].seitenwechselInSek; if (typeof seitenwechselInSek === 'number' && seitenwechselInSek > 0) { const intervalMs = seitenwechselInSek * 1000; + + // Progress-Bar einmalig starten this.startProgressBar(seitenwechselInSek); - interval(intervalMs) + // Falls noch eine alte Subscription läuft, vorher beenden + this.stopPageRotationIfRunning(); + + // Jetzt neue Subscription anlegen + this.pageRotationSubscription = interval(intervalMs) .pipe(takeUntil(this.destroy$)) .subscribe(() => { // Neue Arrivals erst beim Seitenwechsel übernehmen @@ -633,6 +644,8 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit { if (this.pages.length > 1) { this.currentPageIndex = (this.currentPageIndex + 1) % this.pages.length; this.cdr.detectChanges(); + + // Progress-Bar für nächste Runde (Seitenwechsel) erneut starten this.startProgressBar(seitenwechselInSek); } else { console.warn('Keine ausreichende Anzahl von Seiten zum Wechseln'); @@ -641,8 +654,29 @@ export class AvisoPage implements OnInit, OnDestroy, AfterViewInit { } else { console.warn('seitenwechselInSek ist ungültig:', seitenwechselInSek); } + + if (this.pages.length > 1) { + this.restartPageRotationIfNeeded(); + } else { + this.stopPageRotationIfRunning(); + } } + + private stopPageRotationIfRunning(): void { + if (this.pageRotationSubscription && !this.pageRotationSubscription.closed) { + this.pageRotationSubscription.unsubscribe(); + this.pageRotationSubscription = null; + } + } + + private restartPageRotationIfNeeded(): void { + if (!this.pageRotationSubscription || this.pageRotationSubscription.closed) { + this.startPageRotation(); + } + } + + @HostListener('window:resize') onResizeHostListener(): void { this.paginateArrivals(); diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index bd3e1ec..4159b9a 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - baseUrl: 'https://avisotv.server.app.verag.ag/api' + baseUrl: 'https://webapp.server.app.verag.ag/api' };