From 958a5b35e5ab168542fe21386c7c0dd6149ab483 Mon Sep 17 00:00:00 2001 From: CodeWithMaBot <310216433+CodeWithMaBot@users.noreply.github.com> Date: Sun, 23 Aug 2026 10:37:35 +0200 Subject: [PATCH 1/6] fix: stabilize posters and filter quick actions --- .../item-card/item-card.component.ts | 5 --- .../item-view/item-view.component.spec.ts | 12 +++++++ .../item-view/item-view.component.ts | 31 +++++++++++++------ .../poster-picker/poster-picker.component.ts | 5 --- src/app/services/image-storage.service.ts | 29 +++++++++++++++-- 5 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/app/components/item-card/item-card.component.ts b/src/app/components/item-card/item-card.component.ts index 3f5f811..3dfc47a 100644 --- a/src/app/components/item-card/item-card.component.ts +++ b/src/app/components/item-card/item-card.component.ts @@ -83,8 +83,6 @@ export class ItemCardComponent { constructor() { this.destroyRef.onDestroy(() => { this.destroyed = true; - const url = this.posterUrl(); - if (url) URL.revokeObjectURL(url); }); effect(() => void this.loadPoster(this.item().posterId)); } @@ -92,11 +90,8 @@ export class ItemCardComponent { private async loadPoster(id: string | undefined): Promise { const url = await this.imageStorage.getUrl(id); if (this.destroyed || id !== this.item().posterId) { - if (url) URL.revokeObjectURL(url); return; } - const previous = this.posterUrl(); - if (previous) URL.revokeObjectURL(previous); this.posterUrl.set(url); } } diff --git a/src/app/components/item-view/item-view.component.spec.ts b/src/app/components/item-view/item-view.component.spec.ts index 337762d..50e0d55 100644 --- a/src/app/components/item-view/item-view.component.spec.ts +++ b/src/app/components/item-view/item-view.component.spec.ts @@ -111,4 +111,16 @@ describe('ItemViewComponent', () => { expect(service.markPaused).toHaveBeenCalledWith(item.id); expect(service.markDropped).toHaveBeenCalledWith(item.id); }); + + it('shows only status-appropriate quick actions', async () => { + configure([{ ...item, type: 'series', status: 'dropped' }]); + const fixture = TestBed.createComponent(ItemViewComponent); + fixture.detectChanges(); + await fixture.whenStable(); + + const buttons = [...(fixture.nativeElement as HTMLElement).querySelectorAll('button')]; + const labels = buttons.map((button) => button.textContent?.trim()); + + expect(labels).toEqual(['Start']); + }); }); diff --git a/src/app/components/item-view/item-view.component.ts b/src/app/components/item-view/item-view.component.ts index 0c8f41a..329b65b 100644 --- a/src/app/components/item-view/item-view.component.ts +++ b/src/app/components/item-view/item-view.component.ts @@ -10,7 +10,7 @@ import { TimeAgoComponent } from '../time-ago/time-ago.component'; import { getMostRecentWatchDate } from '../../utils/progress.utils'; import { getPlaceholderUrl } from '../../utils/tmdb-image.utils'; -type QuickAction = 'watched' | 'completed' | 'started' | 'paused' | 'dropped'; +type QuickAction = 'watched' | 'completed' | 'started' | 'paused' | 'dropped' | 'resume'; @Component({ selector: 'app-item-view', @@ -83,7 +83,7 @@ type QuickAction = 'watched' | 'completed' | 'started' | 'paused' | 'dropped';

Quick Actions

- @for (action of quickActions; track action.label) { + @for (action of quickActions(); track action.label) {