470 lines
20 KiB
HTML
470 lines
20 KiB
HTML
<ng-container *transloco="let t; prefix: 'book.browser'">
|
|
<div class="book-browser-container">
|
|
<div class="book-browser-main">
|
|
|
|
<div class="book-browser-header">
|
|
<div class="entity-info-wrapper">
|
|
@if (entityType(); as entityType) {
|
|
<div class="entity-info">
|
|
<p class="entity-title">
|
|
@if (entityType === EntityType.ALL_BOOKS) {
|
|
@if (currentFilterLabel() && rawFilterParamFromUrl()) {
|
|
{{ currentFilterLabel() }}
|
|
} @else if (isFilterActive() || hasSearchTerm()) {
|
|
{{ computedFilterLabel() }}
|
|
} @else {
|
|
{{ t('labels.allBooks') }}
|
|
}
|
|
} @else if (entityType === EntityType.UNSHELVED) {
|
|
{{ (isFilterActive() || hasSearchTerm()) ? t('labels.unshelvedBooksFiltered') : t('labels.unshelvedBooks') }}
|
|
} @else {
|
|
{{ entityType }}: {{ entity()?.name }}{{ (isFilterActive() || hasSearchTerm()) ? ' ' + t('labels.filteredSuffix') : '' }}
|
|
}
|
|
</p>
|
|
@if (!showBooksLoadingPlaceholder() && seriesCollapseFilter.seriesCollapsed() && books(); as books) {
|
|
<p class="series-collapsed-info">
|
|
{{ t('labels.seriesCollapsedInfo', { count: books.length, itemWord: books.length === 1 ? t('labels.item') : t('labels.items') }) }}
|
|
</p>
|
|
}
|
|
</div>
|
|
|
|
@if (entityMenuTarget(); as menuTarget) {
|
|
<div class="entity-menu-wrapper">
|
|
<app-library-shelf-menu
|
|
#entityMenu
|
|
[target]="menuTarget"
|
|
[ariaLabel]="'common.moreActionsFor' | transloco: {label: menuTarget.entity.name}" />
|
|
@if (entityMenu.available()) {
|
|
<button
|
|
pButton
|
|
type="button"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
[attr.aria-label]="'common.moreActionsFor' | transloco: {label: menuTarget.entity.name}"
|
|
[appMenuTriggerFor]="entityMenu.menu()">
|
|
<i class="pi pi-ellipsis-v" aria-hidden="true"></i>
|
|
</button>
|
|
}
|
|
</div>
|
|
}
|
|
}
|
|
</div>
|
|
<div class="toolbar-actions">
|
|
<div class="toolbar-icons">
|
|
@if (isFilterActive()) {
|
|
<a class="toolbar-item" role="button" tabindex="0" (click)="clearFilter()" (keydown.enter)="clearFilter()">
|
|
<i
|
|
class="pi pi-filter-slash filter-clear-icon"
|
|
[pTooltip]="t('tooltip.clearFilters')"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
}
|
|
|
|
@if (currentViewMode() === 'table') {
|
|
<div>
|
|
<a class="toolbar-item" role="button" tabindex="0" (click)="columnPopover.toggle($event)" (keydown.enter)="columnPopover.toggle($event)">
|
|
<i
|
|
class="pi pi-eye"
|
|
[pTooltip]="t('tooltip.visibleColumns')"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
<p-popover #columnPopover [dismissable]="true" appendTo="body">
|
|
<div class="column-popover-content">
|
|
<p-multiSelect
|
|
optionLabel="header"
|
|
[options]="columnPreferenceService.allColumns"
|
|
[ngModel]="visibleColumns()"
|
|
(ngModelChange)="onVisibleColumnsChange($event)"
|
|
display="chip"
|
|
[placeholder]="t('placeholder.selectColumns')"
|
|
[style]="{ width: '100%' }"
|
|
[filter]="true"
|
|
[showClear]="true"
|
|
></p-multiSelect>
|
|
</div>
|
|
<div class="column-popover-footer">
|
|
<p>{{ t('labels.setAsDefault') }}</p>
|
|
<p-button
|
|
[label]="t('labels.save')"
|
|
outlined
|
|
size="small"
|
|
(click)="columnPreferenceService.saveVisibleColumns(visibleColumns())"></p-button>
|
|
</div>
|
|
</p-popover>
|
|
</div>
|
|
}
|
|
<a class="toolbar-item" role="button" tabindex="0" (click)="toggleTableGrid()" (keydown.enter)="toggleTableGrid()">
|
|
<i
|
|
[class]="viewIcon()"
|
|
[pTooltip]="t('tooltip.toggleView')"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
<div>
|
|
<a
|
|
class="toolbar-item"
|
|
role="button"
|
|
tabindex="0"
|
|
(click)="seriesCollapseOverlay.toggle($event)"
|
|
(keydown.enter)="seriesCollapseOverlay.toggle($event)"
|
|
[pTooltip]="'common.displaySettings' | transloco"
|
|
tooltipPosition="top">
|
|
<i class="pi pi-cog"></i>
|
|
</a>
|
|
<p-popover
|
|
#seriesCollapseOverlay
|
|
[dismissable]="true"
|
|
appendTo="body">
|
|
<div class="display-settings-popover">
|
|
<div class="display-settings-section">
|
|
<div class="display-settings-checkbox-row">
|
|
<p-checkbox
|
|
inputId="collapse-series-checkbox"
|
|
[binary]="true"
|
|
[ngModel]="seriesCollapseFilter.seriesCollapsed()"
|
|
(onChange)="onSeriesCollapseCheckboxChange($event.checked)">
|
|
</p-checkbox>
|
|
<label for="collapse-series-checkbox" class="display-settings-label">{{ t('labels.collapseSeries') }}</label>
|
|
</div>
|
|
</div>
|
|
<div class="display-settings-section">
|
|
<span class="display-settings-label">{{ 'common.cardSize' | transloco }}</span>
|
|
<app-grid-density-buttons
|
|
[smallerDisabled]="gridDensitySmallerDisabled()"
|
|
[largerDisabled]="gridDensityLargerDisabled()"
|
|
(densityChange)="adjustGridDensity($event)"/>
|
|
</div>
|
|
<div class="display-settings-section">
|
|
<div class="display-settings-checkbox-row">
|
|
<p-checkbox
|
|
inputId="show-book-type-pill-checkbox"
|
|
[binary]="true"
|
|
[ngModel]="bookCardOverlayPreferenceService.showBookTypePill()"
|
|
(onChange)="bookCardOverlayPreferenceService.setShowBookTypePill($event.checked)">
|
|
</p-checkbox>
|
|
<label for="show-book-type-pill-checkbox" class="display-settings-label">{{ t('labels.bookTypeOverlay') }}</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</p-popover>
|
|
</div>
|
|
|
|
<div class="sort-button-wrapper">
|
|
<a class="toolbar-item" role="button" tabindex="0" (click)="sortPopover.toggle($event)" (keydown.enter)="sortPopover.toggle($event)">
|
|
<i
|
|
class="pi pi-sort"
|
|
[pTooltip]="t('tooltip.selectSorting')"
|
|
tooltipPosition="top">
|
|
</i>
|
|
@if (sortCriteriaCount() > 1) {
|
|
<p-badge [value]="sortCriteriaCount().toString()" class="sort-badge"/>
|
|
}
|
|
</a>
|
|
<p-popover #sortPopover [dismissable]="true" appendTo="body">
|
|
<app-multi-sort-popover
|
|
[sortCriteria]="this.bookSorter.selectedSortCriteria"
|
|
[availableSortOptions]="visibleSortOptions()"
|
|
[showSaveButton]="canSaveSort()"
|
|
(criteriaChange)="onSortCriteriaChange($event)"
|
|
(saveSortConfig)="onSaveSortConfig($event)">
|
|
</app-multi-sort-popover>
|
|
</p-popover>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- MOBILE SEARCH (only visible below md) -->
|
|
<div class="mobile-search-wrapper">
|
|
<button
|
|
type="button"
|
|
class="toolbar-item"
|
|
(click)="searchDropdown.toggle($event)"
|
|
[pTooltip]="t('tooltip.search')"
|
|
tooltipPosition="top"
|
|
>
|
|
<i class="pi pi-search"></i>
|
|
</button>
|
|
|
|
<p-popover #searchDropdown [dismissable]="true" appendTo="body" [style]="{ width: '21rem' }">
|
|
<div class="search-popover-content">
|
|
<input
|
|
type="text"
|
|
pInputText
|
|
[placeholder]="t('placeholder.search')"
|
|
[ngModel]="bookTitle()"
|
|
(ngModelChange)="onSearchTermChange($event)"
|
|
aria-label="{{ t('placeholder.search') }}"
|
|
class="search-input-full"
|
|
/>
|
|
<p-button
|
|
icon="pi pi-times"
|
|
[text]="true"
|
|
size="small"
|
|
[rounded]="true"
|
|
class="search-clear-btn"
|
|
(click)="clearSearch(); searchDropdown.hide()"
|
|
></p-button>
|
|
</div>
|
|
</p-popover>
|
|
</div>
|
|
|
|
<div class="desktop-search-wrapper">
|
|
<i class="pi pi-search search-icon"></i>
|
|
<input
|
|
type="text"
|
|
pInputText
|
|
[placeholder]="t('placeholder.search')"
|
|
[ngModel]="bookTitle()"
|
|
(ngModelChange)="onSearchTermChange($event)"
|
|
aria-label="{{ t('placeholder.search') }}"
|
|
class="search-input"
|
|
/>
|
|
@if (bookTitle()) {
|
|
<p-button
|
|
icon="pi pi-times"
|
|
[text]="true"
|
|
size="small"
|
|
[rounded]="true"
|
|
class="search-clear-btn"
|
|
(click)="clearSearch()"
|
|
></p-button>
|
|
}
|
|
</div>
|
|
|
|
<a class="toolbar-item" role="button" tabindex="0" (click)="toggleSidebar()" (keydown.enter)="toggleSidebar()">
|
|
<i
|
|
[ngClass]="showFilter() ? 'pi pi-filter-fill' : 'pi pi-filter'"
|
|
[pTooltip]="t('tooltip.toggleSidebar')"
|
|
tooltipPosition="top">
|
|
</i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="book-browser-body">
|
|
<div class="book-browser-content">
|
|
@if (booksError()) {
|
|
<div class="no-books-container">
|
|
<p class="no-books-text">
|
|
@switch (entityType()) {
|
|
@case (EntityType.LIBRARY) {
|
|
{{ t('labels.failedLibrary') }}
|
|
}
|
|
@case (EntityType.SHELF) {
|
|
{{ t('labels.failedShelf') }}
|
|
}
|
|
@default {
|
|
{{ t('labels.failedBooks') }}
|
|
}
|
|
}
|
|
</p>
|
|
</div>
|
|
} @else {
|
|
@let visibleBooks = books();
|
|
@if (visibleBooks.length === 0 && !showBooksLoadingPlaceholder()) {
|
|
<div class="no-books-container">
|
|
<p class="no-books-text">
|
|
{{ t('labels.noBooks') }}
|
|
</p>
|
|
</div>
|
|
}
|
|
@if (currentViewMode() === 'table' && (visibleBooks.length > 0 || showTableLoadingPlaceholder())) {
|
|
<app-book-table
|
|
[books]="visibleBooks"
|
|
[virtualRowCount]="virtualRowCount()"
|
|
[loadedBookCount]="loadedBookCount()"
|
|
[isFetchingNextPage]="isFetchingNextBooksPage()"
|
|
[bookQueryToken]="bookQueryToken()"
|
|
(selectAllRequested)="selectAllBooks()"
|
|
(loadNextPage)="loadNextBooksPage()"
|
|
[visibleColumns]="visibleColumns()"
|
|
[useSquareCovers]="isAudiobookOnlyLibrary()"
|
|
></app-book-table>
|
|
}
|
|
@if (currentViewMode() === 'grid') {
|
|
<div #scrollElement class="virtual-scroller">
|
|
<div class="virtual-content" [style.height.px]="virtualGrid.virtualizer.getTotalSize()">
|
|
@for (virtualItem of virtualGrid.virtualizer.getVirtualItems(); track virtualItem.key) {
|
|
@if (visibleBooks[virtualItem.index]; as book) {
|
|
<div
|
|
class="virtual-cell"
|
|
[style.width.px]="virtualGrid.itemWidth()"
|
|
[style.height.px]="virtualItem.size"
|
|
[style.transform]="virtualGrid.itemTransform(virtualItem)">
|
|
<app-book-card
|
|
[index]="virtualItem.index"
|
|
[book]="book"
|
|
[isCheckboxEnabled]="true"
|
|
[seriesViewEnabled]="seriesViewEnabled()"
|
|
[onBookSelect]="onBookCardSelect"
|
|
[isSeriesCollapsed]="seriesCollapseFilter.seriesCollapsed()"
|
|
(checkboxClick)="onCheckboxClicked($event)"
|
|
[isSelected]="bookSelectionService.isBookSelected(book)"
|
|
[useSquareCovers]="isAudiobookOnlyLibrary()"
|
|
[overlayPreferenceService]="bookCardOverlayPreferenceService">
|
|
</app-book-card>
|
|
</div>
|
|
} @else {
|
|
<div
|
|
class="virtual-cell virtual-loader-cell"
|
|
[style.width.px]="virtualGrid.itemWidth()"
|
|
[style.height.px]="virtualItem.size"
|
|
[style.transform]="virtualGrid.itemTransform(virtualItem)"></div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
@if (userService.currentUser(); as currentUser) {
|
|
<div class="book-browser-footer" [class.footer-hidden]="selectedCount() === 0">
|
|
<div class="footer-content">
|
|
<div class="footer-left">
|
|
<div class="selected-count-badge">
|
|
<i class="pi pi-check-circle"></i>
|
|
<span class="selected-count">{{ selectedCount() }}</span>
|
|
<span class="selected-label">{{ t('labels.selected') }}</span>
|
|
</div>
|
|
</div>
|
|
<div class="footer-center">
|
|
@if (entityType(); as entityType) {
|
|
<div class="action-buttons-group">
|
|
@if (hasMetadataMenuItems()) {
|
|
<p-tieredMenu #menu [model]="metadataMenuItems" [popup]="true" appendTo="body" styleClass="footer-menu"/>
|
|
<p-button
|
|
(click)="menu.toggle($event)"
|
|
[pTooltip]="t('tooltip.metadataActions')"
|
|
tooltipPosition="top"
|
|
outlined="true"
|
|
severity="info"
|
|
icon="pi pi-database">
|
|
</p-button>
|
|
}
|
|
<p-button
|
|
icon="pi pi-bookmark-fill"
|
|
outlined="true"
|
|
severity="info"
|
|
(onClick)="openShelfAssigner()"
|
|
[pTooltip]="t('tooltip.assignToShelf')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
@if (entityType === EntityType.SHELF) {
|
|
<p-button
|
|
icon="pi pi-bookmark"
|
|
outlined="true"
|
|
severity="info"
|
|
(click)="unshelfBooks()"
|
|
[pTooltip]="t('tooltip.removeFromShelf')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
}
|
|
@if (currentUser.permissions.canBulkLockUnlockMetadata) {
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-lock"
|
|
severity="info"
|
|
(click)="lockUnlockMetadata()"
|
|
[pTooltip]="t('tooltip.lockUnlockMetadata')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
}
|
|
@if (currentUser.permissions.canMoveOrganizeFiles && appSettingsService.appSettings()?.diskType === 'LOCAL') {
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-arrows-h"
|
|
severity="info"
|
|
(click)="moveFiles()"
|
|
[pTooltip]="t('tooltip.organizeFiles')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
}
|
|
@if (currentUser.permissions.canManageLibrary || currentUser.permissions.admin) {
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-link"
|
|
severity="info"
|
|
(click)="attachFilesToBook()"
|
|
[disabled]="!canAttachFiles()"
|
|
[pTooltip]="t('tooltip.attachToBook')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
}
|
|
@if (hasMoreActionsItems()) {
|
|
<div class="more-actions-wrapper">
|
|
<p-button
|
|
(click)="menu.toggle($event)"
|
|
[pTooltip]="t('tooltip.moreActions')"
|
|
tooltipPosition="top"
|
|
outlined="true"
|
|
severity="info"
|
|
icon="pi pi-ellipsis-v">
|
|
</p-button>
|
|
<p-tieredMenu #menu [model]="moreActionsMenuItems" [popup]="true" appendTo="body" styleClass="footer-menu"/>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
<p-divider layout="vertical"></p-divider>
|
|
<div class="action-buttons-group">
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-check-square"
|
|
severity="success"
|
|
(click)="selectAllBooks()"
|
|
[pTooltip]="t('tooltip.selectAll')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-times"
|
|
severity="warn"
|
|
(click)="deselectAllBooks()"
|
|
[pTooltip]="t('tooltip.deselectAll')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
</div>
|
|
@if (currentUser?.permissions?.admin || currentUser?.permissions?.canDeleteBook) {
|
|
<p-divider layout="vertical"></p-divider>
|
|
<p-button
|
|
outlined="true"
|
|
icon="pi pi-trash"
|
|
severity="danger"
|
|
(click)="confirmDeleteBooks()"
|
|
[pTooltip]="t('tooltip.deleteSelected')"
|
|
tooltipPosition="top">
|
|
</p-button>
|
|
}
|
|
</div>
|
|
<div class="footer-right"></div>
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
</div>
|
|
|
|
@if (showFilter()) {
|
|
<div
|
|
class="mobile-filter-mask"
|
|
role="button"
|
|
tabindex="0"
|
|
(click)="toggleSidebar()"
|
|
(keydown.enter)="toggleSidebar()">
|
|
</div>
|
|
}
|
|
<app-book-filter
|
|
[showFilter]="showFilter()"
|
|
class="filter-overlay-container"
|
|
[ngClass]="{ 'active': showFilter() }"
|
|
[entity]="entity()"
|
|
[entityType]="entityType()"
|
|
[style.display]="showFilter() ? '' : 'none'"
|
|
(filterSelected)="onFilterSelected($event)"
|
|
(filterModeChanged)="onFilterModeChanged($event)">
|
|
</app-book-filter>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</ng-container>
|