Migrate existing control flow directives to use new control-flow schematic
This commit is contained in:
committed by
Aditya Chandel
parent
246efdaa34
commit
0f852ef068
+45
-41
@@ -1,46 +1,50 @@
|
||||
<div class="dashboard-container">
|
||||
<p-progressSpinner *ngIf="(bookState$ | async)?.loaded === false" styleClass="spinner center-spinner"></p-progressSpinner>
|
||||
<div class="dashboard" *ngIf="(bookState$ | async)?.loaded === true">
|
||||
<div>
|
||||
<div class="dashboard-no-library" *ngIf="isLibrariesEmpty$ | async; else dashboardScroller">
|
||||
<div *ngIf="(userService.userState$ | async)?.permissions as permissions">
|
||||
<div *ngIf="permissions.admin || permissions.canManipulateLibrary">
|
||||
<h1 class="no-library-header">Looks like you haven't added a library yet. Let's add one!</h1>
|
||||
<p-button
|
||||
label="Add a Library"
|
||||
icon="pi pi-plus"
|
||||
styleClass="p-button-rounded p-button-outlined"
|
||||
(click)="createNewLibrary()">
|
||||
</p-button>
|
||||
@if ((bookState$ | async)?.loaded === false) {
|
||||
<p-progressSpinner styleClass="spinner center-spinner"></p-progressSpinner>
|
||||
}
|
||||
@if ((bookState$ | async)?.loaded === true) {
|
||||
<div class="dashboard">
|
||||
<div>
|
||||
@if (isLibrariesEmpty$ | async) {
|
||||
<div class="dashboard-no-library">
|
||||
@if ((userService.userState$ | async)?.permissions; as permissions) {
|
||||
<div>
|
||||
@if (permissions.admin || permissions.canManipulateLibrary) {
|
||||
<div>
|
||||
<h1 class="no-library-header">Looks like you haven't added a library yet. Let's add one!</h1>
|
||||
<p-button
|
||||
label="Add a Library"
|
||||
icon="pi pi-plus"
|
||||
styleClass="p-button-rounded p-button-outlined"
|
||||
(click)="createNewLibrary()">
|
||||
</p-button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
} @else {
|
||||
<app-dashboard-scroller
|
||||
[books]="lastReadBooks$ | async"
|
||||
[bookListType]="'lastRead'"
|
||||
[title]="'Last Read Books'">
|
||||
</app-dashboard-scroller>
|
||||
<div class="mb-6">
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
<app-dashboard-scroller
|
||||
[books]="latestAddedBooks$ | async"
|
||||
[title]="'Latest Added Books'">
|
||||
</app-dashboard-scroller>
|
||||
<div class="mb-6">
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
<app-dashboard-scroller
|
||||
[books]="randomBooks$ | async"
|
||||
[title]="'Discover Random Reads'">
|
||||
</app-dashboard-scroller>
|
||||
}
|
||||
</div>
|
||||
|
||||
<ng-template #dashboardScroller>
|
||||
<app-dashboard-scroller
|
||||
[books]="lastReadBooks$ | async"
|
||||
[bookListType]="'lastRead'"
|
||||
[title]="'Last Read Books'">
|
||||
</app-dashboard-scroller>
|
||||
|
||||
<div class="mb-6">
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
|
||||
<app-dashboard-scroller
|
||||
[books]="latestAddedBooks$ | async"
|
||||
[title]="'Latest Added Books'">
|
||||
</app-dashboard-scroller>
|
||||
|
||||
<div class="mb-6">
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
|
||||
<app-dashboard-scroller
|
||||
[books]="randomBooks$ | async"
|
||||
[title]="'Discover Random Reads'">
|
||||
</app-dashboard-scroller>
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@ import {LibraryService} from '../../../book/service/library.service';
|
||||
import {filter, Observable, take} from 'rxjs';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, NgIf} from '@angular/common';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import {DashboardScrollerComponent} from '../dashboard-scroller/dashboard-scroller.component';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {BookState} from '../../../book/model/state/book-state.model';
|
||||
@@ -20,12 +20,11 @@ import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
styleUrls: ['./main-dashboard.component.scss'],
|
||||
imports: [
|
||||
Button,
|
||||
NgIf,
|
||||
DashboardScrollerComponent,
|
||||
AsyncPipe,
|
||||
Divider,
|
||||
ProgressSpinner
|
||||
],
|
||||
],
|
||||
providers: [DialogService],
|
||||
standalone: true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user