Dialog refactor 2 (#2321)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-01-18 02:36:24 -07:00
committed by GitHub
co-authored by acx10
parent fda76eead7
commit 1889a04bac
51 changed files with 2206 additions and 1018 deletions
@@ -1,11 +1,24 @@
<div class="flex flex-col gap-6 p-4 items-center justify-center w-full max-w-[700px]">
<!-- Book Information -->
<div class="w-full text-center">
<h3 class="text-lg font-semibold mb-2">{{ book.metadata?.title || 'Unknown Title' }}</h3>
<p class="text-sm text-gray-600">{{ book.filePath }}</p>
<div class="additional-file-uploader-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-file-plus header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Upload Additional File</h2>
<p class="panel-description">{{ book.metadata?.title || 'Unknown Title' }}</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="closeDialog()"
styleClass="close-button">
</p-button>
</div>
<!-- File Type Selection -->
<div class="dialog-content">
<!-- File Type Selection -->
<p-select
[options]="fileTypeOptions"
[(ngModel)]="fileType"
@@ -126,4 +139,5 @@
</div>
</ng-template>
</p-fileupload>
</div>
</div>
@@ -1,3 +1,31 @@
@use '../../../../shared/styles/panel-shared' as panel;
.additional-file-uploader-container {
display: flex;
flex-direction: column;
height: 100%;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
flex: 1;
overflow-y: auto;
min-height: 0;
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
display: flex;
flex-direction: column;
gap: 1.5rem;
}
:host ::ng-deep .p-fileupload-content p-progressbar {
display: none !important;
}
}
@@ -185,4 +185,8 @@ export class AdditionalFileUploaderComponent implements OnInit, OnDestroy {
return 'info';
}
}
closeDialog(): void {
this.dialogRef.close();
}
}
@@ -1,6 +1,6 @@
import {inject, Injectable} from '@angular/core';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
import {DialogLauncherService} from '../../../../shared/services/dialog-launcher.service';
import {DialogLauncherService, DialogSize, DialogStyle} from '../../../../shared/services/dialog-launcher.service';
import {ShelfAssignerComponent} from '../shelf-assigner/shelf-assigner.component';
import {LockUnlockMetadataDialogComponent} from './lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component';
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
@@ -27,8 +27,8 @@ export class BookDialogHelperService {
openBookDetailsDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(BookMetadataCenterComponent, {
header: 'Book Details',
styleClass: 'book-details-dialog dialog-maximal',
showHeader: false,
styleClass: `book-details-dialog ${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: {
bookId: bookId,
},
@@ -49,21 +49,21 @@ export class BookDialogHelperService {
return this.openDialog(ShelfAssignerComponent, {
showHeader: false,
data: data,
styleClass: 'dynamic-dialog-minimal',
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
});
}
openShelfCreatorDialog(): DynamicDialogRef {
return this.openDialog(ShelfCreatorComponent, {
showHeader: false,
styleClass: 'dynamic-dialog-minimal',
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
})!;
}
openLockUnlockMetadataDialog(bookIds: Set<number>): DynamicDialogRef | null {
const count = bookIds.size;
return this.openDialog(LockUnlockMetadataDialogComponent, {
header: `Lock or Unlock Metadata for ${count} Selected Book${count > 1 ? 's' : ''}`,
showHeader: false,
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
data: {
bookIds: Array.from(bookIds),
},
@@ -72,82 +72,84 @@ export class BookDialogHelperService {
openMetadataRefreshDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(MultiBookMetadataFetchComponent, {
header: 'Metadata Refresh Options',
showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: {
bookIds: Array.from(bookIds),
metadataRefreshType: MetadataRefreshType.BOOKS,
},
styleClass: 'dialog-maximal',
});
}
openBulkMetadataEditDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(BulkMetadataUpdateComponent, {
header: 'Bulk Edit Metadata',
showHeader: false,
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
data: {
bookIds: Array.from(bookIds),
},
styleClass: 'dialog-maximal'
});
}
openMultibookMetadataEditorDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(MultiBookMetadataEditorComponent, {
header: 'Multi-Book Metadata Editor',
showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: {
bookIds: Array.from(bookIds),
},
styleClass: 'dialog-full'
});
}
openFileMoverDialog(bookIds: Set<number>): DynamicDialogRef | null {
const count = bookIds.size;
return this.openDialog(FileMoverComponent, {
header: `Organize Book Files (${count} book${count !== 1 ? 's' : ''})`,
showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
maximizable: true,
data: {
bookIds: Array.from(bookIds),
},
styleClass: 'dialog-full',
maximizable: true,
});
}
openCustomSendDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(BookSenderComponent, {
header: 'Send Book to Email',
showHeader: false,
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: {
bookId: bookId,
}
},
});
}
openCoverSearchDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(CoverSearchComponent, {
header: "Search Cover",
showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: {
bookId: bookId,
},
styleClass: 'dialog-maximal',
});
}
openMetadataFetchOptionsDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(MetadataFetchOptionsComponent, {
header: 'Metadata Refresh Options',
showHeader: false,
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: {
bookIds: [bookId],
metadataRefreshType: MetadataRefreshType.BOOKS,
}
},
});
}
openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null {
return this.openDialog(AdditionalFileUploaderComponent, {
header: 'Upload Additional File',
showHeader: false,
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
data: {
book: book,
}
},
});
}
}
@@ -1,29 +1,48 @@
<div class="p-2">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-x-24 gap-y-4">
@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 class="lock-unlock-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-lock header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Lock or Unlock Metadata</h2>
<p class="panel-description">{{ bookIds.size }} book{{ bookIds.size > 1 ? 's' : '' }} selected</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="dialogRef.close()"
styleClass="close-button">
</p-button>
</div>
<div class="dialog-content">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-x-24 gap-y-4">
@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>
<div class="dialog-footer">
<div class="footer-actions">
<p-button icon="pi pi-refresh" label="Reset" outlined="true" severity="warn" (onClick)="resetFieldLocks()"></p-button>
</div>
<div class="footer-actions">
<p-button icon="pi pi-lock" label="Lock All" outlined="true" severity="danger" (onClick)="toggleLockAll('LOCK')"></p-button>
<p-button icon="pi pi-lock-open" label="Unlock All" outlined="true" severity="success" (onClick)="toggleLockAll('UNLOCK')"></p-button>
<p-divider layout="vertical"></p-divider>
<p-button [label]="isSaving ? 'Saving...' : 'Save'" [outlined]="true" icon="pi pi-check" severity="info" (onClick)="applyFieldLocks()" [disabled]="bookIds.size === 0 || isSaving"></p-button>
</div>
</div>
</div>
<p-divider></p-divider>
<div class="flex justify-end px-4 pt-4">
<p-button icon="pi pi-refresh" label="Reset" outlined="true" severity="warn" (onClick)="resetFieldLocks()"></p-button>
<p-divider layout="vertical"></p-divider>
<div class="flex gap-4 justify-center">
<p-button icon="pi pi-lock" label="Lock All" outlined="true" severity="danger" (onClick)="toggleLockAll('LOCK')"></p-button>
<p-button icon="pi pi-lock-open" label="Unlock All" outlined="true" severity="success" (onClick)="toggleLockAll('UNLOCK')"></p-button>
</div>
<p-divider layout="vertical"></p-divider>
<p-button [label]="isSaving ? 'Saving...' : 'Save'" [outlined]="true" icon="pi pi-check" severity="info" (onClick)="applyFieldLocks()" [disabled]="bookIds.size === 0 || isSaving"></p-button>
</div>
@@ -0,0 +1,28 @@
@use '../../../../../shared/styles/panel-shared' as panel;
.lock-unlock-container {
display: flex;
flex-direction: column;
}
.panel-header {
@include panel.panel-header;
}
.dialog-content {
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-bottom: none;
}
.dialog-footer {
@include panel.dialog-footer;
}
.footer-actions {
display: flex;
gap: 0.5rem;
align-items: center;
}
@@ -23,7 +23,7 @@ import {finalize} from 'rxjs';
export class LockUnlockMetadataDialogComponent implements OnInit {
private bookService = inject(BookService);
private dynamicDialogConfig = inject(DynamicDialogConfig);
private dialogRef = inject(DynamicDialogRef);
dialogRef = inject(DynamicDialogRef);
private messageService = inject(MessageService);
private loadingService = inject(LoadingService);
fieldLocks: Record<string, boolean | undefined> = {};
@@ -1,29 +1,57 @@
<div class="flex flex-col gap-10 p-4 items-center justify-center min-w-[300px] max-w-[700px] sm:min-w-[400px] mx-auto">
<div class="book-sender-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-envelope header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Send Book</h2>
<p class="panel-description">Email this book to a recipient</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="dynamicDialogRef.close()"
styleClass="close-button">
</p-button>
</div>
<p-select
[options]="emailProviders"
optionLabel="label"
placeholder="Select Email Provider"
[(ngModel)]="selectedProvider"
appendTo="body"
class="w-full">
</p-select>
<div class="dialog-content">
<div class="flex flex-col gap-6">
<div class="flex flex-col gap-2">
<label class="text-sm font-medium text-gray-300">Email Provider</label>
<p-select
[options]="emailProviders"
optionLabel="label"
placeholder="Select Email Provider"
[(ngModel)]="selectedProvider"
appendTo="body"
class="w-full">
</p-select>
</div>
<p-select
[options]="emailRecipients"
optionLabel="label"
placeholder="Select Book Recipient"
[(ngModel)]="selectedRecipient"
[disabled]="!selectedProvider"
appendTo="body"
class="w-full">
</p-select>
<p-button
icon="pi pi-envelope"
label="Email Book"
[disabled]="!selectedProvider || !selectedRecipient"
(onClick)="sendBook()">
</p-button>
<div class="flex flex-col gap-2">
<label class="text-sm font-medium text-gray-300">Recipient</label>
<p-select
[options]="emailRecipients"
optionLabel="label"
placeholder="Select Book Recipient"
[(ngModel)]="selectedRecipient"
[disabled]="!selectedProvider"
appendTo="body"
class="w-full">
</p-select>
</div>
</div>
</div>
<div class="dialog-footer">
<p-button
icon="pi pi-envelope"
label="Send Book"
[disabled]="!selectedProvider || !selectedRecipient"
(onClick)="sendBook()">
</p-button>
</div>
</div>
@@ -0,0 +1,26 @@
@use '../../../../shared/styles/panel-shared' as panel;
.book-sender-container {
display: flex;
flex-direction: column;
height: 100%;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
flex: 1;
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-bottom: none;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.dialog-footer {
@include panel.dialog-footer;
}
@@ -26,7 +26,7 @@ export class BookSenderComponent implements OnInit {
private emailRecipientService = inject(EmailV2RecipientService);
private emailService = inject(EmailService);
private messageService = inject(MessageService);
private dynamicDialogRef = inject(DynamicDialogRef);
dynamicDialogRef = inject(DynamicDialogRef);
private dynamicDialogConfig = inject(DynamicDialogConfig);
bookId: number = this.dynamicDialogConfig.data.bookId;
@@ -1,53 +1,67 @@
<div class="max-w-3xl mx-auto">
<div class="mb-8">
<div class="p-6 bg-zinc-800/50 rounded-xl border border-zinc-500">
<div class="grid grid-cols-3 gap-6 mb-6">
<div class="text-center p-4 bg-zinc-700/30 rounded-lg">
<div class="text-3xl font-bold text-blue-400 mb-1">{{ result.totalFiles }}</div>
<div class="text-sm text-gray-400 font-medium">Total Files</div>
</div>
<div class="text-center p-4 bg-zinc-700/30 rounded-lg">
<div class="text-3xl font-bold text-green-400 mb-1">{{ result.successfullyImported }}</div>
<div class="text-sm text-gray-400 font-medium">Successfully Imported</div>
</div>
<div class="text-center p-4 bg-zinc-700/30 rounded-lg">
<div class="text-3xl font-bold text-red-400 mb-1">{{ result.failed }}</div>
<div class="text-sm text-gray-400 font-medium">Failed</div>
</div>
</div>
<div class="import-result-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-file-import header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Import Summary</h2>
<p class="panel-description">Results of your book import</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="ref.close()"
styleClass="close-button">
</p-button>
</div>
<div class="text-center pt-4 border-t border-zinc-600">
<div class="text-sm text-gray-300 mb-1">Processed at</div>
<div class="text-base text-white font-mono">{{ result.processedAt | date:'medium' }}</div>
<div class="dialog-content">
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value total">{{ result.totalFiles }}</div>
<div class="stat-label">Total Files</div>
</div>
<div class="stat-card">
<div class="stat-value success">{{ result.successfullyImported }}</div>
<div class="stat-label">Successfully Imported</div>
</div>
<div class="stat-card">
<div class="stat-value failed">{{ result.failed }}</div>
<div class="stat-label">Failed</div>
</div>
</div>
</div>
<div class="max-h-[35rem] overflow-y-scroll">
<ul class="space-y-3 px-4">
@for (r of result.results; track r) {
<li
class="flex items-start gap-3 p-3 rounded-xl border shadow-sm transition-colors"
[ngClass]="{
'bg-green-800/10 border-green-500/40 text-green-100': r.success,
'bg-red-800/10 border-red-500/40 text-red-100': !r.success
}"
>
<i
class="pi text-xl mt-1"
[ngClass]="{
'pi-check-circle text-green-500': r.success,
'pi-times-circle text-red-500': !r.success
}"
></i>
<div class="flex flex-col">
<span class="font-medium text-sm text-white">
{{ r.fileName }}
</span>
<span class="text-sm text-gray-400">{{ r.message }}</span>
</div>
</li>
}
</ul>
<div class="processed-info">
<div class="processed-label">Processed at</div>
<div class="processed-time">{{ result.processedAt | date:'medium' }}</div>
</div>
<div class="results-list">
<ul class="file-list">
@for (r of result.results; track r) {
<li
class="file-item"
[ngClass]="{
'success': r.success,
'error': !r.success
}">
<i
class="pi status-icon"
[ngClass]="{
'pi-check-circle': r.success,
'pi-times-circle': !r.success
}">
</i>
<div class="file-details">
<span class="file-name">{{ r.fileName }}</span>
<span class="file-message">{{ r.message }}</span>
</div>
</li>
}
</ul>
</div>
</div>
</div>
@@ -0,0 +1,146 @@
@use '../../../../shared/styles/panel-shared' as panel;
.import-result-container {
display: flex;
flex-direction: column;
max-width: 700px;
margin: 0 auto;
}
.panel-header {
@include panel.panel-header;
}
.dialog-content {
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
@media (max-width: 480px) {
grid-template-columns: 1fr;
}
}
.stat-card {
text-align: center;
padding: 1rem;
background: var(--overlay-background);
border-radius: 8px;
.stat-value {
font-size: 1.875rem;
font-weight: 700;
margin-bottom: 0.25rem;
&.total {
color: var(--primary-color);
}
&.success {
color: #22c55e;
}
&.failed {
color: #ef4444;
}
}
.stat-label {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-secondary-color);
}
}
.processed-info {
text-align: center;
padding: 1rem;
border-top: 1px solid var(--border-color);
margin-bottom: 1rem;
.processed-label {
font-size: 0.875rem;
color: var(--text-secondary-color);
margin-bottom: 0.25rem;
}
.processed-time {
font-size: 1rem;
font-family: monospace;
color: var(--text-color);
}
}
.results-list {
max-height: 350px;
overflow-y: auto;
}
.file-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.file-item {
display: flex;
align-items: flex-start;
gap: 0.75rem;
padding: 0.75rem;
border-radius: 8px;
border: 1px solid;
transition: all 0.2s ease;
&.success {
background: rgba(34, 197, 94, 0.1);
border-color: rgba(34, 197, 94, 0.4);
.status-icon {
color: #22c55e;
}
}
&.error {
background: rgba(239, 68, 68, 0.1);
border-color: rgba(239, 68, 68, 0.4);
.status-icon {
color: #ef4444;
}
}
.status-icon {
font-size: 1.25rem;
margin-top: 0.125rem;
flex-shrink: 0;
}
.file-details {
display: flex;
flex-direction: column;
.file-name {
font-weight: 500;
font-size: 0.875rem;
color: var(--text-color);
}
.file-message {
font-size: 0.875rem;
color: var(--text-secondary-color);
}
}
}
@@ -2,12 +2,14 @@ import {Component, OnDestroy} from '@angular/core';
import {DatePipe, NgClass} from '@angular/common';
import {BookdropFinalizeResult} from '../../service/bookdrop.service';
import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog";
import {Button} from 'primeng/button';
@Component({
selector: 'app-bookdrop-finalize-result-dialog',
imports: [
NgClass,
DatePipe
DatePipe,
Button
],
templateUrl: './bookdrop-finalize-result-dialog.component.html',
styleUrl: './bookdrop-finalize-result-dialog.component.scss'
@@ -1,8 +1,6 @@
@use '../../../shared/styles/panel-shared' as panel;
.magic-shelf-container {
width: 75rem;
max-width: 75rem;
display: flex;
flex-direction: column;
@@ -1,5 +1,25 @@
<div class="rounded-xl overflow-hidden border-[1px] border-solid border-[var(--p-content-border-color)]">
<p-tabs [(value)]="tab" lazy="true" scrollable>
<div class="book-metadata-center-container">
@if (config) {
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-book header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Book Details</h2>
<p class="panel-description">View and edit book metadata</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="ref?.close()"
styleClass="close-button">
</p-button>
</div>
}
<div class="rounded-xl overflow-hidden border-[1px] border-solid border-[var(--p-content-border-color)]" [class.dialog-mode]="config">
<p-tabs [(value)]="tab" lazy="true" scrollable>
<p-tablist>
<p-tab value="view">
<i [class]="'pi pi-book'"></i>
@@ -39,4 +59,5 @@
}
</p-tabpanels>
</p-tabs>
</div>
</div>
@@ -1,3 +1,21 @@
@use '../../../../shared/styles/panel-shared' as panel;
.book-metadata-center-container {
display: flex;
flex-direction: column;
height: 100%;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-mode {
border-radius: 0 0 0.75rem 0.75rem !important;
border-width: 1px 0 0 !important;
}
::ng-deep .layout-main .tabpanels-responsive {
height: calc(100dvh - 9.7rem);
}
@@ -23,8 +41,3 @@
::ng-deep .book-details-dialog .p-dialog-content {
padding: 0;
}
::ng-deep .book-details-dialog app-book-metadata-center > div {
border-radius: 0 0 0.75rem 0.75rem !important;
border-width: 1px 0 0 !important;
}
@@ -8,6 +8,7 @@ import {BookService} from '../../../book/service/book.service';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {Tab, TabList, TabPanel, TabPanels, Tabs,} from 'primeng/tabs';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {Button} from 'primeng/button';
import {BookMetadataHostService} from '../../../../shared/service/book-metadata-host.service';
import {MetadataViewerComponent} from './metadata-viewer/metadata-viewer.component';
import {MetadataEditorComponent} from './metadata-editor/metadata-editor.component';
@@ -25,7 +26,8 @@ import {MetadataSearcherComponent} from './metadata-searcher/metadata-searcher.c
TabPanel,
MetadataViewerComponent,
MetadataEditorComponent,
MetadataSearcherComponent
MetadataSearcherComponent,
Button
],
styleUrls: ['./book-metadata-center.component.scss'],
})
@@ -65,8 +67,8 @@ export class BookMetadataCenterComponent implements OnInit, OnDestroy {
}
constructor(
@Optional() private config?: DynamicDialogConfig,
@Optional() private ref?: DynamicDialogRef
@Optional() public config?: DynamicDialogConfig,
@Optional() public ref?: DynamicDialogRef
) {
}
@@ -101,6 +101,7 @@ label {
flex-direction: column;
flex-grow: 1;
overflow: auto;
height: 72.5dvh;
@media (min-width: 768px) {
padding: 0.5rem;
@@ -315,8 +316,7 @@ label {
z-index: 10;
@media (min-width: 768px) {
padding: 0.5rem;
padding-bottom: 1rem;
padding: 1rem;
}
}
@@ -1,362 +1,382 @@
<div class="relative">
@if (loading) {
<div class="absolute inset-0 z-50 flex items-center justify-center bg-black/60">
<p-progressSpinner></p-progressSpinner>
<div class="bulk-update-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-pencil header-icon"></i>
</div>
}
<div class="p-4 border border-gray-700 rounded-md mb-4 bg-gray-900 text-gray-200">
<div class="flex justify-between items-center mb-2">
<p class="text-base font-semibold">
Editing {{ books.length }} Book{{ books.length !== 1 ? 's' : '' }}
</p>
<button
type="button"
(click)="showBookList = !showBookList"
class="text-sm text-sky-400 hover:underline">
{{ showBookList ? 'Hide' : 'Show' }} Titles
</button>
<div class="header-text">
<h2 class="panel-title">Bulk Edit Metadata</h2>
<p class="panel-description">{{ books.length }} book{{ books.length !== 1 ? 's' : '' }} selected</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="ref.close()"
styleClass="close-button">
</p-button>
</div>
@if (showBookList) {
<div class="max-h-48 overflow-y-auto border-t border-gray-700 pt-2 pl-1 text-sm text-gray-300">
<ul class="list-disc pl-5 space-y-1">
@for (book of books; track book) {
<li>{{ book.metadata?.title || 'Untitled Book' }}</li>
}
</ul>
<div class="dialog-content relative">
@if (loading) {
<div class="absolute inset-0 z-50 flex items-center justify-center bg-black/60">
<p-progressSpinner></p-progressSpinner>
</div>
}
</div>
<div class="px-4 text-sm text-yellow-500 mb-2">
<i class="pi pi-exclamation-triangle mr-1"></i>
Checking <strong>Clear</strong> will remove that field’s metadata from <strong>all selected books</strong>.
</div>
<div class="p-4 border border-gray-700 rounded-md mb-4 bg-gray-900 text-gray-200">
<div class="flex justify-between items-center mb-2">
<p class="text-base font-semibold">
Editing {{ books.length }} Book{{ books.length !== 1 ? 's' : '' }}
</p>
<button
type="button"
(click)="showBookList = !showBookList"
class="text-sm text-sky-400 hover:underline">
{{ showBookList ? 'Hide' : 'Show' }} Titles
</button>
</div>
<form [formGroup]="metadataForm" (ngSubmit)="onSubmit()" (keydown)="onFormKeydown($event)" class="flex flex-col gap-4 w-full p-4">
@if (showBookList) {
<div class="max-h-48 overflow-y-auto border-t border-gray-700 pt-2 pl-1 text-sm text-gray-300">
<ul class="list-disc pl-5 space-y-1">
@for (book of books; track book) {
<li>{{ book.metadata?.title || 'Untitled Book' }}</li>
}
</ul>
</div>
}
</div>
<div class="flex justify-between gap-7">
<!-- Authors -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="authors" class="flex items-center justify-between gap-2">
<div class="px-4 text-sm text-yellow-500 mb-2">
<i class="pi pi-exclamation-triangle mr-1"></i>
Checking <strong>Clear</strong> will remove that field's metadata from <strong>all selected books</strong>.
</div>
<form [formGroup]="metadataForm" (ngSubmit)="onSubmit()" (keydown)="onFormKeydown($event)" class="flex flex-col gap-4 w-full p-4">
<div class="flex justify-between gap-7">
<!-- Authors -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="authors" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Author(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple authors. Press Enter after typing each name."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.authors" [ngModelOptions]="{standalone: true}" (onChange)="onFieldClearToggle('authors')" binary="true" inputId="clearAuthors"/>
<label for="clearAuthors" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="authors"
formControlName="authors"
[disabled]="clearFields.authors"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredAuthors"
(completeMethod)="filterAuthors($event)"
(onKeyUp)="onAutoCompleteKeyUp('authors', $event)"
(onSelect)="onAutoCompleteSelect('authors', $event)">
</p-autoComplete>
</div>
<!-- Language -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="language" class="flex items-center justify-between gap-2">
<span>Language</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.language" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('language')" binary="true" inputId="clearLanguage"/>
<label for="clearLanguage" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<input pInputText id="language" formControlName="language" [disabled]="clearFields.language" class="w-full"/>
</div>
</div>
<div class="flex justify-between gap-7">
<!-- Publisher -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="publisher" class="flex items-center justify-between gap-2">
<span>Publisher</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.publisher" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('publisher')" binary="true" inputId="clearPublisher"/>
<label for="clearPublisher" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
inputStyleClass="w-full"
formControlName="publisher"
inputId="publisher"
[disabled]="clearFields.publisher"
[multiple]="false"
[dropdown]="false"
[showClear]="true"
[forceSelection]="false"
[suggestions]="filteredPublishers"
(completeMethod)="filterPublishers($event)">
</p-autoComplete>
</div>
<!-- Published Date -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="publishedDate" class="flex items-center justify-between gap-2">
<span>Published Date</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.publishedDate" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('publishedDate')" binary="true" inputId="clearPublishedDate"/>
<label for="clearPublishedDate" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-datepicker
class="w-full md:min-w-[9rem]"
formControlName="publishedDate"
inputId="publishedDate"
dataType="string"
dateFormat="yy-mm-dd"
[disabled]="clearFields.publishedDate"
[keepInvalid]="true"
[showIcon]="true"
[iconDisplay]="'input'"
fluid="true"
appendTo="body">
</p-datepicker>
</div>
</div>
<div class="flex justify-between gap-7">
<!-- Series Name -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="seriesName" class="flex items-center justify-between gap-2">
<span>Series Name</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.seriesName" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('seriesName')" binary="true" inputId="clearSeriesName"/>
<label for="clearSeriesName" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
inputStyleClass="w-full"
formControlName="seriesName"
inputId="seriesName"
[disabled]="clearFields.seriesName"
[multiple]="false"
[dropdown]="false"
[showClear]="true"
[forceSelection]="false"
[suggestions]="filteredSeries"
(completeMethod)="filterSeries($event)">
</p-autoComplete>
</div>
<!-- Series Total -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="seriesTotal" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Total Books
<i class="pi pi-info-circle text-sky-600"
pTooltip="Total number of books in the series."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.seriesTotal" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('seriesTotal')" binary="true" inputId="clearSeriesTotal"/>
<label for="clearSeriesTotal" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<input pInputText id="seriesTotal" type="number" min="1" formControlName="seriesTotal"
[disabled]="clearFields.seriesTotal" class="w-full"/>
</div>
</div>
<!-- Genres -->
<div class="flex flex-col gap-2">
<label for="genres" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Author(s)
Genre(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple authors. Press Enter after typing each name."
tooltipPosition="right"
style="cursor: pointer"></i>
pTooltip="Enter multiple genres. Press Enter after typing each genre."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.authors" [ngModelOptions]="{standalone: true}" (onChange)="onFieldClearToggle('authors')" binary="true" inputId="clearAuthors"/>
<label for="clearAuthors" class="text-sm text-gray-300 cursor-pointer">Clear</label>
<p-checkbox [(ngModel)]="clearFields.genres" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('genres')" binary="true" inputId="clearGenres"/>
<label for="clearGenres" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="authors"
formControlName="authors"
[disabled]="clearFields.authors"
id="genres"
formControlName="genres"
[disabled]="clearFields.genres"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredAuthors"
(completeMethod)="filterAuthors($event)"
(onKeyUp)="onAutoCompleteKeyUp('authors', $event)"
(onSelect)="onAutoCompleteSelect('authors', $event)">
[suggestions]="filteredGenres"
(completeMethod)="filterGenres($event)"
(onKeyUp)="onAutoCompleteKeyUp('genres', $event)"
(onSelect)="onAutoCompleteSelect('genres', $event)">
</p-autoComplete>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeCategories"
name="mergeCategories"
[(ngModel)]="mergeCategories"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeCategories" class="text-sm text-gray-300 cursor-pointer">
Keep existing genres and add new ones (uncheck to remove all existing genres)
</label>
</div>
</div>
<!-- Language -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="language" class="flex items-center justify-between gap-2">
<span>Language</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.language" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('language')" binary="true" inputId="clearLanguage"/>
<label for="clearLanguage" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<input pInputText id="language" formControlName="language" [disabled]="clearFields.language" class="w-full"/>
</div>
</div>
<div class="flex justify-between gap-7">
<!-- Publisher -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="publisher" class="flex items-center justify-between gap-2">
<span>Publisher</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.publisher" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('publisher')" binary="true" inputId="clearPublisher"/>
<label for="clearPublisher" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
inputStyleClass="w-full"
formControlName="publisher"
inputId="publisher"
[disabled]="clearFields.publisher"
[multiple]="false"
[dropdown]="false"
[showClear]="true"
[forceSelection]="false"
[suggestions]="filteredPublishers"
(completeMethod)="filterPublishers($event)">
</p-autoComplete>
</div>
<!-- Published Date -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="publishedDate" class="flex items-center justify-between gap-2">
<span>Published Date</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.publishedDate" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('publishedDate')" binary="true" inputId="clearPublishedDate"/>
<label for="clearPublishedDate" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-datepicker
class="w-full md:min-w-[9rem]"
formControlName="publishedDate"
inputId="publishedDate"
dataType="string"
dateFormat="yy-mm-dd"
[disabled]="clearFields.publishedDate"
[keepInvalid]="true"
[showIcon]="true"
[iconDisplay]="'input'"
fluid="true"
appendTo="body">
</p-datepicker>
</div>
</div>
<div class="flex justify-between gap-7">
<!-- Series Name -->
<div class="flex flex-col gap-2 w-full md:basis-[80%]">
<label for="seriesName" class="flex items-center justify-between gap-2">
<span>Series Name</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.seriesName" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('seriesName')" binary="true" inputId="clearSeriesName"/>
<label for="clearSeriesName" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
inputStyleClass="w-full"
formControlName="seriesName"
inputId="seriesName"
[disabled]="clearFields.seriesName"
[multiple]="false"
[dropdown]="false"
[showClear]="true"
[forceSelection]="false"
[suggestions]="filteredSeries"
(completeMethod)="filterSeries($event)">
</p-autoComplete>
</div>
<!-- Series Total -->
<div class="flex flex-col gap-2 md:basis-[20%]">
<label for="seriesTotal" class="flex items-center justify-between gap-2">
<!-- Moods -->
<div class="flex flex-col gap-2">
<label for="moods" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Total Books
Mood(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Total number of books in the series."
tooltipPosition="right"
style="cursor: pointer"></i>
pTooltip="Enter multiple moods. Press Enter after typing each mood."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.seriesTotal" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('seriesTotal')" binary="true" inputId="clearSeriesTotal"/>
<label for="clearSeriesTotal" class="text-sm text-gray-300 cursor-pointer">Clear</label>
<p-checkbox [(ngModel)]="clearFields.moods" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('moods')" binary="true" inputId="clearMoods"/>
<label for="clearMoods" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<input pInputText id="seriesTotal" type="number" min="1" formControlName="seriesTotal"
[disabled]="clearFields.seriesTotal" class="w-full"/>
</div>
</div>
<p-autoComplete
class="w-full"
id="moods"
formControlName="moods"
[disabled]="clearFields.moods"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredMoods"
(completeMethod)="filterMoods($event)"
(onKeyUp)="onAutoCompleteKeyUp('moods', $event)"
(onSelect)="onAutoCompleteSelect('moods', $event)">
</p-autoComplete>
<!-- Genres -->
<div class="flex flex-col gap-2">
<label for="genres" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Genre(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple genres. Press Enter after typing each genre."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.genres" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('genres')" binary="true" inputId="clearGenres"/>
<label for="clearGenres" class="text-sm text-gray-300 cursor-pointer">Clear</label>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeMoods"
name="mergeMoods"
[(ngModel)]="mergeMoods"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeMoods" class="text-sm text-gray-300 cursor-pointer">
Keep existing moods and add new ones (uncheck to remove all existing moods)
</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="genres"
formControlName="genres"
[disabled]="clearFields.genres"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredGenres"
(completeMethod)="filterGenres($event)"
(onKeyUp)="onAutoCompleteKeyUp('genres', $event)"
(onSelect)="onAutoCompleteSelect('genres', $event)">
</p-autoComplete>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeCategories"
name="mergeCategories"
[(ngModel)]="mergeCategories"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeCategories" class="text-sm text-gray-300 cursor-pointer">
Keep existing genres and add new ones (uncheck to remove all existing genres)
</label>
</div>
</div>
<!-- Moods -->
<div class="flex flex-col gap-2">
<label for="moods" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Mood(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple moods. Press Enter after typing each mood."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.moods" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('moods')" binary="true" inputId="clearMoods"/>
<label for="clearMoods" class="text-sm text-gray-300 cursor-pointer">Clear</label>
<!-- Tags -->
<div class="flex flex-col gap-2">
<label for="tags" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Tag(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple tags. Press Enter after typing each tag."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.tags" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('tags')" binary="true" inputId="clearTags"/>
<label for="clearTags" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="tags"
formControlName="tags"
[disabled]="clearFields.tags"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredTags"
(completeMethod)="filterTags($event)"
(onKeyUp)="onAutoCompleteKeyUp('tags', $event)"
(onSelect)="onAutoCompleteSelect('tags', $event)">
</p-autoComplete>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeTags"
name="mergeTags"
[(ngModel)]="mergeTags"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeTags" class="text-sm text-gray-300 cursor-pointer">
Keep existing tags and add new ones (uncheck to remove all existing tags)
</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="moods"
formControlName="moods"
[disabled]="clearFields.moods"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredMoods"
(completeMethod)="filterMoods($event)"
(onKeyUp)="onAutoCompleteKeyUp('moods', $event)"
(onSelect)="onAutoCompleteSelect('moods', $event)">
</p-autoComplete>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeMoods"
name="mergeMoods"
[(ngModel)]="mergeMoods"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeMoods" class="text-sm text-gray-300 cursor-pointer">
Keep existing moods and add new ones (uncheck to remove all existing moods)
</label>
</div>
</div>
<!-- Tags -->
<div class="flex flex-col gap-2">
<label for="tags" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2">
Tag(s)
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple tags. Press Enter after typing each tag."
tooltipPosition="right"
style="cursor: pointer"></i>
</span>
<div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.tags" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('tags')" binary="true" inputId="clearTags"/>
<label for="clearTags" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div>
</label>
<p-autoComplete
class="w-full"
id="tags"
formControlName="tags"
[disabled]="clearFields.tags"
[multiple]="true"
[dropdown]="false"
[forceSelection]="false"
[suggestions]="filteredTags"
(completeMethod)="filterTags($event)"
(onKeyUp)="onAutoCompleteKeyUp('tags', $event)"
(onSelect)="onAutoCompleteSelect('tags', $event)">
</p-autoComplete>
<div class="flex items-center gap-2 mt-2">
<p-checkbox
inputId="mergeTags"
name="mergeTags"
[(ngModel)]="mergeTags"
[ngModelOptions]="{ standalone: true }"
binary="true"
/>
<label for="mergeTags" class="text-sm text-gray-300 cursor-pointer">
Keep existing tags and add new ones (uncheck to remove all existing tags)
<!-- Cover Image Upload Section -->
<div class="flex flex-col gap-2 border border-gray-700 rounded-md p-4 bg-gray-900">
<label class="flex items-center gap-2 text-base font-semibold">
<i class="pi pi-image"></i>
Cover Image
</label>
</div>
</div>
<!-- Cover Image Upload Section -->
<div class="flex flex-col gap-2 border border-gray-700 rounded-md p-4 bg-gray-900">
<label class="flex items-center gap-2 text-base font-semibold">
<i class="pi pi-image"></i>
Cover Image
</label>
<p class="text-sm text-gray-400">
Upload an image to set as the cover for all selected books.
</p>
<div class="flex items-center gap-4 mt-2">
@if (selectedCoverFile) {
<div class="flex items-center gap-2 text-sm text-gray-300">
<i class="pi pi-file-image"></i>
<span>{{ selectedCoverFile.name }}</span>
<p class="text-sm text-gray-400">
Upload an image to set as the cover for all selected books.
</p>
<div class="flex items-center gap-4 mt-2">
@if (selectedCoverFile) {
<div class="flex items-center gap-2 text-sm text-gray-300">
<i class="pi pi-file-image"></i>
<span>{{ selectedCoverFile.name }}</span>
<p-button
icon="pi pi-times"
[text]="true"
size="small"
severity="danger"
(onClick)="clearCoverFile()"
pTooltip="Remove file"
tooltipPosition="top">
</p-button>
</div>
} @else {
<input
type="file"
#coverFileInput
accept="image/jpeg,image/png,image/webp"
(change)="onCoverFileSelect($event)"
class="hidden">
<p-button
icon="pi pi-times"
[text]="true"
icon="pi pi-upload"
label="Select Image"
[outlined]="true"
size="small"
severity="danger"
(onClick)="clearCoverFile()"
pTooltip="Remove file"
tooltipPosition="top">
severity="info"
(onClick)="coverFileInput.click()">
</p-button>
</div>
} @else {
<input
type="file"
#coverFileInput
accept="image/jpeg,image/png,image/webp"
(change)="onCoverFileSelect($event)"
class="hidden">
<p-button
icon="pi pi-upload"
label="Select Image"
[outlined]="true"
size="small"
severity="info"
(onClick)="coverFileInput.click()">
</p-button>
}
}
</div>
</div>
</div>
<div class="flex justify-end mt-4">
<p-button type="submit" label="Apply to Selected" [disabled]="loading"/>
</div>
</form>
<div class="flex justify-end mt-4">
<p-button type="submit" label="Apply to Selected" [disabled]="loading"/>
</div>
</form>
</div>
</div>
@@ -1,3 +1,27 @@
@use '../../../../shared/styles/panel-shared' as panel;
.bulk-update-container {
display: flex;
flex-direction: column;
height: 100%;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
flex: 1;
overflow-y: auto;
padding: 1rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
::ng-deep .p-inputchips {
width: 100%;
}
@@ -57,7 +57,7 @@ export class BulkMetadataUpdateComponent implements OnInit {
};
private readonly config = inject(DynamicDialogConfig);
private readonly ref = inject(DynamicDialogRef);
readonly ref = inject(DynamicDialogRef);
private readonly fb = inject(FormBuilder);
private readonly bookService = inject(BookService);
private readonly messageService = inject(MessageService);
@@ -1,99 +1,150 @@
<div class="cover-search-container">
<div class="search-section">
<form [formGroup]="searchForm" (ngSubmit)="onSearch()">
<div class="form-grid">
<div class="form-field">
<label for="title">Title *</label>
<input
pInputText
id="title"
formControlName="title"
placeholder="Enter book title"
/>
@if (searchForm.get('title')?.invalid && searchForm.get('title')?.touched) {
<small class="error-message">
Title is required
</small>
}
</div>
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-image header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Search Cover Images</h2>
<p class="panel-description">Find and select a cover for your book</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="dynamicDialogRef.close()"
styleClass="close-button">
</p-button>
</div>
<div class="form-field">
<label for="author">Author</label>
<input
pInputText
id="author"
formControlName="author"
placeholder="Enter author name"
/>
</div>
<div class="dialog-content">
<!-- Search Form -->
<div class="search-section">
<form [formGroup]="searchForm" (ngSubmit)="onSearch()">
<div class="form-row">
<div class="form-field title-field">
<label for="title">
<i class="pi pi-book"></i>
Title
<span class="required">*</span>
</label>
<input
pInputText
id="title"
formControlName="title"
placeholder="Enter book title"
/>
@if (searchForm.get('title')?.invalid && searchForm.get('title')?.touched) {
<small class="error-message">
<i class="pi pi-exclamation-circle"></i>
Title is required
</small>
}
</div>
<div class="form-field">
<label>&nbsp;</label>
<div class="button-group">
<div class="form-field author-field">
<label for="author">
<i class="pi pi-user"></i>
Author
</label>
<input
pInputText
id="author"
formControlName="author"
placeholder="Enter author name (optional)"
/>
</div>
<div class="form-actions">
<p-button
type="submit"
outlined
label="Search Covers"
label="Search"
icon="pi pi-search"
[loading]="loading"
[disabled]="searchForm.invalid">
</p-button>
<p-button
type="button"
label="Clear"
icon="pi pi-times"
icon="pi pi-refresh"
[text]="true"
[rounded]="true"
severity="secondary"
(click)="onClear()"
styleClass="p-button-secondary p-button-outlined">
pTooltip="Reset search"
tooltipPosition="top">
</p-button>
</div>
</div>
</div>
</form>
</div>
</form>
</div>
@if (hasSearched) {
<!-- Results Area -->
<div class="results-section">
@if (loading) {
<div class="loading-container">
<p-progressSpinner></p-progressSpinner>
<p>Searching for book covers...</p>
@if (!hasSearched) {
<!-- Initial State -->
<div class="empty-state">
<div class="empty-state-icon">
<i class="pi pi-images"></i>
</div>
<h3>Search for Book Covers</h3>
<p>Enter a book title above to find cover images from various sources.</p>
</div>
}
@if (!loading && coverImages.length === 0) {
<div class="no-results">
<i class="pi pi-info-circle"></i>
<p>No cover images found. Try adjusting your search terms.</p>
} @else if (loading) {
<!-- Loading State -->
<div class="loading-state">
<p-progressSpinner strokeWidth="3" animationDuration="1s"></p-progressSpinner>
<p>Searching for covers...</p>
</div>
} @else if (coverImages.length === 0) {
<!-- No Results State -->
<div class="empty-state no-results">
<div class="empty-state-icon warning">
<i class="pi pi-search"></i>
</div>
<h3>No Covers Found</h3>
<p>Try adjusting your search terms or check the spelling.</p>
</div>
} @else {
<!-- Results Grid -->
<div class="results-header">
<span class="results-count">
<i class="pi pi-images"></i>
{{ coverImages.length }} cover{{ coverImages.length !== 1 ? 's' : '' }} found
</span>
<span class="results-hint">
<i class="pi pi-info-circle"></i>
Click on an image to preview, or select to apply
</span>
</div>
}
@if (!loading && coverImages.length > 0) {
<div class="covers-grid">
@for (cover of coverImages; track cover.url; let i = $index) {
<div class="cover-item">
<p-image
[src]="cover.url"
[alt]="'Book cover ' + (i + 1)"
appendTo="body"
[preview]="true">
</p-image>
@if (cover.width && cover.height) {
<div class="resolution-overlay">
{{cover.width}} x {{cover.height}}
<div class="cover-card">
<div class="cover-image-wrapper">
<p-image
[src]="cover.url"
[alt]="'Book cover ' + (i + 1)"
appendTo="body"
[preview]="true">
</p-image>
@if (cover.width && cover.height) {
<div class="resolution-badge">
{{ cover.width }} x {{ cover.height }}
</div>
}
<div class="cover-overlay">
<p-button
(click)="selectAndSave(cover)"
label="Select Cover"
icon="pi pi-check"
size="small">
</p-button>
</div>
}
<p-button
class="select-button"
(click)="selectAndSave(cover)"
label="Pick & Save"
severity="info"
title="Select & Save this cover">
</p-button>
</div>
</div>
}
</div>
}
</div>
}
</div>
</div>
@@ -1,148 +1,330 @@
@use '../../../../shared/styles/panel-shared' as panel;
:host {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.cover-search-container {
margin: 0 auto;
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
.search-section {
background: var(--surface-card);
border: 1px solid var(--surface-border);
border-radius: 8px;
padding: 0 1.5rem 0 1.5rem;
margin-bottom: 2rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
h2 {
margin: 0 0 1.5rem 0;
color: var(--text-color);
.dialog-content {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
min-height: 0;
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
}
// Search Section
.search-section {
flex-shrink: 0;
background: var(--surface-ground);
border: 1px solid var(--surface-border);
border-radius: 12px;
padding: 1.25rem 1.5rem;
margin-bottom: 1.5rem;
.form-row {
display: flex;
align-items: flex-end;
gap: 1rem;
}
.form-field {
display: flex;
flex-direction: column;
gap: 0.5rem;
&.title-field {
flex: 1.2;
}
.form-grid {
display: grid;
grid-template-columns: 1fr 1fr auto;
gap: 1rem;
align-items: end;
&.author-field {
flex: 1;
}
.form-field {
display: flex;
flex-direction: column;
gap: 0.5rem;
label {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
color: var(--text-color-secondary);
label {
font-weight: 500;
color: var(--text-color);
}
i {
font-size: 0.875rem;
color: var(--primary-color);
}
.error-message {
color: var(--red-500);
font-size: 0.875rem;
}
.required {
color: var(--red-400);
}
}
.button-group {
input {
width: 100%;
}
.error-message {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
align-items: center;
gap: 0.35rem;
color: var(--red-400);
font-size: 0.8rem;
i {
font-size: 0.75rem;
}
}
}
.results-section {
padding: 0 1.5rem 0 1.5rem;
.form-actions {
display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 1px;
}
}
.loading-container {
display: flex;
flex-direction: column;
align-items: center;
padding: 3rem;
background: var(--surface-card);
border-radius: 8px;
border: 1px solid var(--surface-border);
// Results Section
.results-section {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
p {
margin-top: 1rem;
color: var(--text-secondary-color);
}
}
// Empty & Loading States
.empty-state,
.loading-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 3rem;
text-align: center;
background: var(--surface-ground);
border: 1px dashed var(--surface-border);
border-radius: 12px;
.no-results {
display: flex;
flex-direction: column;
align-items: center;
padding: 3rem;
color: var(--text-secondary-color);
background: var(--surface-card);
border-radius: 8px;
border: 1px solid var(--surface-border);
h3 {
margin: 0 0 0.5rem;
font-size: 1.125rem;
font-weight: 600;
color: var(--text-color);
}
i {
font-size: 2rem;
margin-bottom: 1rem;
}
}
p {
margin: 0;
font-size: 0.9rem;
color: var(--text-color-secondary);
max-width: 300px;
}
}
.covers-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 1.5rem;
padding: 1rem 0;
.empty-state-icon {
width: 80px;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--primary-100), var(--primary-50));
border-radius: 50%;
margin-bottom: 1.5rem;
.cover-item {
position: relative;
border: 1px solid transparent;
border-radius: 8px;
padding: 4px;
transition: all 0.3s ease;
i {
font-size: 2rem;
color: var(--primary-color);
}
&:hover {
border-color: var(--primary-color);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
&.warning {
background: linear-gradient(135deg, var(--yellow-100), var(--yellow-50));
.resolution-overlay {
position: absolute;
top: 8px;
right: 8px;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 4px 8px;
border-radius: 4px;
font-size: 0.75rem;
font-weight: 600;
backdrop-filter: blur(4px);
z-index: 1;
pointer-events: none;
}
.select-button {
position: absolute !important;
bottom: 8px;
left: 50%;
transform: translateX(-50%);
width: 120px;
opacity: 0;
transition: opacity 0.3s ease;
z-index: 2;
cursor: pointer;
text-align: center;
}
&:hover .select-button {
opacity: 1;
}
}
i {
color: var(--yellow-600);
}
}
}
.loading-state {
p {
margin-top: 1rem;
}
}
// Results Header
.results-header {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 1rem;
padding-bottom: 0.75rem;
border-bottom: 1px solid var(--surface-border);
.results-count {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.95rem;
font-weight: 600;
color: var(--text-color);
i {
color: var(--primary-color);
}
}
.results-hint {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.8rem;
color: var(--text-color-secondary);
i {
font-size: 0.8rem;
}
}
}
// Covers Grid
.covers-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 1.25rem;
padding: 0.25rem;
}
.cover-card {
.cover-image-wrapper {
position: relative;
width: 150px;
height: 220px;
border-radius: 8px;
overflow: hidden;
background: var(--surface-ground);
border: 2px solid transparent;
&:hover {
border-color: var(--primary-color);
.cover-overlay {
opacity: 1;
}
}
::ng-deep {
.p-image {
width: 100%;
height: 100%;
}
.p-image-preview {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}
}
.p-image-preview-mask {
background: rgba(0, 0, 0, 0.6);
}
.p-image-preview-indicator {
border-radius: 4px;
}
}
}
.resolution-badge {
position: absolute;
top: 6px;
right: 6px;
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 3px 6px;
border-radius: 4px;
font-size: 0.7rem;
font-weight: 600;
z-index: 2;
pointer-events: none;
}
.cover-overlay {
position: absolute;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0.5rem;
background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
opacity: 0;
z-index: 3;
}
}
// Responsive
@media (max-width: 768px) {
.cover-search-container .search-section .form-grid {
grid-template-columns: 1fr;
.search-section .form-row {
flex-direction: column;
align-items: stretch;
.form-field .button-group {
justify-content: stretch;
.form-field {
&.title-field,
&.author-field {
flex: none;
}
}
::ng-deep .p-button {
.form-actions {
flex-direction: row;
justify-content: flex-end;
margin-top: 0.5rem;
::ng-deep .p-button:not(.p-button-icon-only) {
flex: 1;
}
}
}
.results-header {
flex-direction: column;
align-items: flex-start;
}
.covers-grid {
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
gap: 1rem;
}
}
@@ -10,6 +10,7 @@ import {ProgressSpinner} from 'primeng/progressspinner';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {BookService} from '../../../book/service/book.service';
import {Image} from 'primeng/image';
import {Tooltip} from 'primeng/tooltip';
@Component({
selector: 'app-cover-search',
@@ -20,7 +21,8 @@ import {Image} from 'primeng/image';
FormsModule,
InputText,
ProgressSpinner,
Image
Image,
Tooltip
],
styleUrls: ['./cover-search.component.scss']
})
@@ -1,7 +1,9 @@
<div class="flex flex-col space-y-6">
<app-metadata-advanced-fetch-options
(metadataOptionsSubmitted)="onMetadataSubmit($event)"
[currentMetadataOptions]="currentMetadataOptions"
[submitButtonLabel]="'Start Refresh'">
</app-metadata-advanced-fetch-options>
<div class="metadata-fetch-options-container">
<div class="dialog-content">
<app-metadata-advanced-fetch-options
(metadataOptionsSubmitted)="onMetadataSubmit($event)"
[currentMetadataOptions]="currentMetadataOptions"
[submitButtonLabel]="'Start Refresh'">
</app-metadata-advanced-fetch-options>
</div>
</div>
@@ -0,0 +1,10 @@
@use '../../../../../shared/styles/panel-shared' as panel;
.metadata-fetch-options-container {
display: flex;
flex-direction: column;
}
.panel-header {
@include panel.panel-header;
}
@@ -6,7 +6,6 @@ import {MetadataRefreshOptions} from '../../../model/request/metadata-refresh-op
import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {filter, take} from 'rxjs/operators';
import {MetadataAdvancedFetchOptionsComponent} from '../metadata-advanced-fetch-options/metadata-advanced-fetch-options.component';
import {TaskCreateRequest, TaskType} from '../../../../settings/task-management/task.service';
import {TaskHelperService} from '../../../../settings/task-management/task-helper.service';
@Component({
@@ -25,7 +24,7 @@ export class MetadataFetchOptionsComponent {
currentMetadataOptions!: MetadataRefreshOptions;
private dynamicDialogConfig = inject(DynamicDialogConfig);
private dynamicDialogRef = inject(DynamicDialogRef);
dynamicDialogRef = inject(DynamicDialogRef);
private taskHelperService = inject(TaskHelperService);
private appSettingsService = inject(AppSettingsService);
@@ -1,6 +1,24 @@
@if (!loading) {
<div class="px-4 pt-4 pb-2 h-full flex flex-col">
<div class="flex-grow overflow-auto">
<div class="metadata-review-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-pencil header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Review Metadata Proposal</h2>
<p class="panel-description">Review and accept fetched metadata</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="close()"
styleClass="close-button">
</p-button>
</div>
@if (!loading) {
<div class="dialog-content">
@if (currentProposal?.metadataJson; as proposed) {
<app-metadata-picker
[fetchedMetadata]="proposed"
@@ -11,25 +29,21 @@
}
</div>
<p-divider/>
<div class="flex justify-between items-center flex-wrap gap-2 pt-4">
<div class="flex items-center gap-2 pl-1 group"
pTooltip="{{ currentIndex + 1 }} of {{ proposals.length }} processed ({{ ((currentIndex + 1) / proposals.length * 100) | number: '1.0-0' }}%)"
tooltipPosition="top">
<p-progressBar
[value]="((currentIndex + 1) / proposals.length) * 100"
class="w-40 h-3 transition-all duration-300 ease-in-out group-hover:shadow-md"
showValue="false">
</p-progressBar>
<span class="text-sm text-gray-300 font-medium tabular-nums whitespace-nowrap">
Book {{ currentIndex + 1 }} / {{ proposals.length }}
</span>
<div class="dialog-footer">
<div class="footer-info">
<div class="progress-group" pTooltip="{{ currentIndex + 1 }} of {{ proposals.length }} processed ({{ ((currentIndex + 1) / proposals.length * 100) | number: '1.0-0' }}%)" tooltipPosition="top">
<p-progressBar
[value]="((currentIndex + 1) / proposals.length) * 100"
class="progress-bar"
showValue="false">
</p-progressBar>
<span class="progress-text">
Book {{ currentIndex + 1 }} / {{ proposals.length }}
</span>
</div>
</div>
<div class="flex flex-wrap gap-2 justify-end">
<div class="footer-actions">
<p-button
label="Close"
icon="pi pi-times-circle"
@@ -77,12 +91,11 @@
[outlined]="true"
(click)="onNext()">
</p-button>
</div>
</div>
</div>
} @else {
<div class="p-4 h-full flex items-center justify-center">
<p-progressSpinner class="w-8 h-8" strokeWidth="4"></p-progressSpinner>
</div>
}
} @else {
<div class="dialog-content loading-state">
<p-progressSpinner class="spinner" strokeWidth="4"></p-progressSpinner>
</div>
}
</div>
@@ -0,0 +1,95 @@
@use '../../../../shared/styles/panel-shared' as panel;
.metadata-review-container {
display: flex;
flex-direction: column;
height: 100%;
}
.panel-header {
@include panel.panel-header;
}
.dialog-content {
flex: 1;
overflow: auto;
padding: 1rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
&.loading-state {
display: flex;
align-items: center;
justify-content: center;
border-radius: 0 0 10px 10px;
}
.spinner {
width: 2rem;
height: 2rem;
}
}
.dialog-footer {
@include panel.dialog-footer;
.footer-info {
flex: 1;
min-width: 0;
}
.progress-group {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: help;
transition: all 0.3s ease;
&:hover {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
}
.progress-bar {
width: 10rem;
height: 0.75rem;
@media (max-width: 640px) {
width: 100%;
}
}
.progress-text {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-secondary-color);
white-space: nowrap;
font-variant-numeric: tabular-nums;
}
.footer-actions {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: flex-end;
}
@media (max-width: 640px) {
flex-direction: column;
align-items: stretch;
.footer-info {
width: 100%;
}
.progress-group {
width: 100%;
}
.footer-actions {
width: 100%;
justify-content: center;
}
}
}
@@ -1,32 +1,52 @@
<div class="rounded-xl">
<p-tabs [value]="'edit'" lazy="true">
<p-tablist>
@if (admin || canEditMetadata) {
<p-tab value="edit">Edit Metadata</p-tab>
}
@if (admin || canEditMetadata) {
<p-tab value="match">Search Metadata</p-tab>
}
</p-tablist>
<p-tabpanels class="h-[78dvh]">
@if (admin || canEditMetadata) {
<p-tabpanel value="edit">
<app-metadata-editor
[book$]="book$"
[disableNext]="disableNext"
[disablePrevious]="disablePrevious"
(nextBookClicked)="handleNextBook()"
(previousBookClicked)="handlePreviousBook()"
(closeDialogButtonClicked)="handleCloseDialogButton()"
[showNavigationButtons]="true"
></app-metadata-editor>
</p-tabpanel>
}
@if (admin || canEditMetadata) {
<p-tabpanel value="match">
<app-metadata-searcher [book$]="book$"></app-metadata-searcher>
</p-tabpanel>
}
</p-tabpanels>
</p-tabs>
<div class="multi-book-editor-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-pencil header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Edit Metadata</h2>
<p class="panel-description">{{ filteredBooks.length }} book{{ filteredBooks.length !== 1 ? 's' : '' }} selected</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="ref.close()"
styleClass="close-button">
</p-button>
</div>
<div class="dialog-content">
<p-tabs [value]="'edit'" lazy="true">
<p-tablist>
@if (admin || canEditMetadata) {
<p-tab value="edit">Edit Metadata</p-tab>
}
@if (admin || canEditMetadata) {
<p-tab value="match">Search Metadata</p-tab>
}
</p-tablist>
<p-tabpanels>
@if (admin || canEditMetadata) {
<p-tabpanel value="edit">
<app-metadata-editor
[book$]="book$"
[disableNext]="disableNext"
[disablePrevious]="disablePrevious"
(nextBookClicked)="handleNextBook()"
(previousBookClicked)="handlePreviousBook()"
(closeDialogButtonClicked)="handleCloseDialogButton()"
[showNavigationButtons]="true"
></app-metadata-editor>
</p-tabpanel>
}
@if (admin || canEditMetadata) {
<p-tabpanel value="match">
<app-metadata-searcher [book$]="book$"></app-metadata-searcher>
</p-tabpanel>
}
</p-tabpanels>
</p-tabs>
</div>
</div>
@@ -0,0 +1,47 @@
@use '../../../../shared/styles/panel-shared' as panel;
:host {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.multi-book-editor-container {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
min-height: 0;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
::ng-deep {
p-tabs {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
.p-tabpanels {
flex: 1;
min-height: 0;
}
}
}
@@ -8,6 +8,7 @@ import {UserService} from '../../../settings/user-management/user.service';
import {distinctUntilChanged, filter, map, shareReplay, switchMap, takeUntil} from 'rxjs/operators';
import {MetadataEditorComponent} from '../book-metadata-center/metadata-editor/metadata-editor.component';
import {MetadataSearcherComponent} from '../book-metadata-center/metadata-searcher/metadata-searcher.component';
import {Button} from 'primeng/button';
@Component({
selector: 'app-multi-book-metadata-editor-component',
@@ -18,7 +19,8 @@ import {MetadataSearcherComponent} from '../book-metadata-center/metadata-search
TabList,
TabPanel,
TabPanels,
Tabs
Tabs,
Button
],
templateUrl: './multi-book-metadata-editor-component.html',
standalone: true,
@@ -37,7 +39,7 @@ export class MultiBookMetadataEditorComponent implements OnInit, OnDestroy {
admin = false;
private readonly config = inject(DynamicDialogConfig);
private readonly ref = inject(DynamicDialogRef);
readonly ref = inject(DynamicDialogRef);
private readonly bookService = inject(BookService);
private readonly userService = inject(UserService);
@@ -1,16 +1,35 @@
<div class="mx-4 mb-4">
<p class="text-sm font-semibold mb-2 text-[var(--primary-color)]">
{{ booksToShow.length }} Books Selected
</p>
<div class="max-h-24 overflow-auto border border-gray-500 rounded p-2 text-sm">
<ul class="list-disc pl-5 space-y-1">
@for (book of booksToShow; track book.id) {
<li>
<span class="text-gray-400">#{{ book.id }}</span>: {{ book.metadata?.title || 'Untitled' }}
</li>
}
</ul>
<div class="multi-book-fetch-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-sync header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Metadata Refresh Options</h2>
<p class="panel-description">{{ booksToShow.length }} books selected</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="dialogRef.close()"
styleClass="close-button">
</p-button>
</div>
<div class="dialog-content">
<div class="book-list-section">
<div class="max-h-24 overflow-auto border border-gray-500 rounded p-2 text-sm">
<ul class="list-disc pl-5 space-y-1">
@for (book of booksToShow; track book.id) {
<li>
<span class="text-gray-400">#{{ book.id }}</span>: {{ book.metadata?.title || 'Untitled' }}
</li>
}
</ul>
</div>
</div>
<app-metadata-fetch-options></app-metadata-fetch-options>
</div>
</div>
<app-metadata-fetch-options></app-metadata-fetch-options>
@@ -0,0 +1,46 @@
@use '../../../../shared/styles/panel-shared' as panel;
:host {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.multi-book-fetch-container {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
min-height: 0;
padding: 1.5rem;
background: var(--card-background);
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 10px 10px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.book-list-section {
flex-shrink: 0;
margin-bottom: 1rem;
}
::ng-deep app-metadata-fetch-options {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
}
@@ -4,19 +4,20 @@ import {Subject, takeUntil} from 'rxjs';
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
import {MetadataRefreshOptions} from '../../model/request/metadata-refresh-options.model';
import {DynamicDialogConfig} from 'primeng/dynamicdialog';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {BookService} from '../../../book/service/book.service';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {Book} from '../../../book/model/book.model';
import {FormsModule} from '@angular/forms';
import {MetadataFetchOptionsComponent} from '../metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
import {Button} from 'primeng/button';
@Component({
selector: 'app-multi-book-metadata-fetch-component',
standalone: true,
templateUrl: './multi-book-metadata-fetch-component.html',
styleUrl: './multi-book-metadata-fetch-component.scss',
imports: [MetadataFetchOptionsComponent, FormsModule],
imports: [MetadataFetchOptionsComponent, FormsModule, Button],
})
export class MultiBookMetadataFetchComponent implements OnInit, OnDestroy {
bookIds!: number[];
@@ -27,6 +28,7 @@ export class MultiBookMetadataFetchComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>();
private dynamicDialogConfig = inject(DynamicDialogConfig);
dialogRef = inject(DynamicDialogRef);
private bookService = inject(BookService);
private appSettingsService = inject(AppSettingsService);
expanded = false;
@@ -10,6 +10,7 @@ import {Tooltip} from 'primeng/tooltip';
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
import {FontUploadDialogComponent} from './font-upload-dialog/font-upload-dialog.component';
import {Skeleton} from 'primeng/skeleton';
import {DialogSize, DialogStyle} from '../../../shared/services/dialog-launcher.service';
@Component({
selector: 'app-custom-fonts',
@@ -79,14 +80,10 @@ export class CustomFontsComponent implements OnInit {
this.uploadDialogRef = this.dialogService.open(FontUploadDialogComponent, {
showHeader: false,
styleClass: 'dynamic-dialog-minimal',
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
modal: true,
dismissableMask: false,
closable: false,
width: '700px',
breakpoints: {
'768px': '95vw'
}
});
if (this.uploadDialogRef) {
@@ -1,8 +1,6 @@
@use '../../../../shared/styles/panel-shared' as panel;
.create-user-dialog {
width: 800px;
max-width: 800px;
display: flex;
flex-direction: column;
@@ -1,7 +1,6 @@
@use '../../../shared/styles/panel-shared' as panel;
.user-profile-dialog {
width: 500px;
max-width: 650px;
display: flex;
flex-direction: column;