From 397f57186edd51ce82f4e0732c7c3bc9f75893e0 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 4 Jan 2026 16:26:30 +0100 Subject: [PATCH] feat: add EPG progress panel, snackbar and i18n message Register EPG progress panel component and MatSnackBar in AppComponent, inject MatSnackBar and show a brief confirmation when all EPG sources are already fresh. Re-enable keyboard handling in Electron-like environments by switching the tauri check to window.electron and restoring the keydown listener. Add new English i18n keys for total counts and an "EPG is up-to-date" message. Why: - Expose EPG progress panel so it can be used in the app template. - Provide user feedback when EPG sync finds no stale sources via a transient snackbar message. - Restore cross-platform keyboard shortcuts by detecting electron instead of the commented-out tauri guard. - Add missing translations used by the UI. --- apps/web/src/app/app.component.ts | 17 ++++++++++++++--- apps/web/src/assets/i18n/en.json | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts index 39b78770f..daf3619e0 100644 --- a/apps/web/src/app/app.component.ts +++ b/apps/web/src/app/app.component.ts @@ -1,5 +1,6 @@ import { Component, HostBinding, inject, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { Router, RouterOutlet } from '@angular/router'; import { Actions, ofType } from '@ngrx/effects'; import { Store } from '@ngrx/store'; @@ -16,13 +17,14 @@ import { Theme, } from 'shared-interfaces'; import { SettingsService } from './services/settings.service'; +import { EpgProgressPanelComponent } from './shared/epg-progress-panel/epg-progress-panel.component'; import { RecentlyViewedComponent } from './xtream-tauri/recently-viewed/recently-viewed.component'; import { SearchResultsComponent } from './xtream-tauri/search-results/search-results.component'; @Component({ selector: 'app-root', templateUrl: './app.component.html', - imports: [RouterOutlet], + imports: [EpgProgressPanelComponent, RouterOutlet], }) export class AppComponent implements OnInit { @HostBinding('class.macos-platform') get isMacOS() { @@ -34,6 +36,7 @@ export class AppComponent implements OnInit { private dataService = inject(DataService); private dialog = inject(MatDialog); private epgService = inject(EpgService); + private snackBar = inject(MatSnackBar); private router = inject(Router); private store = inject(Store); private translate = inject(TranslateService); @@ -62,7 +65,7 @@ export class AppComponent implements OnInit { }); } } - /* if (isTauri()) { + if (window.electron) { document.addEventListener('keydown', (event) => { if (event.ctrlKey || event.metaKey) { if (event.key === 'f') { @@ -74,7 +77,7 @@ export class AppComponent implements OnInit { } } }); - } */ + } } ngOnInit() { @@ -177,6 +180,14 @@ export class AppComponent implements OnInit { console.log( `EPG: ${result.freshUrls.length} source(s) already fresh, skipping fetch` ); + // Show snackbar if all EPG sources are fresh (no stale URLs) + if (result.staleUrls.length === 0) { + this.snackBar.open( + this.translate.instant('EPG.UP_TO_DATE'), + this.translate.instant('CLOSE'), + { duration: 3000 } + ); + } } if (result.staleUrls.length > 0) { diff --git a/apps/web/src/assets/i18n/en.json b/apps/web/src/assets/i18n/en.json index 22c34014c..3312edc23 100644 --- a/apps/web/src/assets/i18n/en.json +++ b/apps/web/src/assets/i18n/en.json @@ -265,7 +265,10 @@ "CHANNELS": "channels", "PROGRAMS": "programs", "LOADING": "Loading", - "QUEUED": "Queued" + "QUEUED": "Queued", + "TOTAL_CHANNELS": "Total channels", + "TOTAL_PROGRAMS": "Total programs", + "UP_TO_DATE": "EPG is up-to-date, no sync needed" }, "LANGUAGES": { "ARABIC": "العربية",