fix(dashboard): improve performance with OnPush change detection (#440)
* fix(dashboard): improve performance with OnPush change detection * fix(dashboard): refactor book card component for improved readability and performance * fix(tests): mock matchMedia for improved test compatibility * fix(tests): matchMedia mock for better CI compatibility and support * fix(dashboard): add clearAll method to BookBrowserScrollService and update tests * fix(dashboard): improve performance with content visibility and refactor styles * fix(dashboard): improve scroll performance with estimated total height and refactor layout * fix(tests): add mock for getCurrentUser in userService for improved test coverage * fix(dashboard): implement infinite scroll for book loading and scroll restoration * fix(tests): fix lint error * fix(tests): mock ResizeObserver and IntersectionObserver * fix(tests): mock ResizeObserver and IntersectionObserver (again) * fix(dashboard): improve accessibility and performance by updating aria attributes and optimizing animations * fix(dashboard): improve submenu accessibility and optimize virtual scroller performance * fix(dashboard): clean up imports and improve component structure * fix(dashboard): correct mobile check in author browser component * fix(dashboard): add OnDestroy lifecycle hook to BookBrowserComponent
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Component, DestroyRef, inject, OnInit} from '@angular/core';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {take} from 'rxjs/operators';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {CustomFontService} from '../../../shared/service/custom-font.service';
|
||||
@@ -12,11 +13,13 @@ import {FontUploadDialogComponent} from './font-upload-dialog/font-upload-dialog
|
||||
import {Skeleton} from 'primeng/skeleton';
|
||||
import {DialogSize, DialogStyle} from '../../../shared/services/dialog-launcher.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {DatePipe} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-custom-fonts',
|
||||
standalone: true,
|
||||
imports: [CommonModule, Button, ConfirmDialog, Tooltip, Skeleton, TranslocoDirective],
|
||||
imports: [
|
||||
DatePipe,Button, ConfirmDialog, Tooltip, Skeleton, TranslocoDirective],
|
||||
templateUrl: './custom-fonts.component.html',
|
||||
styleUrls: ['./custom-fonts.component.scss'],
|
||||
providers: [ConfirmationService, DialogService]
|
||||
@@ -34,6 +37,7 @@ export class CustomFontsComponent implements OnInit {
|
||||
private confirmationService = inject(ConfirmationService);
|
||||
private dialogService = inject(DialogService);
|
||||
private t = inject(TranslocoService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadFonts();
|
||||
@@ -82,7 +86,7 @@ export class CustomFontsComponent implements OnInit {
|
||||
});
|
||||
|
||||
if (this.uploadDialogRef) {
|
||||
this.uploadDialogRef.onClose.subscribe((font: CustomFont | null) => {
|
||||
this.uploadDialogRef.onClose.pipe(take(1), takeUntilDestroyed(this.destroyRef)).subscribe((font: CustomFont | null) => {
|
||||
if (font) {
|
||||
this.customFonts.push(font);
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import {Component, ViewChild, ElementRef, OnDestroy, inject} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {Button} from 'primeng/button';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {CustomFontService} from '../../../../shared/service/custom-font.service';
|
||||
@@ -12,7 +11,7 @@ import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/tran
|
||||
@Component({
|
||||
selector: 'app-font-upload-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule, Button, InputText, FormsModule, TranslocoDirective, TranslocoPipe],
|
||||
imports: [Button, InputText, FormsModule, TranslocoDirective, TranslocoPipe],
|
||||
templateUrl: './font-upload-dialog.component.html',
|
||||
styleUrls: ['./font-upload-dialog.component.scss']
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user