155 lines
5.7 KiB
HTML
155 lines
5.7 KiB
HTML
<div class="flex flex-row">
|
|
<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" 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>
|
|
<div *ngIf="entityType !== EntityType.ALL_BOOKS">
|
|
<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>
|
|
</ng-container>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-8">
|
|
|
|
<a *ngIf="isFilterActive" class="topbar-items topbar-item" (click)="clearFilter()">
|
|
<i
|
|
class="pi pi-filter-slash"
|
|
pTooltip="Clear applied filters"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
|
|
<a class="topbar-items topbar-item">
|
|
<i
|
|
class="pi pi-sort"
|
|
pTooltip="Select sorting"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
|
|
<a class="topbar-items topbar-item" (click)="toggleTableGrid()">
|
|
<i
|
|
[ngClass]="viewIcon"
|
|
pTooltip="Toggle between Grid and Table view"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
|
|
<p-fluid>
|
|
<input type="text" pInputText placeholder="Search title or author..." [(ngModel)]="bookTitle" (ngModelChange)="onBookTitleChange($event)"/>
|
|
</p-fluid>
|
|
|
|
<p-select
|
|
[options]="sortOptions"
|
|
optionLabel="label"
|
|
placeholder="Select Sorting"
|
|
[(ngModel)]="selectedSort"
|
|
(onChange)="updateSortOption($event.value)"/>
|
|
|
|
<!--<p-button
|
|
[icon]="viewIcon"
|
|
size="large"
|
|
[rounded]="true"
|
|
text="true"
|
|
pTooltip="Toggle between Grid and Table view"
|
|
tooltipPosition="top"
|
|
(click)="toggleTableGrid()"/>-->
|
|
|
|
<!--<p-button
|
|
*ngIf="isFilterActive"
|
|
icon="pi pi-filter-slash"
|
|
size="large"
|
|
[rounded]="true"
|
|
text="true"
|
|
(click)="clearFilter()"
|
|
pTooltip="Clear applied filters"
|
|
tooltipPosition="top"/>-->
|
|
|
|
<p-button
|
|
class="pr-2"
|
|
icon="pi pi-chevron-right"
|
|
size="large"
|
|
[outlined]="true"
|
|
[rounded]="true"
|
|
(click)="toggleFilterSidebar()"
|
|
pTooltip="Toggle filter sidebar"
|
|
tooltipPosition="top"/>
|
|
</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">
|
|
{{ entityType === EntityType.LIBRARY ? "This library has no books!" : "This shelf has no books!" }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="book-card-container" *ngIf="bookState?.books as books">
|
|
<app-book-table *ngIf="gridOrTable === 'table' && books.length > 0" [books]="books" (selectedBooksChange)="onSelectedBooksChange($event)"
|
|
[sortOption]="selectedSort"></app-book-table>
|
|
|
|
<virtual-scroller *ngIf="gridOrTable === 'grid'" class="virtual-scroller" #scroll [items]="books">
|
|
<div class="grid grid-cols-12 gap-4" #container>
|
|
<div class="virtual-scroller-item" *ngFor="let book of scroll.viewPortItems">
|
|
<app-book-card
|
|
[book]="book"
|
|
[isCheckboxEnabled]="true"
|
|
[onBookSelect]="handleBookSelect.bind(this)"
|
|
[isSelected]="selectedBooks.has(book.id)">
|
|
</app-book-card>
|
|
</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"
|
|
label="Assign Shelf"
|
|
severity="info"
|
|
(onClick)="openShelfAssigner()">
|
|
</p-button>
|
|
<p-button *ngIf="entityType === EntityType.SHELF"
|
|
label="Unshelf"
|
|
severity="info"
|
|
(click)="unshelfBooks()">
|
|
</p-button>
|
|
<p-button
|
|
label="Refresh Metadata"
|
|
severity="info"
|
|
(click)="updateMetadata()">
|
|
</p-button>
|
|
<p-button
|
|
label="Deselect All"
|
|
severity="warn"
|
|
(click)="deselectAllBooks()">
|
|
</p-button>
|
|
</ng-container>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<app-book-filter [entity$]="entity$" [entityType$]="entityType$"></app-book-filter>
|
|
|
|
</div>
|