Migrate existing control flow directives to use new control-flow schematic
This commit is contained in:
committed by
Aditya Chandel
parent
246efdaa34
commit
0f852ef068
@@ -2,35 +2,47 @@
|
||||
<div class="flex flex-col flex-grow">
|
||||
<div class="flex justify-between items-center p-2 rounded-t-xl mb-4 bg-[var(--card-background)]">
|
||||
<div class="flex items-center pl-2">
|
||||
<ng-container *ngIf="entityType$ | async as entityType">
|
||||
<p *ngIf="entityType !== EntityType.ALL_BOOKS && entityType !== EntityType.UNSHELVED" class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{{ entityType }}: {{ (entity$ | async)?.name }}
|
||||
</p>
|
||||
<p *ngIf="entityType === EntityType.ALL_BOOKS" class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
All Books
|
||||
</p>
|
||||
<p *ngIf="entityType === EntityType.UNSHELVED" class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
Unshelved Books
|
||||
</p>
|
||||
<div *ngIf="userService.userState$ | async as userData">
|
||||
<div *ngIf="entityType !== EntityType.ALL_BOOKS && entityType !== EntityType.UNSHELVED && (userData.permissions.admin || userData.permissions.canManipulateLibrary) ">
|
||||
<p-button icon="pi pi-ellipsis-v" [rounded]="true" [text]="true" severity="info" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="entityOptions" [popup]="true" appendTo="body"></p-menu>
|
||||
@if (entityType$ | async; as entityType) {
|
||||
@if (entityType !== EntityType.ALL_BOOKS && entityType !== EntityType.UNSHELVED) {
|
||||
<p class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{{ entityType }}: {{ (entity$ | async)?.name }}
|
||||
</p>
|
||||
}
|
||||
@if (entityType === EntityType.ALL_BOOKS) {
|
||||
<p class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
All Books
|
||||
</p>
|
||||
}
|
||||
@if (entityType === EntityType.UNSHELVED) {
|
||||
<p class="text-2xl whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
Unshelved Books
|
||||
</p>
|
||||
}
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div>
|
||||
@if (entityType !== EntityType.ALL_BOOKS && entityType !== EntityType.UNSHELVED && (userData.permissions.admin || userData.permissions.canManipulateLibrary) ) {
|
||||
<div>
|
||||
<p-button icon="pi pi-ellipsis-v" [rounded]="true" [text]="true" severity="info" (click)="entitymenu.toggle($event)"></p-button>
|
||||
<p-menu #entitymenu [model]="entityOptions" [popup]="true" appendTo="body"></p-menu>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-8">
|
||||
|
||||
<div class="flex flex-row items-center gap-6">
|
||||
<a *ngIf="isFilterActive" class="topbar-items topbar-item" (click)="clearFilter()">
|
||||
<i
|
||||
class="pi pi-filter-slash"
|
||||
pTooltip="Clear applied filters"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
</a>
|
||||
@if (isFilterActive) {
|
||||
<a class="topbar-items topbar-item" (click)="clearFilter()">
|
||||
<i
|
||||
class="pi pi-filter-slash"
|
||||
pTooltip="Clear applied filters"
|
||||
tooltipPosition="top">
|
||||
</i>
|
||||
</a>
|
||||
}
|
||||
|
||||
<div>
|
||||
<a
|
||||
@@ -38,7 +50,7 @@
|
||||
(click)="sizeOverlay.toggle($event)"
|
||||
pTooltip="Adjust grid item scale"
|
||||
tooltipPosition="top"
|
||||
>
|
||||
>
|
||||
<i class="pi pi-th-large"></i>
|
||||
</a>
|
||||
|
||||
@@ -71,7 +83,9 @@
|
||||
<ng-template pTemplate="item" let-item>
|
||||
<div class="flex justify-between items-center px-4 py-2 cursor-pointer" (click)="sortBooks(item.field)">
|
||||
<span>{{ item.label }}</span>
|
||||
<i *ngIf="item.icon" [class]="item.icon"></i>
|
||||
@if (item.icon) {
|
||||
<i [class]="item.icon"></i>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
</p-menu>
|
||||
@@ -96,16 +110,17 @@
|
||||
[(ngModel)]="bookTitle"
|
||||
(ngModelChange)="onSearchTermChange($event)"
|
||||
class="search-input"
|
||||
/>
|
||||
<p-button
|
||||
*ngIf="bookTitle"
|
||||
icon="pi pi-times"
|
||||
[text]="true"
|
||||
size="small"
|
||||
[rounded]="true"
|
||||
class="absolute right-2 top-1/2 -translate-y-1/2"
|
||||
(click)="clearSearch()">
|
||||
</p-button>
|
||||
/>
|
||||
@if (bookTitle) {
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
[text]="true"
|
||||
size="small"
|
||||
[rounded]="true"
|
||||
class="absolute right-2 top-1/2 -translate-y-1/2"
|
||||
(click)="clearSearch()">
|
||||
</p-button>
|
||||
}
|
||||
</div>
|
||||
</p-fluid>
|
||||
|
||||
@@ -121,100 +136,118 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="bookState$ | async as bookState">
|
||||
<div *ngIf="!bookState?.loaded && !bookState?.error">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
|
||||
<div class="relative">
|
||||
<div class="no-books-container" *ngIf="bookState?.error">
|
||||
<p class="no-books-text">
|
||||
{{ entityType === EntityType.LIBRARY ? "Failed to load library's books!" : "Failed to load shelf's books!" }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="no-books-container" *ngIf="!bookState?.error && bookState?.loaded && bookState?.books?.length === 0">
|
||||
<p class="no-books-text">
|
||||
This collection has no books!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="book-card-container" *ngIf="bookState?.books as books">
|
||||
<app-book-table *ngIf="currentViewMode === 'table' && books.length > 0" [books]="books" (selectedBooksChange)="onSelectedBooksChange($event)"
|
||||
[sortOption]="selectedSort!"></app-book-table>
|
||||
|
||||
<virtual-scroller *ngIf="currentViewMode === 'grid'" class="virtual-scroller" #scroll [items]="books">
|
||||
<div
|
||||
class="grid"
|
||||
#container
|
||||
[ngStyle]="{'grid-template-columns': 'repeat(auto-fit, minmax(' + gridColumnMinWidth + ', 1fr))'}">
|
||||
<div
|
||||
class="virtual-scroller-item"
|
||||
*ngFor="let book of scroll.viewPortItems"
|
||||
[ngStyle]="{width: currentCardSize.width + 'px', height: currentCardSize.height + 'px'}">
|
||||
<app-book-card
|
||||
[book]="book"
|
||||
[isCheckboxEnabled]="true"
|
||||
[onBookSelect]="handleBookSelect.bind(this)"
|
||||
[isSelected]="selectedBooks.has(book.id)">
|
||||
</app-book-card>
|
||||
@if (bookState$ | async; as bookState) {
|
||||
<div>
|
||||
@if (!bookState?.loaded && !bookState?.error) {
|
||||
<div>
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
<div class="relative">
|
||||
@if (bookState?.error) {
|
||||
<div class="no-books-container">
|
||||
<p class="no-books-text">
|
||||
{{ entityType === EntityType.LIBRARY ? "Failed to load library's books!" : "Failed to load shelf's books!" }}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
@if (!bookState?.error && bookState?.loaded && bookState?.books?.length === 0) {
|
||||
<div class="no-books-container">
|
||||
<p class="no-books-text">
|
||||
This collection has no books!
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
@if (bookState?.books; as books) {
|
||||
<div class="book-card-container">
|
||||
@if (currentViewMode === 'table' && books.length > 0) {
|
||||
<app-book-table [books]="books" (selectedBooksChange)="onSelectedBooksChange($event)"
|
||||
[sortOption]="selectedSort!"></app-book-table>
|
||||
}
|
||||
@if (currentViewMode === 'grid') {
|
||||
<virtual-scroller class="virtual-scroller" #scroll [items]="books">
|
||||
<div
|
||||
class="grid"
|
||||
#container
|
||||
[ngStyle]="{'grid-template-columns': 'repeat(auto-fit, minmax(' + gridColumnMinWidth + ', 1fr))'}">
|
||||
@for (book of scroll.viewPortItems; track book) {
|
||||
<div
|
||||
class="virtual-scroller-item"
|
||||
[ngStyle]="{width: currentCardSize.width + 'px', height: currentCardSize.height + 'px'}">
|
||||
<app-book-card
|
||||
[book]="book"
|
||||
[isCheckboxEnabled]="true"
|
||||
[onBookSelect]="handleBookSelect.bind(this)"
|
||||
[isSelected]="selectedBooks.has(book.id)">
|
||||
</app-book-card>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</virtual-scroller>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (selectedBooks.size > 0) {
|
||||
<div class="book-browser-footer bg-[var(--card-background)] bg-opacity-10" [@slideInOut]>
|
||||
<div class="flex justify-between gap-8">
|
||||
@if (entityType$ | async; as entityType) {
|
||||
@if (entityType === EntityType.LIBRARY || entityType === EntityType.ALL_BOOKS || entityType === EntityType.UNSHELVED) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark-fill"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(onClick)="openShelfAssigner()"
|
||||
pTooltip="Assign to shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
@if (entityType === EntityType.SHELF) {
|
||||
<p-button
|
||||
icon="pi pi-bookmark"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="unshelfBooks()"
|
||||
pTooltip="Remove from shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
@if (userService.userState$ | async; as userData) {
|
||||
<div>
|
||||
@if (userData.permissions.canEditMetadata) {
|
||||
<p-button
|
||||
icon="pi pi-database"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="updateMetadata()"
|
||||
pTooltip="Update metadata"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<p-button
|
||||
outlined="true"
|
||||
icon="pi pi-lock"
|
||||
severity="info"
|
||||
(click)="lockUnlockMetadata()"
|
||||
pTooltip="Lock/Unlock metadata"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<p-button
|
||||
outlined="true"
|
||||
icon="pi pi-times"
|
||||
severity="warn"
|
||||
(click)="deselectAllBooks()"
|
||||
pTooltip="Deselect all books"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</virtual-scroller>
|
||||
</div>
|
||||
|
||||
<div class="book-browser-footer bg-[var(--card-background)] bg-opacity-10" *ngIf="selectedBooks.size > 0" [@slideInOut]>
|
||||
<div class="flex justify-between gap-8">
|
||||
<ng-container *ngIf="entityType$ | async as entityType">
|
||||
<p-button
|
||||
*ngIf="entityType === EntityType.LIBRARY || entityType === EntityType.ALL_BOOKS || entityType === EntityType.UNSHELVED"
|
||||
icon="pi pi-bookmark-fill"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(onClick)="openShelfAssigner()"
|
||||
pTooltip="Assign to shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<p-button
|
||||
*ngIf="entityType === EntityType.SHELF"
|
||||
icon="pi pi-bookmark"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="unshelfBooks()"
|
||||
pTooltip="Remove from shelf"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<div *ngIf="userService.userState$ | async as userData">
|
||||
<p-button
|
||||
*ngIf="userData.permissions.canEditMetadata"
|
||||
icon="pi pi-database"
|
||||
outlined="true"
|
||||
severity="info"
|
||||
(click)="updateMetadata()"
|
||||
pTooltip="Update metadata"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</div>
|
||||
<p-button
|
||||
outlined="true"
|
||||
icon="pi pi-lock"
|
||||
severity="info"
|
||||
(click)="lockUnlockMetadata()"
|
||||
pTooltip="Lock/Unlock metadata"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
<p-button
|
||||
outlined="true"
|
||||
icon="pi pi-times"
|
||||
severity="warn"
|
||||
(click)="deselectAllBooks()"
|
||||
pTooltip="Deselect all books"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
</ng-container>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<app-book-filter [entity$]="entity$" [entityType$]="entityType$" [resetFilter$]="resetFilterSubject"></app-book-filter>
|
||||
|
||||
@@ -20,7 +20,7 @@ import {animate, state, style, transition, trigger} from '@angular/animations';
|
||||
import {MetadataFetchOptionsComponent} from '../../metadata/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
|
||||
import {MetadataRefreshType} from '../../metadata/model/request/metadata-refresh-type.enum';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, NgClass, NgForOf, NgIf, NgStyle} from '@angular/common';
|
||||
import { AsyncPipe, NgClass, NgStyle } from '@angular/common';
|
||||
import {VirtualScrollerModule} from '@iharbeck/ngx-virtual-scroller';
|
||||
import {BookCardComponent} from './book-card/book-card.component';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
@@ -65,7 +65,7 @@ const SORT_DIRECTION = {
|
||||
standalone: true,
|
||||
templateUrl: './book-browser.component.html',
|
||||
styleUrls: ['./book-browser.component.scss'],
|
||||
imports: [Button, NgIf, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, NgForOf, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, Fluid, PrimeTemplate, NgStyle, OverlayPanelModule, Slider, Popover],
|
||||
imports: [Button, VirtualScrollerModule, BookCardComponent, AsyncPipe, ProgressSpinner, Menu, InputText, FormsModule, BookTableComponent, BookFilterComponent, Tooltip, NgClass, Fluid, PrimeTemplate, NgStyle, OverlayPanelModule, Slider, Popover],
|
||||
animations: [
|
||||
trigger('slideInOut', [
|
||||
state('void', style({
|
||||
|
||||
+20
-18
@@ -1,7 +1,7 @@
|
||||
<div class="book-card"
|
||||
[class.selected]="isSelected"
|
||||
(mouseover)="isHovered = true"
|
||||
(mouseout)="isHovered = false">
|
||||
[class.selected]="isSelected"
|
||||
(mouseover)="isHovered = true"
|
||||
(mouseout)="isHovered = false">
|
||||
|
||||
<div class="cover-container" [ngClass]="{ 'shimmer': !isImageLoaded, 'center-info-btn': readButtonHidden }">
|
||||
<img
|
||||
@@ -15,22 +15,24 @@
|
||||
<p-button [rounded]="true" icon="pi pi-info" class="info-btn" (click)="openBookInfo(book)"></p-button>
|
||||
<p-button [hidden]="readButtonHidden" [rounded]="true" icon="pi pi-book" class="read-btn" (click)="readBook(book)"></p-button>
|
||||
|
||||
<p-checkbox
|
||||
*ngIf="isCheckboxEnabled"
|
||||
[(ngModel)]="isSelected"
|
||||
binary="true"
|
||||
id="select-checkbox-{{book.id}}"
|
||||
class="select-checkbox"
|
||||
(ngModelChange)="toggleSelection(isSelected || false)">
|
||||
</p-checkbox>
|
||||
@if (isCheckboxEnabled) {
|
||||
<p-checkbox
|
||||
[(ngModel)]="isSelected"
|
||||
binary="true"
|
||||
id="select-checkbox-{{book.id}}"
|
||||
class="select-checkbox"
|
||||
(ngModelChange)="toggleSelection(isSelected || false)">
|
||||
</p-checkbox>
|
||||
}
|
||||
|
||||
<p-progressBar
|
||||
*ngIf="progressPercentage !== null"
|
||||
[value]="progressPercentage"
|
||||
[showValue]="false"
|
||||
class="cover-progress-bar"
|
||||
[ngClass]="{ 'progress-complete': progressPercentage === 100, 'progress-incomplete': progressPercentage < 100 }">
|
||||
</p-progressBar>
|
||||
@if (progressPercentage !== null) {
|
||||
<p-progressBar
|
||||
[value]="progressPercentage"
|
||||
[showValue]="false"
|
||||
class="cover-progress-bar"
|
||||
[ngClass]="{ 'progress-complete': progressPercentage === 100, 'progress-incomplete': progressPercentage < 100 }">
|
||||
</p-progressBar>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div [hidden]="bottomBarHidden">
|
||||
|
||||
@@ -12,7 +12,7 @@ import {MetadataFetchOptionsComponent} from '../../../metadata/metadata-options-
|
||||
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
|
||||
import {MetadataRefreshRequest} from '../../../metadata/model/request/metadata-refresh-request.model';
|
||||
import {UrlHelperService} from '../../../../utilities/service/url-helper.service';
|
||||
import {NgClass, NgIf} from '@angular/common';
|
||||
import { NgClass } from '@angular/common';
|
||||
import {UserService} from '../../../../settings/user-management/user.service';
|
||||
import {filter} from 'rxjs';
|
||||
import {EmailService} from '../../../../settings/email/email.service';
|
||||
@@ -25,7 +25,7 @@ import {ProgressBar} from 'primeng/progressbar';
|
||||
selector: 'app-book-card',
|
||||
templateUrl: './book-card.component.html',
|
||||
styleUrls: ['./book-card.component.scss'],
|
||||
imports: [Button, MenuModule, CheckboxModule, FormsModule, NgIf, NgClass, TieredMenu, ProgressBar],
|
||||
imports: [Button, MenuModule, CheckboxModule, FormsModule, NgClass, TieredMenu, ProgressBar],
|
||||
standalone: true
|
||||
})
|
||||
export class BookCardComponent implements OnInit {
|
||||
|
||||
+54
-44
@@ -1,49 +1,59 @@
|
||||
<div *ngIf="showFilters" class="w-[225px] ml-4 h-[calc(100vh-6.5rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
||||
<div class="flex items-center justify-between px-4 py-4">
|
||||
<span class="text font-semibold">Filter Mode</span>
|
||||
<p-selectButton
|
||||
[options]="filterModeOptions"
|
||||
[(ngModel)]="selectedFilterMode"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
class="text-sm"
|
||||
allowEmpty="false"
|
||||
@if (showFilters) {
|
||||
<div class="w-[225px] ml-4 h-[calc(100vh-6.5rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
||||
<div class="flex items-center justify-between px-4 py-4">
|
||||
<span class="text font-semibold">Filter Mode</span>
|
||||
<p-selectButton
|
||||
[options]="filterModeOptions"
|
||||
[(ngModel)]="selectedFilterMode"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
class="text-sm"
|
||||
allowEmpty="false"
|
||||
styleClass="h-8"></p-selectButton>
|
||||
</div>
|
||||
<p-accordion [value]="0">
|
||||
<p-accordion-panel *ngFor="let filterType of filterTypes; let i = index" [value]="i">
|
||||
<p-accordion-header>
|
||||
<span class="inline-flex items-center gap-1">
|
||||
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
||||
<span *ngIf="activeFilters[filterType]?.length" class="text-sm text-[var(--primary-color)]">
|
||||
({{ activeFilters[filterType].length }})
|
||||
</span>
|
||||
</span>
|
||||
</p-accordion-header>
|
||||
<p-accordion-content class="h-[31rem] !overflow-y-auto">
|
||||
<div *ngIf="filterStreams[filterType] | async as filters">
|
||||
<div *ngFor="let filter of filters">
|
||||
<div
|
||||
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1 flex items-center gap-2"
|
||||
</div>
|
||||
<p-accordion [value]="0">
|
||||
@for (filterType of filterTypes; track filterType; let i = $index) {
|
||||
<p-accordion-panel [value]="i">
|
||||
<p-accordion-header>
|
||||
<span class="inline-flex items-center gap-1">
|
||||
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
||||
@if (activeFilters[filterType]?.length) {
|
||||
<span class="text-sm text-[var(--primary-color)]">
|
||||
({{ activeFilters[filterType].length }})
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
</p-accordion-header>
|
||||
<p-accordion-content class="h-[31rem] !overflow-y-auto">
|
||||
@if (filterStreams[filterType] | async; as filters) {
|
||||
<div>
|
||||
@for (filter of filters; track filter) {
|
||||
<div>
|
||||
<div
|
||||
class="cursor-pointer transition-colors duration-200 ease-in-out pb-1 flex items-center gap-2"
|
||||
[ngClass]="{
|
||||
'text-[var(--primary-color)]':
|
||||
activeFilters[filterType]?.includes(filter.value?.id || filter.value)
|
||||
}"
|
||||
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
||||
|
||||
<p-badge [value]="filter.bookCount"></p-badge>
|
||||
<ng-container *ngIf="filterType === 'amazonRating'; else defaultLabel">
|
||||
<ng-container *ngIf="filterType === 'amazonRating'; else defaultLabel">
|
||||
<span>{{ filter.value.name }}</span>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
<ng-template #defaultLabel>
|
||||
{{ filter.value.name || filter.value }}
|
||||
</ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
</p-accordion>
|
||||
</div>
|
||||
(click)="handleFilterClick(filterType, filter.value?.id || filter.value)">
|
||||
<p-badge [value]="filter.bookCount"></p-badge>
|
||||
@if (filterType === 'amazonRating') {
|
||||
@if (filterType === 'amazonRating') {
|
||||
<span>{{ filter.value.name }}</span>
|
||||
} @else {
|
||||
{{ filter.value.name || filter.value }}
|
||||
}
|
||||
} @else {
|
||||
{{ filter.value.name || filter.value }}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
}
|
||||
</p-accordion>
|
||||
</div>
|
||||
}
|
||||
|
||||
+2
-4
@@ -7,7 +7,7 @@ import {Shelf} from '../../../model/shelf.model';
|
||||
import {EntityType} from '../book-browser.component';
|
||||
import {Book} from '../../../model/book.model';
|
||||
import {Accordion, AccordionContent, AccordionHeader, AccordionPanel} from 'primeng/accordion';
|
||||
import {AsyncPipe, NgClass, NgForOf, NgIf, TitleCasePipe} from '@angular/common';
|
||||
import { AsyncPipe, NgClass, TitleCasePipe } from '@angular/common';
|
||||
import {Badge} from 'primeng/badge';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {SelectButton} from 'primeng/selectbutton';
|
||||
@@ -110,15 +110,13 @@ function getPageCountRangeFilters(pageCount?: number) {
|
||||
AccordionPanel,
|
||||
AccordionHeader,
|
||||
AccordionContent,
|
||||
NgIf,
|
||||
NgForOf,
|
||||
NgClass,
|
||||
Badge,
|
||||
AsyncPipe,
|
||||
TitleCasePipe,
|
||||
FormsModule,
|
||||
SelectButton
|
||||
]
|
||||
]
|
||||
})
|
||||
export class BookFilterComponent implements OnInit {
|
||||
@Output() filterSelected = new EventEmitter<Record<string, any> | null>();
|
||||
|
||||
+87
-79
@@ -39,85 +39,93 @@
|
||||
</tr>
|
||||
</ng-template>
|
||||
<ng-template #body let-book>
|
||||
<tr *ngIf="book.metadata as metadata" style="height:46px">
|
||||
<td class="max-w-16">
|
||||
<p-tableCheckbox [value]="book"></p-tableCheckbox>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<p-button
|
||||
[icon]="isMetadataFullyLocked(metadata) ? 'pi pi-lock' : 'pi pi-lock-open'"
|
||||
[severity]="isMetadataFullyLocked(metadata) ? 'danger' : 'success'"
|
||||
[text]="true"
|
||||
[title]="isMetadataFullyLocked(metadata) ? 'Locked' : 'Unlocked'"
|
||||
size="small"
|
||||
[style]="{ width: '1.5rem', height: '1.5rem', padding: '0', fontSize: '0.75rem' }"
|
||||
(click)="toggleMetadataLock(metadata)">
|
||||
</p-button>
|
||||
</td>
|
||||
<td (click)="openMetadataCenter(book.id)">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
</td>
|
||||
<td class="min-w-[18rem] max-w-[25rem] overflow-hidden truncate" [title]="metadata.title">{{ metadata.title }}</td>
|
||||
<td class="min-w-[10rem] max-w-[15rem] overflow-hidden truncate" [title]="getAuthorNames(metadata.authors)">{{ getAuthorNames(metadata.authors) }}</td>
|
||||
<td class="min-w-[9rem] max-w-[13rem] overflow-hidden truncate" [title]="metadata.publisher">{{ metadata.publisher }}</td>
|
||||
<td class="min-w-[9rem] max-w-[13rem] overflow-hidden truncate" [title]="metadata.seriesName">{{ metadata.seriesName }}</td>
|
||||
<td class="min-w-[1rem] max-w-[1rem] overflow-hidden truncate" [title]="metadata.seriesNumber">{{ metadata.seriesNumber }}</td>
|
||||
<td class="min-w-[12rem] max-w-[18rem] overflow-hidden truncate" [title]="getGenres(metadata.categories)">{{ getGenres(metadata.categories) }}</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate">
|
||||
{{ metadata.publishedDate ? (metadata.publishedDate | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.lastReadTime ? (book.lastReadTime | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.addedOn ? (book.addedOn | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[9rem] overflow-hidden truncate"
|
||||
@if (book.metadata; as metadata) {
|
||||
<tr style="height:46px">
|
||||
<td class="max-w-16">
|
||||
<p-tableCheckbox [value]="book"></p-tableCheckbox>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<p-button
|
||||
[icon]="isMetadataFullyLocked(metadata) ? 'pi pi-lock' : 'pi pi-lock-open'"
|
||||
[severity]="isMetadataFullyLocked(metadata) ? 'danger' : 'success'"
|
||||
[text]="true"
|
||||
[title]="isMetadataFullyLocked(metadata) ? 'Locked' : 'Unlocked'"
|
||||
size="small"
|
||||
[style]="{ width: '1.5rem', height: '1.5rem', padding: '0', fontSize: '0.75rem' }"
|
||||
(click)="toggleMetadataLock(metadata)">
|
||||
</p-button>
|
||||
</td>
|
||||
<td (click)="openMetadataCenter(book.id)">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(metadata.bookId, metadata?.coverUpdatedOn)" alt="Book Cover" class="size-7"/>
|
||||
</td>
|
||||
<td class="min-w-[18rem] max-w-[25rem] overflow-hidden truncate" [title]="metadata.title">{{ metadata.title }}</td>
|
||||
<td class="min-w-[10rem] max-w-[15rem] overflow-hidden truncate" [title]="getAuthorNames(metadata.authors)">{{ getAuthorNames(metadata.authors) }}</td>
|
||||
<td class="min-w-[9rem] max-w-[13rem] overflow-hidden truncate" [title]="metadata.publisher">{{ metadata.publisher }}</td>
|
||||
<td class="min-w-[9rem] max-w-[13rem] overflow-hidden truncate" [title]="metadata.seriesName">{{ metadata.seriesName }}</td>
|
||||
<td class="min-w-[1rem] max-w-[1rem] overflow-hidden truncate" [title]="metadata.seriesNumber">{{ metadata.seriesNumber }}</td>
|
||||
<td class="min-w-[12rem] max-w-[18rem] overflow-hidden truncate" [title]="getGenres(metadata.categories)">{{ getGenres(metadata.categories) }}</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate">
|
||||
{{ metadata.publishedDate ? (metadata.publishedDate | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.lastReadTime ? (book.lastReadTime | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[9rem] max-w-[9rem] overflow-hidden truncate text-right">
|
||||
{{ book.addedOn ? (book.addedOn | date: 'dd-MMM-yyyy') : '' }}
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[9rem] overflow-hidden truncate"
|
||||
[title]="book.fileSizeKb + ' KB'">
|
||||
{{ formatFileSize(book.fileSizeKb) }}
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.language }}</td>
|
||||
<td class="min-w-[4rem] max-w-[5rem] overflow-hidden truncate">{{ metadata.pageCount }}</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.amazonRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.amazonRating)">
|
||||
</p-rating>
|
||||
<span *ngIf="metadata.amazonRating != null">({{ metadata.amazonRating?.toFixed(1) }})</span>
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.amazonReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.goodreadsRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.goodreadsRating)">
|
||||
</p-rating>
|
||||
<span *ngIf="metadata.goodreadsRating != null">({{ metadata.goodreadsRating?.toFixed(1) }})</span>
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.goodreadsReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.hardcoverRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.hardcoverRating)">
|
||||
</p-rating>
|
||||
<span *ngIf="metadata.hardcoverRating != null">({{ metadata.hardcoverRating?.toFixed(1) }})</span>
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.hardcoverReviewCount }}</td>
|
||||
</tr>
|
||||
{{ formatFileSize(book.fileSizeKb) }}
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.language }}</td>
|
||||
<td class="min-w-[4rem] max-w-[5rem] overflow-hidden truncate">{{ metadata.pageCount }}</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.amazonRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.amazonRating)">
|
||||
</p-rating>
|
||||
@if (metadata.amazonRating != null) {
|
||||
<span>({{ metadata.amazonRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.amazonReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.goodreadsRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.goodreadsRating)">
|
||||
</p-rating>
|
||||
@if (metadata.goodreadsRating != null) {
|
||||
<span>({{ metadata.goodreadsRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[7rem] max-w-[7rem] overflow-hidden truncate text-right">
|
||||
{{ metadata.goodreadsReviewCount ?? '' }}
|
||||
</td>
|
||||
<td class="min-w-[10rem] max-w-[10rem] overflow-hidden truncate">
|
||||
<span class="flex items-center gap-1">
|
||||
<p-rating
|
||||
[(ngModel)]="metadata.hardcoverRating"
|
||||
readonly
|
||||
stars="5"
|
||||
[style.--p-rating-icon-active-color]="getStarColor(metadata.hardcoverRating)">
|
||||
</p-rating>
|
||||
@if (metadata.hardcoverRating != null) {
|
||||
<span>({{ metadata.hardcoverRating?.toFixed(1) }})</span>
|
||||
}
|
||||
</span>
|
||||
</td>
|
||||
<td class="min-w-[6rem] max-w-[6rem] overflow-hidden truncate">{{ metadata.hardcoverReviewCount }}</td>
|
||||
</tr>
|
||||
}
|
||||
</ng-template>
|
||||
</p-table>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Component, EventEmitter, inject, Input, OnChanges, Output} from '@angular/core';
|
||||
import {TableModule} from 'primeng/table';
|
||||
import {DatePipe, NgIf} from '@angular/common';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import {Rating} from 'primeng/rating';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Book, BookMetadata} from '../../../model/book.model';
|
||||
@@ -17,12 +17,11 @@ import {Router} from '@angular/router';
|
||||
templateUrl: './book-table.component.html',
|
||||
imports: [
|
||||
TableModule,
|
||||
NgIf,
|
||||
Rating,
|
||||
FormsModule,
|
||||
Button,
|
||||
DatePipe
|
||||
],
|
||||
],
|
||||
styleUrl: './book-table.component.scss'
|
||||
})
|
||||
export class BookTableComponent implements OnChanges {
|
||||
|
||||
+12
-10
@@ -1,15 +1,17 @@
|
||||
<div class="p-4">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-x-24 gap-y-4">
|
||||
<div *ngFor="let field of lockableFields" class="flex items-center justify-between">
|
||||
<label class="capitalize">{{ fieldLabels[field] || field }}</label>
|
||||
<p-button
|
||||
[outlined]="true"
|
||||
[label]="getLockLabel(field)"
|
||||
[icon]="getLockIcon(field)"
|
||||
[severity]="fieldLocks[field] === true ? 'danger' : fieldLocks[field] === false ? 'success' : 'secondary'"
|
||||
(click)="cycleLockState(field)"
|
||||
></p-button>
|
||||
</div>
|
||||
@for (field of lockableFields; track field) {
|
||||
<div class="flex items-center justify-between">
|
||||
<label class="capitalize">{{ fieldLabels[field] || field }}</label>
|
||||
<p-button
|
||||
[outlined]="true"
|
||||
[label]="getLockLabel(field)"
|
||||
[icon]="getLockIcon(field)"
|
||||
[severity]="fieldLocks[field] === true ? 'danger' : fieldLocks[field] === false ? 'success' : 'secondary'"
|
||||
(click)="cycleLockState(field)"
|
||||
></p-button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+2
-3
@@ -1,7 +1,7 @@
|
||||
import {Component, inject, OnInit} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {NgForOf} from '@angular/common';
|
||||
|
||||
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
@@ -13,9 +13,8 @@ import {Divider} from 'primeng/divider';
|
||||
imports: [
|
||||
Button,
|
||||
FormsModule,
|
||||
NgForOf,
|
||||
Divider
|
||||
],
|
||||
],
|
||||
templateUrl: './lock-unlock-metadata-dialog.component.html',
|
||||
styleUrl: './lock-unlock-metadata-dialog.component.scss'
|
||||
})
|
||||
|
||||
@@ -9,32 +9,37 @@
|
||||
(input)="onSearchInputChange()"
|
||||
placeholder="Search books by title or author..."
|
||||
class="search-input"
|
||||
/>
|
||||
<p-button *ngIf="searchQuery" icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button>
|
||||
/>
|
||||
@if (searchQuery) {
|
||||
<p-button icon="pi pi-times" (click)="clearSearch()" [text]="true" [rounded]="true" class="clear-btn" aria-label="Clear Search"></p-button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="search-dropdown layout-menu pt-4" [class.show]="(books.length > 0)">
|
||||
<ng-container *ngIf="books.length > 0; else noResults">
|
||||
<div class="search-dropdown-item flex flex-col" *ngFor="let book of books" (click)="onBookClick(book)">
|
||||
<div class="flex flex-row w-full px-2">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)" alt="Book Cover" class="search-book-cover"/>
|
||||
<div class="search-book-details">
|
||||
<div class="flex items-center">
|
||||
<p class="search-book-name text-lg font-medium truncate">{{ book.metadata?.title | slice:0:70 }}</p>
|
||||
</div>
|
||||
<div *ngIf="book.metadata?.authors?.length ?? 0 > 0" class="search-book-authors">
|
||||
<p class="italic">by: {{ getAuthorNames(book.metadata?.authors) }}</p>
|
||||
@if (books.length > 0) {
|
||||
@for (book of books; track book) {
|
||||
<div class="search-dropdown-item flex flex-col" (click)="onBookClick(book)">
|
||||
<div class="flex flex-row w-full px-2">
|
||||
<img [attr.src]="urlHelper.getCoverUrl(book.id, book.metadata?.coverUpdatedOn)" alt="Book Cover" class="search-book-cover"/>
|
||||
<div class="search-book-details">
|
||||
<div class="flex items-center">
|
||||
<p class="search-book-name text-lg font-medium truncate">{{ book.metadata?.title | slice:0:70 }}</p>
|
||||
</div>
|
||||
@if (book.metadata?.authors?.length ?? 0 > 0) {
|
||||
<div class="search-book-authors">
|
||||
<p class="italic">by: {{ getAuthorNames(book.metadata?.authors) }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
<ng-template #noResults>
|
||||
}
|
||||
} @else {
|
||||
<div class="search-dropdown-item">
|
||||
<span>No results found</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import {FormsModule} from '@angular/forms';
|
||||
import {InputTextModule} from 'primeng/inputtext';
|
||||
import {BookService} from '../../service/book.service';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgForOf, NgIf, SlicePipe} from '@angular/common';
|
||||
import { SlicePipe } from '@angular/common';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {UrlHelperService} from '../../../utilities/service/url-helper.service';
|
||||
import {Router} from '@angular/router';
|
||||
@@ -18,11 +18,9 @@ import {Router} from '@angular/router';
|
||||
FormsModule,
|
||||
InputTextModule,
|
||||
Button,
|
||||
NgIf,
|
||||
NgForOf,
|
||||
SlicePipe,
|
||||
Divider
|
||||
],
|
||||
],
|
||||
styleUrls: ['./book-searcher.component.scss'],
|
||||
standalone: true
|
||||
})
|
||||
|
||||
@@ -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'
|
||||
})
|
||||
|
||||
+58
-52
@@ -1,59 +1,65 @@
|
||||
<div #epubContainer class="epub-viewer-container">
|
||||
<div *ngIf="isLoading" class="spinner-wrapper">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
<div *ngIf="!isLoading">
|
||||
|
||||
<div class="epub-header">
|
||||
|
||||
<div>
|
||||
<p-button size="small" class="menu-toggle-button" (click)="toggleDrawer()" icon="pi pi-bars" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isDrawerVisible" [modal]="false" [position]="'left'" header="Chapters">
|
||||
<ul class="chapter-list">
|
||||
<li *ngFor="let chapter of chapters" (click)="navigateToChapter(chapter); $event.stopPropagation()" class="chapter-item">
|
||||
{{ chapter.label }}
|
||||
</li>
|
||||
</ul>
|
||||
</p-drawer>
|
||||
</div>
|
||||
|
||||
<p>{{ currentChapter }}</p>
|
||||
|
||||
<div>
|
||||
<div class="flex gap-4">
|
||||
<div *ngIf="!locationsReady" class="location-indicator" pTooltip="Saving progress not ready yet">
|
||||
<span class="dot"></span>
|
||||
</div>
|
||||
<div>
|
||||
<p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="false" [position]="'right'" header="Settings">
|
||||
<div class="flex flex-col">
|
||||
<div class="settings-content">
|
||||
<p>Font Size: {{ fontSize }}%</p>
|
||||
<div class="flex flex-row gap-4">
|
||||
<p-button icon="pi pi-minus" (click)="decreaseFontSize()" severity="info"></p-button>
|
||||
<p-button icon="pi pi-plus" (click)="increaseFontSize()" severity="info"></p-button>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
<label for="font-type">Font Type:</label>
|
||||
<p-select id="font-type" [options]="fontTypes" [(ngModel)]="selectedFontType" (onChange)="changeFontType()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="theme">Theme:</label>
|
||||
<p-select id="theme" [options]="themes" [(ngModel)]="selectedTheme" (onChange)="changeThemes()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="flow">Flow:</label>
|
||||
<p-select id="flow" [options]="flows" [(ngModel)]="selectedFlow" (onChange)="changeScrollMode()"></p-select>
|
||||
</div>
|
||||
@if (isLoading) {
|
||||
<div class="spinner-wrapper">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
@if (!isLoading) {
|
||||
<div>
|
||||
<div class="epub-header">
|
||||
<div>
|
||||
<p-button size="small" class="menu-toggle-button" (click)="toggleDrawer()" icon="pi pi-bars" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isDrawerVisible" [modal]="false" [position]="'left'" header="Chapters">
|
||||
<ul class="chapter-list">
|
||||
@for (chapter of chapters; track chapter) {
|
||||
<li (click)="navigateToChapter(chapter); $event.stopPropagation()" class="chapter-item">
|
||||
{{ chapter.label }}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</p-drawer>
|
||||
</div>
|
||||
<p>{{ currentChapter }}</p>
|
||||
<div>
|
||||
<div class="flex gap-4">
|
||||
@if (!locationsReady) {
|
||||
<div class="location-indicator" pTooltip="Saving progress not ready yet">
|
||||
<span class="dot"></span>
|
||||
</div>
|
||||
</p-drawer>
|
||||
}
|
||||
<div>
|
||||
<p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="false" [position]="'right'" header="Settings">
|
||||
<div class="flex flex-col">
|
||||
<div class="settings-content">
|
||||
<p>Font Size: {{ fontSize }}%</p>
|
||||
<div class="flex flex-row gap-4">
|
||||
<p-button icon="pi pi-minus" (click)="decreaseFontSize()" severity="info"></p-button>
|
||||
<p-button icon="pi pi-plus" (click)="increaseFontSize()" severity="info"></p-button>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
<label for="font-type">Font Type:</label>
|
||||
<p-select id="font-type" [options]="fontTypes" [(ngModel)]="selectedFontType" (onChange)="changeFontType()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="theme">Theme:</label>
|
||||
<p-select id="theme" [options]="themes" [(ngModel)]="selectedTheme" (onChange)="changeThemes()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="flow">Flow:</label>
|
||||
<p-select id="flow" [options]="flows" [(ngModel)]="selectedFlow" (onChange)="changeScrollMode()"></p-select>
|
||||
</div>
|
||||
</div>
|
||||
</p-drawer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="epubContainer" #epubContainer></div>
|
||||
@if (selectedFlow !== 'scrolled') {
|
||||
<button class="epub-controls-left" (click)="prevPage()">←</button>
|
||||
}
|
||||
@if (selectedFlow !== 'scrolled') {
|
||||
<button class="epub-controls-right" (click)="nextPage()">→</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div id="epubContainer" #epubContainer></div>
|
||||
|
||||
<button *ngIf="selectedFlow !== 'scrolled'" class="epub-controls-left" (click)="prevPage()">←</button>
|
||||
<button *ngIf="selectedFlow !== 'scrolled'" class="epub-controls-right" (click)="nextPage()">→</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@ import {Component, ElementRef, inject, OnDestroy, OnInit, ViewChild} from '@angu
|
||||
import ePub, {EpubCFI} from 'epubjs';
|
||||
import {Drawer} from 'primeng/drawer';
|
||||
import {Button} from 'primeng/button';
|
||||
import {NgForOf, NgIf} from '@angular/common';
|
||||
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
@@ -66,7 +66,7 @@ export function getChapter(book: any, location: any) {
|
||||
selector: 'app-epub-viewer',
|
||||
templateUrl: './epub-viewer.component.html',
|
||||
styleUrls: ['./epub-viewer.component.scss'],
|
||||
imports: [Drawer, Button, NgForOf, FormsModule, Divider, Select, ProgressSpinner, NgIf, Tooltip],
|
||||
imports: [Drawer, Button, FormsModule, Divider, Select, ProgressSpinner, Tooltip],
|
||||
standalone: true
|
||||
})
|
||||
export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
<div *ngIf="isLoading" class="flex justify-center items-center h-screen relative">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
@if (isLoading) {
|
||||
<div class="flex justify-center items-center h-screen relative">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
}
|
||||
|
||||
<ngx-extended-pdf-viewer
|
||||
*ngIf="!isLoading"
|
||||
[src]="bookData"
|
||||
[handTool]="handTool"
|
||||
[height]="'auto'"
|
||||
[page]="page"
|
||||
[rotation]="rotation"
|
||||
[sidebarVisible]="false"
|
||||
[zoom]="zoom"
|
||||
[spread]="spread"
|
||||
[showBookModeButton]="false"
|
||||
(pagesLoaded)="onPdfPagesLoaded($event)"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(zoomChange)="onZoomChange($event)"
|
||||
(spreadChange)="onSpreadChange($event)">
|
||||
</ngx-extended-pdf-viewer>
|
||||
@if (!isLoading) {
|
||||
<ngx-extended-pdf-viewer
|
||||
[src]="bookData"
|
||||
[handTool]="handTool"
|
||||
[height]="'auto'"
|
||||
[page]="page"
|
||||
[rotation]="rotation"
|
||||
[sidebarVisible]="false"
|
||||
[zoom]="zoom"
|
||||
[spread]="spread"
|
||||
[showBookModeButton]="false"
|
||||
(pagesLoaded)="onPdfPagesLoaded($event)"
|
||||
(pageChange)="onPageChange($event)"
|
||||
(zoomChange)="onZoomChange($event)"
|
||||
(spreadChange)="onSpreadChange($event)">
|
||||
</ngx-extended-pdf-viewer>
|
||||
}
|
||||
|
||||
@@ -5,14 +5,14 @@ import {BookService} from '../../service/book.service';
|
||||
import {forkJoin, Subscription} from 'rxjs';
|
||||
import {BookSetting} from '../../model/book.model';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {NgIf} from '@angular/common';
|
||||
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {MessageService} from 'primeng/api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pdf-viewer',
|
||||
standalone: true,
|
||||
imports: [NgxExtendedPdfViewerModule, NgIf, ProgressSpinner],
|
||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner],
|
||||
templateUrl: './pdf-viewer.component.html',
|
||||
})
|
||||
export class PdfViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
<div class="flex flex-col flex-grow">
|
||||
<!-- Dynamic shelves content -->
|
||||
<div *ngFor="let shelf of (shelfState$ | async)?.shelves">
|
||||
<div class="flex flex-row items-center gap-4 py-2">
|
||||
<p-checkbox [inputId]="shelf.name" name="group" [value]="shelf" [(ngModel)]="selectedShelves"></p-checkbox>
|
||||
<label [for]="shelf.id">{{ shelf.name }}</label>
|
||||
@for (shelf of (shelfState$ | async)?.shelves; track shelf) {
|
||||
<div>
|
||||
<div class="flex flex-row items-center gap-4 py-2">
|
||||
<p-checkbox [inputId]="shelf.name" name="group" [value]="shelf" [(ngModel)]="selectedShelves"></p-checkbox>
|
||||
<label [for]="shelf.id">{{ shelf.name }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Button section, anchored to the bottom -->
|
||||
<div class="flex justify-between items-center pt-4 mt-auto">
|
||||
@@ -30,13 +32,17 @@
|
||||
</div>
|
||||
<div class="py-4">
|
||||
<label>Shelf Icon</label>
|
||||
<div *ngIf="!selectedIcon">
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||
</div>
|
||||
<div *ngIf="selectedIcon" class="flex items-center gap-4">
|
||||
<i [class]="selectedIcon"></i>
|
||||
<p-button icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
|
||||
</div>
|
||||
@if (!selectedIcon) {
|
||||
<div>
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||
</div>
|
||||
}
|
||||
@if (selectedIcon) {
|
||||
<div class="flex items-center gap-4">
|
||||
<i [class]="selectedIcon"></i>
|
||||
<p-button icon="pi pi-times" text="true" outlined="true" severity="warn" (onClick)="clearSelectedIcon()"></p-button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<ng-template pTemplate="footer">
|
||||
<p-button label="Cancel" severity="secondary" (onClick)="closeShelfDialog()" class="p-button-text"></p-button>
|
||||
|
||||
@@ -10,7 +10,7 @@ import {Shelf} from '../../model/shelf.model';
|
||||
import {IconPickerComponent} from '../../../utilities/component/icon-picker/icon-picker.component';
|
||||
import {ShelfState} from '../../model/state/shelf-state.model';
|
||||
import {Button} from 'primeng/button';
|
||||
import {AsyncPipe, NgForOf, NgIf} from '@angular/common';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import {Checkbox} from 'primeng/checkbox';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Dialog} from 'primeng/dialog';
|
||||
@@ -22,16 +22,14 @@ import {InputText} from 'primeng/inputtext';
|
||||
templateUrl: './shelf-assigner.component.html',
|
||||
imports: [
|
||||
Button,
|
||||
NgForOf,
|
||||
Checkbox,
|
||||
AsyncPipe,
|
||||
FormsModule,
|
||||
IconPickerComponent,
|
||||
Dialog,
|
||||
InputText,
|
||||
NgIf,
|
||||
PrimeTemplate
|
||||
],
|
||||
],
|
||||
styleUrls: ['./shelf-assigner.component.scss']
|
||||
})
|
||||
export class ShelfAssignerComponent implements OnInit {
|
||||
|
||||
+11
-7
@@ -6,13 +6,17 @@
|
||||
</div>
|
||||
<div class="flex items-center gap-5">
|
||||
<p>Shelf Icon:</p>
|
||||
<div *ngIf="!selectedIcon">
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||
</div>
|
||||
<div *ngIf="selectedIcon">
|
||||
<i [class]="selectedIcon" class="text-xl mr-3"></i>
|
||||
<p-button icon="pi pi-times" (onClick)="clearSelectedIcon()" [rounded]="true" [text]="true" [outlined]="true" severity="danger"></p-button>
|
||||
</div>
|
||||
@if (!selectedIcon) {
|
||||
<div>
|
||||
<p-button label="Select Icon" icon="pi pi-search" (onClick)="openIconPicker()"></p-button>
|
||||
</div>
|
||||
}
|
||||
@if (selectedIcon) {
|
||||
<div>
|
||||
<i [class]="selectedIcon" class="text-xl mr-3"></i>
|
||||
<p-button icon="pi pi-times" (onClick)="clearSelectedIcon()" [rounded]="true" [text]="true" [outlined]="true" severity="danger"></p-button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
|
||||
+2
-3
@@ -4,7 +4,7 @@ import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {Button} from 'primeng/button';
|
||||
import {IconPickerComponent} from '../../../utilities/component/icon-picker/icon-picker.component';
|
||||
import {InputText} from 'primeng/inputtext';
|
||||
import {NgIf} from '@angular/common';
|
||||
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {Shelf} from '../../model/shelf.model';
|
||||
import {MessageService} from 'primeng/api';
|
||||
@@ -15,10 +15,9 @@ import {MessageService} from 'primeng/api';
|
||||
Button,
|
||||
IconPickerComponent,
|
||||
InputText,
|
||||
NgIf,
|
||||
ReactiveFormsModule,
|
||||
FormsModule
|
||||
],
|
||||
],
|
||||
templateUrl: './shelf-edit-dialog.component.html',
|
||||
standalone: true,
|
||||
styleUrl: './shelf-edit-dialog.component.scss'
|
||||
|
||||
Reference in New Issue
Block a user