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:
+3
-2
@@ -70,12 +70,13 @@ export class AuthorCardComponent implements OnChanges {
|
||||
return !!this.author.asin;
|
||||
}
|
||||
|
||||
onCardClick(event: MouseEvent): void {
|
||||
onCardClick(event: Event): void {
|
||||
const target = event.target as HTMLElement;
|
||||
if (target.closest('.menu-button-container')) {
|
||||
return;
|
||||
}
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey);
|
||||
if (isModifierClick) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.toggleCardSelection(!this.isSelected);
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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')});
|
||||
|
||||
@@ -658,8 +658,9 @@ describe('MagicShelfComponent (Part 3)', () => {
|
||||
const rulesArray = result.get('rules') as FormArray;
|
||||
expect(rulesArray.length).toBe(2);
|
||||
const nestedGroup = rulesArray.at(1);
|
||||
expect(nestedGroup.get('rules')).toBeDefined();
|
||||
expect(nestedGroup.get('rules').length).toBe(1);
|
||||
const nestedRules = nestedGroup.get('rules') as FormArray;
|
||||
expect(nestedRules).toBeDefined();
|
||||
expect(nestedRules.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should preserve join type', () => {
|
||||
|
||||
+8
-2
@@ -958,11 +958,17 @@ export class MetadataEditorComponent implements OnInit {
|
||||
detail: this.t.translate('metadata.editor.toast.coverRegenerated'),
|
||||
});
|
||||
},
|
||||
error: () => {
|
||||
error: (err: unknown) => {
|
||||
const errorMessage =
|
||||
err && typeof err === 'object' && 'error' in err && err.error &&
|
||||
typeof err.error === 'object' && 'message' in err.error &&
|
||||
typeof err.error.message === 'string'
|
||||
? err.error.message
|
||||
: this.t.translate('metadata.editor.toast.coverRegenFailed');
|
||||
this.messageService.add({
|
||||
severity: "error",
|
||||
summary: this.t.translate('metadata.editor.toast.errorSummary'),
|
||||
detail: err?.error?.message || this.t.translate('metadata.editor.toast.coverRegenFailed'),
|
||||
detail: errorMessage,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+3
-2
@@ -318,10 +318,11 @@ export class MetadataSearcherComponent implements OnDestroy, OnChanges {
|
||||
];
|
||||
}
|
||||
|
||||
onProviderPillClick(provider: string, event: MouseEvent | KeyboardEvent): void {
|
||||
onProviderPillClick(provider: string, event: Event): void {
|
||||
const providerLower = provider.toLowerCase();
|
||||
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
const isModifierClick = (event instanceof MouseEvent || event instanceof KeyboardEvent) && (event.ctrlKey || event.metaKey);
|
||||
if (isModifierClick) {
|
||||
if (this.selectedProviderFilters.has(providerLower)) {
|
||||
this.selectedProviderFilters.delete(providerLower);
|
||||
} else {
|
||||
|
||||
@@ -1069,7 +1069,7 @@ export class CbxReaderComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
@HostListener('document:mouseleave', ['$event'])
|
||||
@HostListener('document:mouseleave')
|
||||
onMouseLeave(): void {
|
||||
this.visibilityManager.handleMouseLeave();
|
||||
if (this.isMagnifierActive) {
|
||||
|
||||
@@ -72,7 +72,7 @@ export class CbxNoteDialogComponent implements OnChanges {
|
||||
this.selectedColor = color;
|
||||
}
|
||||
|
||||
onOverlayClick(event: MouseEvent): void {
|
||||
onOverlayClick(event: Event): void {
|
||||
if ((event.target as HTMLElement).classList.contains('dialog-overlay')) {
|
||||
this.onCancel();
|
||||
}
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ export class CbxShortcutsHelpComponent {
|
||||
this.closed.emit();
|
||||
}
|
||||
|
||||
onOverlayClick(event: MouseEvent): void {
|
||||
onOverlayClick(event: Event): void {
|
||||
if ((event.target as HTMLElement).classList.contains('dialog-overlay')) {
|
||||
this.onClose();
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ export class ReaderEventService {
|
||||
const overlayerStyle = this.annotationService.getOverlayerDrawFunction(storedStyle.style);
|
||||
draw(overlayerStyle, {color: storedStyle.color});
|
||||
}
|
||||
this.eventSubject.next({type: 'draw-annotation', detail: {annotation, doc, range}});
|
||||
this.eventSubject.next({type: 'draw-annotation', detail: {draw, annotation, doc, range}});
|
||||
});
|
||||
|
||||
this.view.addEventListener('show-annotation', (event: Event) => {
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface BookMetadata {
|
||||
publisher?: string;
|
||||
description?: string;
|
||||
identifier?: string;
|
||||
coverUrl?: string;
|
||||
coverUrl?: string | null;
|
||||
|
||||
[key: string]: unknown;
|
||||
}
|
||||
@@ -84,6 +84,8 @@ interface FoliateViewElement extends HTMLElement {
|
||||
getCFI(index: number, range: Range): string | null;
|
||||
deselect(): void;
|
||||
addAnnotation(annotation: { value: string }): void;
|
||||
deleteAnnotation(annotation: { value: string }): Promise<void>;
|
||||
showAnnotation(annotation: { value: string }): Promise<void>;
|
||||
getSectionFractions?(): number[];
|
||||
search?(opts: { query: string; matchCase?: boolean; matchWholeWords?: boolean }): AsyncGenerator<FoliateSearchResult>;
|
||||
clearSearch?(): void;
|
||||
@@ -122,7 +124,7 @@ export class ReaderViewManagerService {
|
||||
this.eventService.initialize(this.view, {
|
||||
prev: () => this.prev(),
|
||||
next: () => this.next(),
|
||||
getCFI: (index: number, range: Range) => this.view?.getCFI(index, range),
|
||||
getCFI: (index: number, range: Range) => this.view?.getCFI(index, range) ?? null,
|
||||
getContents: () => this.view?.renderer?.getContents() ?? null
|
||||
});
|
||||
}
|
||||
@@ -132,6 +134,7 @@ export class ReaderViewManagerService {
|
||||
return throwError(() => new Error('View not created'));
|
||||
}
|
||||
|
||||
const view = this.view;
|
||||
return timer(100).pipe(
|
||||
switchMap(() => from(fetch(epubPath))),
|
||||
switchMap(response => {
|
||||
@@ -144,7 +147,7 @@ export class ReaderViewManagerService {
|
||||
const file = new File([blob], epubPath.split('/').pop() || 'book.epub', {
|
||||
type: 'application/epub+zip'
|
||||
});
|
||||
return from(this.view.open(file) as Promise<void>);
|
||||
return from(view.open(file) as Promise<void>);
|
||||
}),
|
||||
map(() => undefined),
|
||||
catchError(err => throwError(() => err))
|
||||
@@ -171,7 +174,11 @@ export class ReaderViewManagerService {
|
||||
const baseUrl = this.epubStreamingService.getBaseUrl();
|
||||
const authToken = this.epubStreamingService.getAuthToken();
|
||||
const book = await makeStreamingBook(bookId, baseUrl, bookInfo, authToken, bookType);
|
||||
await this.view.open(book);
|
||||
const view = this.view;
|
||||
if (!view) {
|
||||
throw new Error('View not created');
|
||||
}
|
||||
await view.open(book);
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
@@ -185,8 +192,9 @@ export class ReaderViewManagerService {
|
||||
if (!this.view) {
|
||||
return of(undefined);
|
||||
}
|
||||
const view = this.view;
|
||||
return defer(() =>
|
||||
from(this.view.goTo(resolvedTarget) as Promise<void>)
|
||||
from(view.goTo(resolvedTarget) as Promise<void>)
|
||||
).pipe(
|
||||
map(() => undefined)
|
||||
);
|
||||
@@ -200,7 +208,8 @@ export class ReaderViewManagerService {
|
||||
if (!this.view) {
|
||||
return of(undefined);
|
||||
}
|
||||
return defer(() => from(this.view.goToFraction(fraction) as Promise<void>)).pipe(
|
||||
const view = this.view;
|
||||
return defer(() => from(view.goToFraction(fraction) as Promise<void>)).pipe(
|
||||
map(() => undefined)
|
||||
);
|
||||
}
|
||||
@@ -304,8 +313,9 @@ export class ReaderViewManagerService {
|
||||
if (!this.view?.book?.getCover) {
|
||||
return of(null);
|
||||
}
|
||||
const book = this.view.book;
|
||||
return defer(() => {
|
||||
const coverPromise = this.view.book.getCover();
|
||||
const coverPromise = book.getCover?.();
|
||||
return coverPromise ? from(coverPromise as Promise<Blob | null>) : of(null);
|
||||
});
|
||||
}
|
||||
@@ -317,8 +327,9 @@ export class ReaderViewManagerService {
|
||||
}
|
||||
|
||||
async* search(opts: { query: string; matchCase?: boolean; matchWholeWords?: boolean }): AsyncGenerator<FoliateSearchResult> {
|
||||
if (!this.view?.search) return;
|
||||
yield* this.view.search(opts);
|
||||
const search = this.view?.search;
|
||||
if (!search) return;
|
||||
yield* search.call(this.view, opts);
|
||||
}
|
||||
|
||||
clearSearch(): void {
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.metadataDialog'">
|
||||
<div class="dialog-overlay" role="button" tabindex="0" (click)="close.emit()" (keydown.enter)="close.emit()">
|
||||
<div class="dialog-overlay" role="button" tabindex="0" (click)="closed.emit()" (keydown.enter)="closed.emit()">
|
||||
<div class="dialog" tabindex="0" (click)="$event.stopPropagation()" (keydown.enter)="$event.stopPropagation()">
|
||||
<div class="dialog-header">
|
||||
<h2>{{ t('title') }}</h2>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
<button class="close-btn" (click)="closed.emit()">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
|
||||
@@ -70,7 +70,7 @@ export class ReaderNoteDialogComponent implements OnChanges {
|
||||
this.selectedColor = color;
|
||||
}
|
||||
|
||||
onOverlayClick(event: MouseEvent): void {
|
||||
onOverlayClick(event: Event): void {
|
||||
if ((event.target as HTMLElement).classList.contains('dialog-overlay')) {
|
||||
this.onCancel();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
<ng-container *transloco="let t; prefix: 'readerEbook.settingsDialog'">
|
||||
<div class="dialog-overlay" role="button" tabindex="0" (click)="close.emit()" (keydown.enter)="close.emit()">
|
||||
<div class="dialog-overlay" role="button" tabindex="0" (click)="closed.emit()" (keydown.enter)="closed.emit()">
|
||||
<div class="dialog" tabindex="0" (click)="$event.stopPropagation()" (keydown.enter)="$event.stopPropagation()">
|
||||
<div class="tabs-row">
|
||||
<div class="tabs">
|
||||
@@ -22,7 +22,7 @@
|
||||
{{ t('layoutTab') }}
|
||||
</button>
|
||||
</div>
|
||||
<button class="close-btn" (click)="close.emit()">✕</button>
|
||||
<button class="close-btn" (click)="closed.emit()">✕</button>
|
||||
</div>
|
||||
|
||||
<div class="dialog-body">
|
||||
|
||||
@@ -71,7 +71,7 @@ export class EbookShortcutsHelpComponent {
|
||||
this.closed.emit();
|
||||
}
|
||||
|
||||
onOverlayClick(event: MouseEvent): void {
|
||||
onOverlayClick(event: Event): void {
|
||||
if ((event.target as HTMLElement).classList.contains('dialog-overlay')) {
|
||||
this.onClose();
|
||||
}
|
||||
|
||||
@@ -424,12 +424,12 @@ export class EbookReaderComponent implements OnInit, OnDestroy {
|
||||
this.visibilityManager.handleMouseMove(event.clientY);
|
||||
}
|
||||
|
||||
@HostListener('document:mouseleave', ['$event'])
|
||||
@HostListener('document:mouseleave')
|
||||
onMouseLeave(): void {
|
||||
this.visibilityManager.handleMouseLeave();
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
@HostListener('window:resize')
|
||||
onWindowResize(): void {
|
||||
this.visibilityManager.updateWindowHeight(window.innerHeight);
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ export interface Annotation {
|
||||
}
|
||||
|
||||
interface AnnotationView {
|
||||
addAnnotation(annotation: { value: string }): Promise<{ index: number; label: string } | undefined>;
|
||||
addAnnotation(annotation: { value: string }): Promise<{ index: number; label: string } | undefined> | void;
|
||||
deleteAnnotation(annotation: { value: string }): Promise<void>;
|
||||
showAnnotation(annotation: { value: string }): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -2,31 +2,7 @@ import {Component, EventEmitter, HostListener, inject, Input, Output} from '@ang
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {ReaderViewManagerService} from '../../core/view-manager.service';
|
||||
import {ReaderIconComponent} from '../../shared/icon.component';
|
||||
|
||||
interface TocItem {
|
||||
label: string;
|
||||
href: string;
|
||||
subitems?: TocItem[];
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface PageItem {
|
||||
label: string;
|
||||
href: string;
|
||||
subitems?: PageItem[];
|
||||
id: number;
|
||||
}
|
||||
|
||||
interface RelocateEventDetail {
|
||||
fraction: number;
|
||||
section: { current: number; total: number };
|
||||
location: { current: number; next: number; total: number };
|
||||
time: { section: number; total: number };
|
||||
tocItem: TocItem;
|
||||
pageItem: PageItem;
|
||||
cfi: string;
|
||||
range: Range | null;
|
||||
}
|
||||
import {RelocateProgressData} from '../../state/progress.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reader-navbar',
|
||||
@@ -36,7 +12,7 @@ interface RelocateEventDetail {
|
||||
styleUrls: ['./footer.component.scss']
|
||||
})
|
||||
export class ReaderNavbarComponent {
|
||||
@Input() progressData: RelocateEventDetail | null = null;
|
||||
@Input() progressData: RelocateProgressData | null = null;
|
||||
@Input() forceVisible = false;
|
||||
@Input() set sectionFractions(value: number[]) {
|
||||
this._sectionFractions = value.filter(f => f > 0.001 && f < 0.999);
|
||||
@@ -82,19 +58,19 @@ export class ReaderNavbarComponent {
|
||||
}
|
||||
|
||||
get timeTotal(): string {
|
||||
return this.formatDuration((this.progressData?.time.total ?? 0) * 60);
|
||||
return this.formatDuration((this.progressData?.time?.total ?? 0) * 60);
|
||||
}
|
||||
|
||||
get timeSection(): string {
|
||||
return this.formatDuration((this.progressData?.time.section ?? 0) * 60);
|
||||
return this.formatDuration((this.progressData?.time?.section ?? 0) * 60);
|
||||
}
|
||||
|
||||
get sectionCurrent(): number {
|
||||
return this.progressData?.section.current ?? 0;
|
||||
return this.progressData?.section?.current ?? 0;
|
||||
}
|
||||
|
||||
get sectionTotal(): number {
|
||||
return this.progressData?.section.total ?? 0;
|
||||
return this.progressData?.section?.total ?? 0;
|
||||
}
|
||||
|
||||
get currentChapter(): string {
|
||||
|
||||
@@ -51,10 +51,11 @@ export class PageDecorator {
|
||||
}
|
||||
|
||||
const footerStyle = this.buildStyle(theme);
|
||||
const feet = renderer.feet;
|
||||
|
||||
renderer.feet.forEach((footElement: HTMLElement, index: number) => {
|
||||
feet.forEach((footElement: HTMLElement, index: number) => {
|
||||
if (footElement) {
|
||||
const footerContent = this.createFooterContent(pageInfo, isSingleColumn, index, renderer.feet.length, footerStyle, timeRemainingLabel);
|
||||
const footerContent = this.createFooterContent(pageInfo, isSingleColumn, index, feet.length, footerStyle, timeRemainingLabel);
|
||||
footElement.replaceChildren(footerContent);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -128,7 +128,7 @@ export class TextSelectionPopupComponent {
|
||||
this.hasPreview = false;
|
||||
}
|
||||
|
||||
onDismiss(event: MouseEvent): void {
|
||||
onDismiss(event: Event): void {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ export class ReaderProgressService {
|
||||
}
|
||||
|
||||
if (cfi && percentage !== null) {
|
||||
this.bookPatchService.saveEpubProgress(this.bookId, cfi, href, percentage, this.bookFileId);
|
||||
this.bookPatchService.saveEpubProgress(this.bookId, cfi, href ?? '', percentage, this.bookFileId);
|
||||
this.readingSessionService.updateProgress(cfi, percentage);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ export class ReaderProgressService {
|
||||
}
|
||||
|
||||
if (detail?.section) {
|
||||
const percentCompleted = Math.round((detail.fraction * 100) * 10) / 10;
|
||||
const percentCompleted = Math.round(((detail.fraction ?? 0) * 100) * 10) / 10;
|
||||
const totalMinutes = detail.time?.section ?? 0;
|
||||
|
||||
const hours = Math.floor(totalMinutes / 60);
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ export class SeriesCardComponent {
|
||||
: this.urlHelper.getThumbnailUrl(book.id, book.metadata?.coverUpdatedOn);
|
||||
}
|
||||
|
||||
onCardClick(event: MouseEvent): void {
|
||||
onCardClick(event: Event): void {
|
||||
event.stopPropagation();
|
||||
this.cardClick.emit(this.series);
|
||||
}
|
||||
|
||||
+2
-2
@@ -122,14 +122,14 @@ export class EpubReaderPreferencesComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
get selectedFont(): string | null {
|
||||
return this.userSettings.ebookReaderSetting.fontFamily;
|
||||
return this.userSettings.ebookReaderSetting.fontFamily || null;
|
||||
}
|
||||
|
||||
set selectedFont(value: string | null) {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = value;
|
||||
} else {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = null;
|
||||
this.userSettings.ebookReaderSetting.fontFamily = '';
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['ebookReaderSetting', 'fontFamily'], value);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class ReaderPreferencesService {
|
||||
updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
let target = this.currentUser.userSettings as unknown as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ export class FilterPreferencesComponent {
|
||||
private updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
let target = this.currentUser.userSettings as unknown as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ export class SidebarSortingPreferencesComponent implements OnInit, OnDestroy {
|
||||
|
||||
private updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
let target = this.currentUser.userSettings as unknown as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
|
||||
+2
-4
@@ -6,8 +6,6 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type ReadingDebtChartData = ChartData<'bar' | 'line', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-reading-debt-chart',
|
||||
standalone: true,
|
||||
@@ -31,7 +29,7 @@ export class ReadingDebtChartComponent {
|
||||
public currentBacklog = 0;
|
||||
public trend = '';
|
||||
|
||||
public chartData: ReadingDebtChartData = {labels: [], datasets: []};
|
||||
public chartData: ChartData<'bar', number[], string> = {labels: [], datasets: []};
|
||||
|
||||
public chartOptions: ChartConfiguration<'bar'>['options'] = {
|
||||
responsive: true,
|
||||
@@ -159,7 +157,7 @@ export class ReadingDebtChartComponent {
|
||||
tension: 0.3,
|
||||
yAxisID: 'y1',
|
||||
order: 1
|
||||
} as ReadingDebtChartData['datasets'][number]
|
||||
} as unknown as ChartData<'bar', number[], string>['datasets'][number]
|
||||
]
|
||||
};
|
||||
this.hasData = true;
|
||||
|
||||
@@ -15,12 +15,28 @@ import {IconDisplayComponent} from '../../../components/icon-display/icon-displa
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {IconSelection} from '../../../service/icon-picker.service';
|
||||
import {TranslocoPipe} from '@jsverse/transloco';
|
||||
import {MenuItem, MenuItemCommandEvent} from 'primeng/api';
|
||||
|
||||
type AppMenuItem = MenuItem & {
|
||||
type AppMenuItem = Omit<MenuItem, 'items'> & {
|
||||
items?: AppMenuItem[];
|
||||
label?: string;
|
||||
routerLink?: string[];
|
||||
queryParams?: MenuItem['queryParams'];
|
||||
queryParamsHandling?: MenuItem['queryParamsHandling'];
|
||||
fragment?: string;
|
||||
preserveFragment?: boolean;
|
||||
skipLocationChange?: boolean;
|
||||
replaceUrl?: boolean;
|
||||
state?: MenuItem['state'];
|
||||
target?: string;
|
||||
type?: 'library' | 'magicShelf' | 'shelf' | string;
|
||||
iconType?: string;
|
||||
iconType?: IconSelection['type'];
|
||||
icon?: string;
|
||||
disabled?: boolean;
|
||||
command?: (event: MenuItemCommandEvent) => void;
|
||||
class?: string;
|
||||
menu?: MenuItem[];
|
||||
badgeClass?: string;
|
||||
unhealthy?: boolean;
|
||||
bookCount?: number;
|
||||
hasDropDown?: boolean;
|
||||
@@ -143,7 +159,12 @@ export class AppMenuitemComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
updateActiveStateFromRoute() {
|
||||
const activeRoute = this.router.isActive(this.item.routerLink[0], {
|
||||
const firstRoute = this.item.routerLink?.[0];
|
||||
if (!firstRoute) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeRoute = this.router.isActive(firstRoute, {
|
||||
paths: 'exact',
|
||||
queryParams: 'ignored',
|
||||
matrixParams: 'ignored',
|
||||
|
||||
@@ -3,7 +3,8 @@ import { createRxStompConfig } from './rx-stomp.config';
|
||||
import {AuthService} from '../service/auth.service';
|
||||
|
||||
export function rxStompServiceFactory(authService: AuthService) {
|
||||
const rxStomp = new RxStompService(authService);
|
||||
void authService;
|
||||
const rxStomp = new RxStompService();
|
||||
const stompConfig = createRxStompConfig(authService);
|
||||
rxStomp.configure(stompConfig);
|
||||
return rxStomp;
|
||||
|
||||
Reference in New Issue
Block a user