perf(frontend): optimize initial bundle size with lazy-loaded dialogs and localized chart providers (#1110)

This commit is contained in:
brios
2026-05-18 23:05:10 +02:00
committed by GitHub
parent 4afc738dd4
commit c6cbdcfa11
32 changed files with 532 additions and 405 deletions
@@ -1,4 +1,5 @@
import { computed, inject, Injectable, signal } from '@angular/core';
import { MessageService } from 'primeng/api';
import { toObservable, toSignal } from '@angular/core/rxjs-interop';
import { Router } from '@angular/router';
import { TranslocoService } from '@jsverse/transloco';
@@ -50,6 +51,7 @@ export class CommandPaletteService {
private readonly bookDialogHelperService = inject(BookDialogHelperService);
private readonly iconService = inject(IconService);
private readonly urlHelper = inject(UrlHelperService);
private readonly messageService = inject(MessageService);
private readonly _isOpen = signal(false);
readonly isOpen = this._isOpen.asReadonly();
@@ -131,7 +133,7 @@ export class CommandPaletteService {
this.hide();
queueMicrotask(() => {
if (item.command) {
item.command();
void Promise.resolve(item.command()).catch(() => undefined);
return;
}
if (item.route) {
@@ -211,10 +213,10 @@ export class CommandPaletteService {
const user = this.userService.currentUser();
if (!user) return [];
return buildQuickActionNavItems(this.translate, user.permissions, {
createLibrary: () => this.dialogLauncherService.openLibraryCreateDialog(),
createShelf: () => this.bookDialogHelperService.openShelfCreatorDialog(),
createMagicShelf: () => this.dialogLauncherService.openMagicShelfCreateDialog(),
uploadBook: () => this.dialogLauncherService.openFileUploadDialog(),
createLibrary: () => void this.dialogLauncherService.openLibraryCreateDialog().catch(() => undefined),
createShelf: () => void this.bookDialogHelperService.openShelfCreatorDialog().catch(() => undefined),
createMagicShelf: () => void this.dialogLauncherService.openMagicShelfCreateDialog().catch(() => undefined),
uploadBook: () => void this.dialogLauncherService.openFileUploadDialog().catch(() => undefined),
}).map((item) => this.toPaletteNavItem(item, 'action'));
});
@@ -320,5 +322,4 @@ export class CommandPaletteService {
command: item.action,
};
}
}