fix(ui): restore frontend verification after eslint cleanup

- Reader and metadata typing:
  - align ebook and cbx reader event, progress, dialog, and helper types with the stricter checks surfaced by the ESLint cleanup
  - replace unsafe non-null assertions and broad event assumptions with guarded access in reader, metadata, and shelf flows
- Template and component compatibility:
  - tighten menu item typing for Angular template checking and normalize overlay and card click handlers to use explicit DOM event types
  - repair chart, preferences, and websocket factory typings that broke standalone typecheck and production build validation
- Tests:
  - fix the magic shelf form-array assertion so the frontend test suite compiles cleanly under the stricter checker
- Validation:
  - `just ui check`
  - `just ui typecheck`
  - `just ui test`
This commit is contained in:
James Cox
2026-04-22 17:26:51 -04:00
committed by Zach Yale
parent 782bd63664
commit 43389c8dc4
30 changed files with 115 additions and 87 deletions
@@ -893,8 +893,8 @@ export class BookCardComponent implements OnInit, OnChanges {
this.lastMouseEvent = event;
}
onCardClick(event: MouseEvent): void {
if (!event.ctrlKey) {
onCardClick(event: Event): void {
if (!(event instanceof MouseEvent || event instanceof KeyboardEvent) || !event.ctrlKey) {
return;
}
@@ -191,8 +191,8 @@ export class DuplicateMergerComponent implements OnInit, OnDestroy {
}
onPageChange(event: PaginatorState): void {
this.pageFirst = event.first;
this.pageSize = event.rows;
this.pageFirst = event.first ?? 0;
this.pageSize = event.rows ?? this.pageSize;
}
getBookFormats(book: Book): string[] {
@@ -85,7 +85,9 @@ export class LibraryShelfMenuService {
severity: 'success',
},
accept: () => {
this.libraryService.refreshLibrary(entity!.id).subscribe({
const entityId = entity?.id;
if (entityId == null) return;
this.libraryService.refreshLibrary(entityId).subscribe({
complete: () => {
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.libraryRefreshSuccessDetail')});
},
@@ -147,8 +149,13 @@ export class LibraryShelfMenuService {
},
accept: () => {
const loader = this.loadingService.show(this.t.translate('book.shelfMenuService.loading.deletingLibrary', {name: entity?.name}));
const entityId = entity?.id;
if (entityId == null) {
this.loadingService.hide(loader);
return;
}
this.libraryService.deleteLibrary(entity!.id)
this.libraryService.deleteLibrary(entityId)
.pipe(finalize(() => this.loadingService.hide(loader)))
.subscribe({
complete: () => {
@@ -212,7 +219,9 @@ export class LibraryShelfMenuService {
severity: 'secondary'
},
accept: () => {
this.shelfService.deleteShelf(entity!.id).subscribe({
const entityId = entity?.id;
if (entityId == null) return;
this.shelfService.deleteShelf(entityId).subscribe({
complete: () => {
this.router.navigate(['/']);
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.shelfDeletedDetail')});
@@ -284,7 +293,9 @@ export class LibraryShelfMenuService {
severity: 'secondary'
},
accept: () => {
this.magicShelfService.deleteShelf(entity!.id).subscribe({
const entityId = entity?.id;
if (entityId == null) return;
this.magicShelfService.deleteShelf(entityId).subscribe({
complete: () => {
this.router.navigate(['/']);
this.messageService.add({severity: 'info', summary: this.t.translate('common.success'), detail: this.t.translate('book.shelfMenuService.toast.magicShelfDeletedDetail')});