refactor(frontend): resolve linting errors, and EPUB reader lifecycle errors (#2127)

* refactor(types): improve type safety by replacing 'any' with specific types in various components

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* fix(filters): handle undefined values in filter streams and update type for selected filters

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* refactor(epub-reader): improve rendition cleanup and enhance debug logging in helper functions

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

* fix(epub-reader): handle errors during rendition and book destruction in ngOnDestroy

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>

---------

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
Balázs Szücs
2026-01-08 15:21:23 -07:00
committed by GitHub
parent 14dcf552bd
commit 07c3affcd5
31 changed files with 92 additions and 63 deletions
@@ -35,7 +35,7 @@
class="input-full"
placeholder="e.g., Gmail SMTP, SendGrid"
[class.filled]="emailProviderForm.get('name')?.value"
autofocus
/>
@if (emailProviderForm.get('name')?.value && emailProviderForm.get('name')?.valid) {
<i class="pi pi-check-circle input-icon success"></i>
@@ -35,7 +35,7 @@
class="input-full"
placeholder="Enter recipient name..."
[class.filled]="emailRecipientForm.get('name')?.value"
autofocus
/>
@if (emailRecipientForm.get('name')?.value && emailRecipientForm.get('name')?.valid) {
<i class="pi pi-check-circle input-icon success"></i>
@@ -31,7 +31,7 @@ export class LibraryMetadataSettingsComponent implements OnInit {
);
defaultMetadataOptions: MetadataRefreshOptions = this.getDefaultMetadataOptions();
libraryMetadataOptions: { [libraryId: number]: MetadataRefreshOptions } = {};
libraryMetadataOptions: Record<number, MetadataRefreshOptions> = {};
ngOnInit() {
this.appSettingsService.appSettings$.subscribe(appSettings => {
@@ -18,13 +18,13 @@ export class PdfReaderPreferencesComponent {
@Input() userSettings!: UserSettings;
readonly spreads: Array<{name: string; key: PageSpread; icon: string}> = [
readonly spreads: {name: string; key: PageSpread; icon: string}[] = [
{name: 'Even', key: 'even', icon: 'pi pi-align-left'},
{name: 'Odd', key: 'odd', icon: 'pi pi-align-right'},
{name: 'None', key: 'off', icon: 'pi pi-minus'}
];
readonly zooms: Array<{name: string; key: string; icon: string}> = [
readonly zooms: {name: string; key: string; icon: string}[] = [
{name: 'Auto Zoom', key: 'auto', icon: 'pi pi-sparkles'},
{name: 'Page Fit', key: 'page-fit', icon: 'pi pi-window-maximize'},
{name: 'Page Width', key: 'page-width', icon: 'pi pi-arrows-h'},
@@ -37,7 +37,7 @@ export class TaskManagementComponent implements OnInit, OnDestroy {
// State
taskInfos: TaskInfo[] = [];
taskHistories: Map<string, TaskHistory> = new Map();
taskHistories = new Map<string, TaskHistory>();
loading = false;
executingTasks = new Set<string>();
private subscription?: Subscription;
@@ -53,7 +53,7 @@ export class UserManagementComponent implements OnInit, OnDestroy {
currentUser: User | null = null;
editingLibraryIds: number[] = [];
allLibraries: Library[] = [];
expandedRows: { [key: string]: boolean } = {};
expandedRows: Record<string, boolean> = {};
isPasswordDialogVisible = false;
selectedUser: User | null = null;
@@ -31,7 +31,7 @@ export interface CompletionTimelineResponse {
year: number;
month: number;
totalBooks: number;
statusBreakdown: { [key: string]: number };
statusBreakdown: Record<string, number>;
finishedBooks: number;
completionRate: number;
}
@@ -84,7 +84,7 @@ export class UserStatsService {
}
getFavoriteDays(year?: number, month?: number): Observable<FavoriteDaysResponse[]> {
let params: Record<string, string> = {};
const params: Record<string, string> = {};
if (year !== undefined && year !== null) {
params['year'] = year.toString();
}
@@ -99,7 +99,7 @@ export class UserStatsService {
}
getPeakHours(year?: number, month?: number): Observable<PeakHoursResponse[]> {
let params: Record<string, string> = {};
const params: Record<string, string> = {};
if (year !== undefined && year !== null) {
params['year'] = year.toString();
}