refactor(ui): convert bookdrop progress to signals (#1626)

This commit is contained in:
Alex
2026-06-03 14:30:09 +01:00
committed by GitHub
parent 9d30913b3a
commit 9de1c9d55a
9 changed files with 106 additions and 91 deletions
@@ -14,12 +14,12 @@ describe('UnifiedNotificationBoxComponent', () => {
let fixture: ComponentFixture<UnifiedNotificationBoxComponent>;
let component: UnifiedNotificationBoxComponent;
let activeTasks$: BehaviorSubject<Record<string, unknown>>;
let hasPendingFiles$: BehaviorSubject<boolean>;
let hasPendingFiles: WritableSignal<boolean>;
let hasActiveImport: WritableSignal<boolean>;
beforeEach(async () => {
activeTasks$ = new BehaviorSubject<Record<string, unknown>>({});
hasPendingFiles$ = new BehaviorSubject(false);
hasPendingFiles = signal(false);
hasActiveImport = signal(false);
await TestBed.configureTestingModule({
@@ -31,7 +31,7 @@ describe('UnifiedNotificationBoxComponent', () => {
},
{
provide: BookdropFileService,
useValue: {hasPendingFiles$},
useValue: {hasPendingFiles},
},
{
provide: LibraryImportProgressService,
@@ -71,7 +71,7 @@ describe('UnifiedNotificationBoxComponent', () => {
const popover = component as unknown as {hasPendingBookdropFiles: Signal<boolean>};
expect(popover.hasPendingBookdropFiles()).toBe(false);
hasPendingFiles$.next(true);
hasPendingFiles.set(true);
expect(popover.hasPendingBookdropFiles()).toBe(true);
});
@@ -28,6 +28,6 @@ export class UnifiedNotificationBoxComponent {
private readonly activeMetadataTasks = toSignal(this.metadataProgressService.activeTasks$, {initialValue: {}});
protected readonly hasMetadataTasks = computed(() => Object.keys(this.activeMetadataTasks()).length > 0);
protected readonly hasPendingBookdropFiles = toSignal(this.bookdropFileService.hasPendingFiles$, {initialValue: false});
protected readonly hasPendingBookdropFiles = this.bookdropFileService.hasPendingFiles;
protected readonly hasActiveLibraryImport = this.libraryImportProgressService.hasActiveImport;
}