From 0268aa8667dad8312213e57343dfb71294ba6985 Mon Sep 17 00:00:00 2001 From: 4gray Date: Thu, 1 Oct 2026 07:14:46 +0200 Subject: [PATCH] fix(ui): keep the auto-refresh badge on playlist rows with one provider icon Showing one provider icon per row moved the auto-refresh badge into the M3U branches only, so a restored Stalker playlist with a URL and auto-refresh lost it although the URL is still re-fetched. The row now renders one icon container: the provider icon from the shared precedence, then the badge for any row with a URL or a local M3U, exactly the rows that showed it before. The Xtream portal-status dot, used without source health, keeps that corner. Co-Authored-By: Claude Opus 5.5 --- .../playlist-item.component.html | 101 +++++++++--------- .../playlist-item.component.spec.ts | 25 ++--- .../playlist-item/playlist-item.component.ts | 19 ++++ 3 files changed, 81 insertions(+), 64 deletions(-) diff --git a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.html b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.html index 2b30109bd..844252b24 100644 --- a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.html +++ b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.html @@ -19,16 +19,18 @@ } - @switch (sourceIconKey) { - @case ('stalker') { - {{ sourceIcons.stalker }} - } - @case ('xtream') { -
+
+ @switch (sourceIconKey) { + @case ('stalker') { + {{ sourceIcons.stalker }} + } + @case ('xtream') { {{ sourceIcons.xtream }} - @if (!runtime.supportsSourceHealth) { - - } -
+ } + @case ('m3u-url') { + {{ sourceIcons['m3u-url'] }} + } + @default { + {{ sourceIcons['m3u-local'] }} + } } - @default { -
- @if (sourceIconKey === 'm3u-url') { - {{ sourceIcons['m3u-url'] }} - } @else { - {{ sourceIcons['m3u-local'] }} - } - @if (item.autoRefresh) { - autorenew - } -
+ @if (showsPortalStatusDot) { + + } @else if (showsAutoRefresh) { + autorenew } - } +
diff --git a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.spec.ts b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.spec.ts index 2ed168c99..585d0b46a 100644 --- a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.spec.ts +++ b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.spec.ts @@ -226,16 +226,15 @@ describe('PlaylistItemComponent', () => { [ { macAddress: '00:1A:79:00:00:01', url: 'http://portal.test' }, 'cast', + true, ], - [ - { serverUrl: 'http://xtream.test', url: 'http://xtream.test' }, - 'cloud', - ], - [{ url: 'http://list.test/playlist.m3u' }, 'link'], - [{}, 'description'], + [{ macAddress: '00:1A:79:00:00:01' }, 'cast', false], + [{ serverUrl: 'http://xtream.test' }, 'cloud', false], + [{ url: 'http://list.test/playlist.m3u' }, 'link', true], + [{}, 'description', true], ])( - 'shows one provider icon for %o, with the shared precedence', - (source, icon) => { + 'shows one provider icon for %o (%s) and keeps the auto-refresh badge: %s', + (source, icon, autoRefreshBadge) => { fixture.destroy(); fixture = TestBed.createComponent(PlaylistItemComponent); fixture.componentInstance.item = { @@ -243,18 +242,20 @@ describe('PlaylistItemComponent', () => { _id: 'source', count: 10, importDate: Date.now().toString(), - autoRefresh: false, + autoRefresh: true, ...source, }; fixture.detectChanges(); + const row = fixture.nativeElement as HTMLElement; const icons = Array.from( - (fixture.nativeElement as HTMLElement).querySelectorAll( - '.upload-type-icon' - ), + row.querySelectorAll('.upload-type-icon'), (element) => element.textContent?.trim() ); expect(icons).toEqual([icon]); + expect(row.querySelector('.auto-refresh-indicator') !== null).toBe( + autoRefreshBadge + ); } ); }); diff --git a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.ts b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.ts index 77a13aef4..033de62c5 100644 --- a/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.ts +++ b/libs/playlist/shared/ui/src/lib/recent-playlists/playlist-item/playlist-item.component.ts @@ -78,6 +78,25 @@ export class PlaylistItemComponent implements OnInit { get sourceIconKey(): PlaylistSourceIconKey { return resolvePlaylistSourceIconKey(this.item); } + + /** Without source health, Xtream rows badge the portal status instead. */ + get showsPortalStatusDot(): boolean { + return ( + this.sourceIconKey === 'xtream' && + !this.runtime.supportsSourceHealth + ); + } + + /** + * Auto-refresh re-fetches a URL or a local file, so any row with a URL + * keeps the badge, whichever provider icon it shows. + */ + get showsAutoRefresh(): boolean { + return ( + !!this.item.autoRefresh && + (!!this.item.url || this.sourceIconKey === 'm3u-local') + ); + } private readonly translate = inject(TranslateService); private readonly languageTick = toSignal( this.translate.onLangChange.pipe(startWith(null)),