feat: comic metadata picker, lazy-load providers, and UI improvements (#2679)
* feat: add comic metadata support to metadata picker and fix Comicvine parser * feat: lazy-load Comicvine issue details on selection * feat: lazy-load detail metadata for Amazon, GoodReads, and Audible parsers * fix: prevent spurious comic_metadata row creation for non-comic books * fix: extract rich previews from Audible search and reorder picker sections * feat: redesign metadata editor layout with collapsible sections and boolean selects * fix: implement per-field comic metadata locks replacing grouped locks * feat: add comic metadata filters and fix visibleFilters backend support * fix: use human-readable role labels in comic creator filter * fix: auto-populate comic metadata from ComicVine during metadata fetch * refactor: clean up ComicvineBookParser remove duplication and comments * fix: use ComicMetadata webLink for ComicVine favicon URL * fix: cache library options to prevent Set All dropdowns from resetting * fix: stream book content from disk instead of loading entire file into memory * fix: increase max visible filters from 15 to 20 * feat: replace filter multiselect with drag-and-drop reorderable list * fix: use audiobook-specific cover paths and cache busting for audiobook thumbnail updates * chore: enforce mandatory screenshots and stricter testing requirements in PR template * fix: update BookServiceTest to match Resource return type after streaming change --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -64,11 +64,11 @@
|
||||
</label>
|
||||
@if (!fontsLoadedInBrowser) {
|
||||
<div class="font-preview-skeleton">
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="100%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="60%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" styleClass="mb-3"></p-skeleton>
|
||||
<p-skeleton width="100%" height="1rem" class="mb-3"></p-skeleton>
|
||||
<p-skeleton width="100%" height="1rem" class="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" class="mb-3"></p-skeleton>
|
||||
<p-skeleton width="60%" height="1rem" class="mb-3"></p-skeleton>
|
||||
<p-skeleton width="85%" height="1rem" class="mb-3"></p-skeleton>
|
||||
<p-skeleton width="95%" height="0.875rem"></p-skeleton>
|
||||
</div>
|
||||
} @else {
|
||||
|
||||
+9
-1
@@ -39,11 +39,13 @@ export class LibraryMetadataSettingsComponent implements OnInit {
|
||||
activePanel: number | null = null;
|
||||
sidecarExporting: Record<number, boolean> = {};
|
||||
sidecarImporting: Record<number, boolean> = {};
|
||||
private cachedDefaultOptions: Record<number, MetadataRefreshOptions> = {};
|
||||
|
||||
ngOnInit() {
|
||||
this.appSettingsService.appSettings$.subscribe(appSettings => {
|
||||
if (appSettings) {
|
||||
this.defaultMetadataOptions = appSettings.defaultMetadataRefreshOptions;
|
||||
this.cachedDefaultOptions = {};
|
||||
this.initializeLibraryOptions(appSettings);
|
||||
this.updateLibraryOptionsFromSettings(appSettings);
|
||||
}
|
||||
@@ -80,7 +82,13 @@ export class LibraryMetadataSettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
getLibraryOptions(libraryId: number): MetadataRefreshOptions {
|
||||
return this.libraryMetadataOptions[libraryId] || {...this.defaultMetadataOptions, libraryId};
|
||||
if (this.libraryMetadataOptions[libraryId]) {
|
||||
return this.libraryMetadataOptions[libraryId];
|
||||
}
|
||||
if (!this.cachedDefaultOptions[libraryId]) {
|
||||
this.cachedDefaultOptions[libraryId] = {...this.defaultMetadataOptions, libraryId};
|
||||
}
|
||||
return this.cachedDefaultOptions[libraryId];
|
||||
}
|
||||
|
||||
trackByLibrary(index: number, library: Library): number | undefined {
|
||||
|
||||
@@ -291,7 +291,7 @@
|
||||
header="Create OPDS User"
|
||||
[(visible)]="showCreateUserDialog"
|
||||
[modal]="true"
|
||||
styleClass="user-dialog"
|
||||
class="user-dialog"
|
||||
[style]="{width: '400px'}">
|
||||
<div class="dialog-form">
|
||||
<div class="form-field">
|
||||
|
||||
+1
-1
@@ -424,7 +424,7 @@
|
||||
header="Change Password"
|
||||
[(visible)]="isPasswordDialogVisible"
|
||||
[modal]="true"
|
||||
styleClass="user-dialog"
|
||||
class="user-dialog"
|
||||
[style]="{width: '400px'}">
|
||||
<div class="dialog-form">
|
||||
<div class="form-field">
|
||||
|
||||
@@ -193,7 +193,8 @@ export type VisibleFilterType =
|
||||
| 'personalRating' | 'publisher' | 'matchScore' | 'library' | 'shelf'
|
||||
| 'shelfStatus' | 'tag' | 'publishedDate' | 'fileSize' | 'amazonRating'
|
||||
| 'goodreadsRating' | 'hardcoverRating' | 'language' | 'pageCount' | 'mood'
|
||||
| 'ageRating' | 'contentRating';
|
||||
| 'ageRating' | 'contentRating'
|
||||
| 'comicCharacter' | 'comicTeam' | 'comicLocation' | 'comicCreator';
|
||||
|
||||
export const DEFAULT_VISIBLE_FILTERS: VisibleFilterType[] = [
|
||||
'author', 'category', 'series', 'bookType', 'readStatus',
|
||||
@@ -223,7 +224,11 @@ export const ALL_FILTER_OPTIONS: { label: string; value: VisibleFilterType }[] =
|
||||
{label: 'Mood', value: 'mood'},
|
||||
{label: 'Amazon Rating', value: 'amazonRating'},
|
||||
{label: 'Goodreads Rating', value: 'goodreadsRating'},
|
||||
{label: 'Hardcover Rating', value: 'hardcoverRating'}
|
||||
{label: 'Hardcover Rating', value: 'hardcoverRating'},
|
||||
{label: 'Comic Character', value: 'comicCharacter'},
|
||||
{label: 'Comic Team', value: 'comicTeam'},
|
||||
{label: 'Comic Location', value: 'comicLocation'},
|
||||
{label: 'Comic Creator', value: 'comicCreator'}
|
||||
];
|
||||
|
||||
export interface UserSettings {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
[rounded]="true"
|
||||
severity="secondary"
|
||||
(onClick)="closeDialog()"
|
||||
styleClass="close-button">
|
||||
class="close-button">
|
||||
</p-button>
|
||||
</div>
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
id="confirmNewPassword"
|
||||
formControlName="confirmNewPassword"
|
||||
[feedback]="false"
|
||||
styleClass="field-input"
|
||||
class="field-input"
|
||||
[inputStyle]="{'width': '100%'}">
|
||||
</p-password>
|
||||
@if (changePasswordForm.get('confirmNewPassword')?.invalid &&
|
||||
|
||||
+50
-18
@@ -31,26 +31,58 @@
|
||||
<label class="setting-label">Visible Filters</label>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
Select which filters appear in the filter sidebar. Choose between {{ minFilters }} and {{ maxFilters }} filters.
|
||||
Choose which filters appear in the sidebar and drag to reorder. Between {{ minFilters }} and {{ maxFilters }} filters.
|
||||
<span class="filter-count">({{ selectionCountText }})</span>
|
||||
</p>
|
||||
<div class="setting-options">
|
||||
<p-multiselect
|
||||
[options]="allFilterOptions"
|
||||
[(ngModel)]="selectedVisibleFilters"
|
||||
(ngModelChange)="onVisibleFiltersChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
[showClear]="false"
|
||||
[filter]="true"
|
||||
filterPlaceHolder="Search filters..."
|
||||
placeholder="Select filters"
|
||||
display="chip"
|
||||
appendTo="body"
|
||||
[maxSelectedLabels]="5"
|
||||
selectedItemsLabel="{0} filters selected"
|
||||
styleClass="visible-filters-select">
|
||||
</p-multiselect>
|
||||
<div class="filter-order-editor">
|
||||
<div
|
||||
#filterList
|
||||
class="filter-order-list"
|
||||
cdkDropList
|
||||
[cdkDropListData]="selectedVisibleFilters"
|
||||
(cdkDropListDropped)="onDrop($event)">
|
||||
@for (f of selectedVisibleFilters; track f; let i = $index) {
|
||||
<div class="filter-order-row" cdkDrag>
|
||||
<div class="filter-drag-handle" cdkDragHandle>
|
||||
<i class="pi pi-bars"></i>
|
||||
</div>
|
||||
<span class="filter-rank">{{ i + 1 }}.</span>
|
||||
<span class="filter-label">{{ getFilterLabel(f) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="remove-filter-btn"
|
||||
(click)="removeFilter(i)"
|
||||
[disabled]="selectedVisibleFilters.length <= minFilters"
|
||||
pTooltip="Remove"
|
||||
tooltipPosition="top">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
@if (availableFilters.length > 0 && selectedVisibleFilters.length < maxFilters) {
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="availableFilters"
|
||||
[(ngModel)]="selectedAddFilter"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Add filter..."
|
||||
[style]="{ width: '200px' }"
|
||||
appendTo="body"
|
||||
(onChange)="addFilter()">
|
||||
</p-select>
|
||||
}
|
||||
<button
|
||||
type="button"
|
||||
class="reset-btn"
|
||||
(click)="resetToDefaults()"
|
||||
pTooltip="Reset to defaults"
|
||||
tooltipPosition="top">
|
||||
<i class="pi pi-refresh"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+141
-10
@@ -47,19 +47,150 @@
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
p-multiselect {
|
||||
min-width: 300px;
|
||||
max-width: 100%;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
min-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.filter-count {
|
||||
font-weight: 500;
|
||||
color: var(--p-primary-color);
|
||||
}
|
||||
|
||||
// Filter order editor styles
|
||||
.filter-order-editor {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.filter-order-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-height: 40px;
|
||||
max-height: 320px;
|
||||
max-width: 350px;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.filter-order-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
background-color: var(--overlay-background);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
cursor: move;
|
||||
transition: background-color 0.15s ease, box-shadow 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--ground-background);
|
||||
}
|
||||
}
|
||||
|
||||
.cdk-drag-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.35rem 0.75rem;
|
||||
background-color: var(--card-background);
|
||||
border: 1px solid var(--primary-color);
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.cdk-drag-placeholder {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.cdk-drag-animating {
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.filter-order-list.cdk-drop-list-dragging .filter-order-row:not(.cdk-drag-placeholder) {
|
||||
transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.filter-drag-handle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-secondary-color);
|
||||
cursor: grab;
|
||||
|
||||
&:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-rank {
|
||||
font-weight: 600;
|
||||
color: var(--primary-color);
|
||||
min-width: 1.75rem;
|
||||
}
|
||||
|
||||
.filter-label {
|
||||
flex: 1;
|
||||
font-size: 0.875rem;
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.remove-filter-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: transparent;
|
||||
color: var(--p-red-500);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
i {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background-color: var(--ground-background);
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-actions-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.75rem;
|
||||
height: 1.75rem;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: transparent;
|
||||
color: var(--text-secondary-color);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease, color 0.15s ease;
|
||||
|
||||
i {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: var(--ground-background);
|
||||
color: var(--primary-color);
|
||||
}
|
||||
}
|
||||
|
||||
+45
-30
@@ -1,30 +1,25 @@
|
||||
import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {Component, ElementRef, inject, OnDestroy, OnInit, viewChild} from '@angular/core';
|
||||
import {Select} from 'primeng/select';
|
||||
import {
|
||||
ALL_FILTER_OPTIONS,
|
||||
BookFilterMode,
|
||||
DEFAULT_VISIBLE_FILTERS,
|
||||
User,
|
||||
UserService,
|
||||
UserSettings,
|
||||
UserState,
|
||||
VisibleFilterType
|
||||
} from '../../user-management/user.service';
|
||||
import {ALL_FILTER_OPTIONS, BookFilterMode, DEFAULT_VISIBLE_FILTERS, User, UserService, UserSettings, UserState, VisibleFilterType} from '../../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {Observable, Subject} from 'rxjs';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {filter, takeUntil} from 'rxjs/operators';
|
||||
import {MultiSelect} from 'primeng/multiselect';
|
||||
import {CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
|
||||
const MIN_VISIBLE_FILTERS = 5;
|
||||
const MAX_VISIBLE_FILTERS = 15;
|
||||
const MAX_VISIBLE_FILTERS = 20;
|
||||
|
||||
@Component({
|
||||
selector: 'app-filter-preferences',
|
||||
imports: [
|
||||
Select,
|
||||
FormsModule,
|
||||
MultiSelect
|
||||
CdkDropList,
|
||||
CdkDrag,
|
||||
CdkDragHandle,
|
||||
Tooltip
|
||||
],
|
||||
templateUrl: './filter-preferences.component.html',
|
||||
styleUrl: './filter-preferences.component.scss'
|
||||
@@ -44,6 +39,8 @@ export class FilterPreferencesComponent implements OnInit, OnDestroy {
|
||||
selectedFilterMode: BookFilterMode = 'and';
|
||||
selectedVisibleFilters: VisibleFilterType[] = [...DEFAULT_VISIBLE_FILTERS];
|
||||
|
||||
private readonly filterList = viewChild<ElementRef<HTMLElement>>('filterList');
|
||||
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly messageService = inject(MessageService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
@@ -95,25 +92,43 @@ export class FilterPreferencesComponent implements OnInit, OnDestroy {
|
||||
this.updatePreference(['filterMode'], this.selectedFilterMode);
|
||||
}
|
||||
|
||||
onVisibleFiltersChange(): void {
|
||||
if (this.selectedVisibleFilters.length < MIN_VISIBLE_FILTERS) {
|
||||
this.messageService.add({
|
||||
severity: 'warn',
|
||||
summary: 'Minimum Filters Required',
|
||||
detail: `Please select at least ${MIN_VISIBLE_FILTERS} filters.`,
|
||||
life: 2000
|
||||
selectedAddFilter: string | null = null;
|
||||
|
||||
get availableFilters(): {label: string; value: string}[] {
|
||||
const used = new Set(this.selectedVisibleFilters);
|
||||
return this.allFilterOptions.filter(opt => !used.has(opt.value));
|
||||
}
|
||||
|
||||
getFilterLabel(value: string): string {
|
||||
return this.allFilterOptions.find(opt => opt.value === value)?.label ?? value;
|
||||
}
|
||||
|
||||
onDrop(event: CdkDragDrop<VisibleFilterType[]>): void {
|
||||
moveItemInArray(this.selectedVisibleFilters, event.previousIndex, event.currentIndex);
|
||||
this.updatePreference(['visibleFilters'], this.selectedVisibleFilters);
|
||||
}
|
||||
|
||||
addFilter(): void {
|
||||
if (this.selectedAddFilter) {
|
||||
this.selectedVisibleFilters.push(this.selectedAddFilter as VisibleFilterType);
|
||||
this.selectedAddFilter = null;
|
||||
this.updatePreference(['visibleFilters'], this.selectedVisibleFilters);
|
||||
requestAnimationFrame(() => {
|
||||
const el = this.filterList()?.nativeElement;
|
||||
if (el) el.scrollTop = el.scrollHeight;
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (this.selectedVisibleFilters.length > MAX_VISIBLE_FILTERS) {
|
||||
this.messageService.add({
|
||||
severity: 'warn',
|
||||
summary: 'Maximum Filters Exceeded',
|
||||
detail: `Please select at most ${MAX_VISIBLE_FILTERS} filters.`,
|
||||
life: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
removeFilter(index: number): void {
|
||||
if (this.selectedVisibleFilters.length > MIN_VISIBLE_FILTERS) {
|
||||
this.selectedVisibleFilters.splice(index, 1);
|
||||
this.updatePreference(['visibleFilters'], this.selectedVisibleFilters);
|
||||
}
|
||||
}
|
||||
|
||||
resetToDefaults(): void {
|
||||
this.selectedVisibleFilters = [...DEFAULT_VISIBLE_FILTERS];
|
||||
this.updatePreference(['visibleFilters'], this.selectedVisibleFilters);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user