Migrate existing control flow directives to use new control-flow schematic
This commit is contained in:
committed by
Aditya Chandel
parent
246efdaa34
commit
0f852ef068
@@ -7,7 +7,7 @@
|
||||
[min]="1"
|
||||
[max]="pages.length"
|
||||
placeholder="Page"
|
||||
/>
|
||||
/>
|
||||
<button
|
||||
(click)="goToPageInput !== null && goToPage(goToPageInput)"
|
||||
[disabled]="goToPageInput === null || goToPageInput < 1 || goToPageInput > pages.length">
|
||||
@@ -27,9 +27,11 @@
|
||||
</div>
|
||||
|
||||
<div class="spread-controls" style="display: flex; align-items: center; margin-left: auto;">
|
||||
<button *ngIf="isTwoPageView" (click)="toggleSpreadDirection()" title="Toggle Spread Direction">
|
||||
{{ pageSpread === 'ODD' ? '⬅️' : '➡️' }}
|
||||
</button>
|
||||
@if (isTwoPageView) {
|
||||
<button (click)="toggleSpreadDirection()" title="Toggle Spread Direction">
|
||||
{{ pageSpread === 'ODD' ? '⬅️' : '➡️' }}
|
||||
</button>
|
||||
}
|
||||
<button (click)="toggleView()" title="Toggle View">
|
||||
{{ isTwoPageView ? '1️⃣' : '2️⃣' }}
|
||||
</button>
|
||||
@@ -37,19 +39,19 @@
|
||||
</div>
|
||||
|
||||
<div class="image-container" [class.two-page-view]="isTwoPageView">
|
||||
<ng-container *ngIf="!isLoading; else loading">
|
||||
<ng-container *ngIf="pages.length > 0; else noPages">
|
||||
<img *ngFor="let url of imageUrls" [src]="url" alt="Page Image"/>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<ng-template #noPages>
|
||||
<p>No pages available.</p>
|
||||
</ng-template>
|
||||
<ng-template #loading>
|
||||
@if (!isLoading) {
|
||||
@if (pages.length > 0) {
|
||||
@for (url of imageUrls; track url) {
|
||||
<img [src]="url" alt="Page Image"/>
|
||||
}
|
||||
} @else {
|
||||
<p>No pages available.</p>
|
||||
}
|
||||
} @else {
|
||||
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
<p style="margin-top: 1rem; color: #ccc;">Processing pages... This may take a few seconds on first load. Future loads will be significantly faster.</p>
|
||||
</div>
|
||||
</ng-template>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, HostListener, inject, OnInit} from '@angular/core';
|
||||
import {NgFor, NgIf} from '@angular/common';
|
||||
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {CbxReaderService} from '../../service/cbx-reader.service';
|
||||
import {BookService} from '../../service/book.service';
|
||||
@@ -14,7 +14,7 @@ import {NewPdfReaderService} from '../../service/new-pdf-reader.service';
|
||||
@Component({
|
||||
selector: 'app-cbx-reader',
|
||||
standalone: true,
|
||||
imports: [NgIf, NgFor, ProgressSpinner, FormsModule],
|
||||
imports: [ProgressSpinner, FormsModule],
|
||||
templateUrl: './cbx-reader.component.html',
|
||||
styleUrl: './cbx-reader.component.scss'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user