- Refactor to remove BookMetadataBI
- Use inject everywhere instead of constructor injection
This commit is contained in:
+9
-9
@@ -1,11 +1,11 @@
|
||||
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { BookService } from '../../../book/service/book.service';
|
||||
import { BookState } from '../../../book/model/state/book-state.model';
|
||||
import { BookCardComponent } from '../../../book/components/book-browser/book-card/book-card.component';
|
||||
import { InfiniteScrollDirective } from 'ngx-infinite-scroll';
|
||||
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
|
||||
import {Component, ElementRef, inject, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {Observable} from 'rxjs';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {BookState} from '../../../book/model/state/book-state.model';
|
||||
import {BookCardComponent} from '../../../book/components/book-browser/book-card/book-card.component';
|
||||
import {InfiniteScrollDirective} from 'ngx-infinite-scroll';
|
||||
import {AsyncPipe, NgForOf, NgIf} from '@angular/common';
|
||||
import {ProgressSpinnerModule} from 'primeng/progressspinner';
|
||||
|
||||
@Component({
|
||||
@@ -29,7 +29,7 @@ export class DashboardScrollerComponent implements OnInit {
|
||||
|
||||
bookState$: Observable<BookState> | undefined;
|
||||
|
||||
constructor(private bookService: BookService) {}
|
||||
private bookService = inject(BookService);
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.bookListType === 'lastRead') {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {LibraryCreatorComponent} from '../../../book/components/library-creator/library-creator.component';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {LibraryService} from '../../../book/service/library.service';
|
||||
@@ -21,17 +21,15 @@ import {DashboardScrollerComponent} from '../dashboard-scroller/dashboard-scroll
|
||||
providers: [DialogService],
|
||||
})
|
||||
export class MainDashboardComponent {
|
||||
isLibrariesEmpty$: Observable<boolean>;
|
||||
|
||||
ref: DynamicDialogRef | undefined;
|
||||
|
||||
constructor(private libraryService: LibraryService, public dialogService: DialogService) {
|
||||
this.isLibrariesEmpty$ = this.libraryService.libraryState$.pipe(
|
||||
map(state => !state.libraries || state.libraries.length === 0)
|
||||
);
|
||||
}
|
||||
isLibrariesEmpty$: Observable<boolean> = inject(LibraryService).libraryState$.pipe(
|
||||
map(state => !state.libraries || state.libraries.length === 0)
|
||||
);
|
||||
|
||||
createNewLibrary() {
|
||||
this.ref = this.dialogService.open(LibraryCreatorComponent, {
|
||||
this.ref = inject(DialogService).open(LibraryCreatorComponent, {
|
||||
header: 'Create New Library',
|
||||
modal: true,
|
||||
closable: true,
|
||||
|
||||
Reference in New Issue
Block a user