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]"> <div class="additional-file-uploader-container">
<!-- Book Information --> <div class="panel-header">
<div class="w-full text-center"> <div class="header-icon-wrapper">
<h3 class="text-lg font-semibold mb-2">{{ book.metadata?.title || 'Unknown Title' }}</h3> <i class="pi pi-file-plus header-icon"></i>
<p class="text-sm text-gray-600">{{ book.filePath }}</p> </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> </div>
<!-- File Type Selection --> <div class="dialog-content">
<!-- File Type Selection -->
<p-select <p-select
[options]="fileTypeOptions" [options]="fileTypeOptions"
[(ngModel)]="fileType" [(ngModel)]="fileType"
@@ -126,4 +139,5 @@
</div> </div>
</ng-template> </ng-template>
</p-fileupload> </p-fileupload>
</div>
</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 { :host ::ng-deep .p-fileupload-content p-progressbar {
display: none !important; display: none !important;
} }
@@ -185,4 +185,8 @@ export class AdditionalFileUploaderComponent implements OnInit, OnDestroy {
return 'info'; return 'info';
} }
} }
closeDialog(): void {
this.dialogRef.close();
}
} }
@@ -1,6 +1,6 @@
import {inject, Injectable} from '@angular/core'; import {inject, Injectable} from '@angular/core';
import {DynamicDialogRef} from 'primeng/dynamicdialog'; 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 {ShelfAssignerComponent} from '../shelf-assigner/shelf-assigner.component';
import {LockUnlockMetadataDialogComponent} from './lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component'; import {LockUnlockMetadataDialogComponent} from './lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component';
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum'; import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
@@ -27,8 +27,8 @@ export class BookDialogHelperService {
openBookDetailsDialog(bookId: number): DynamicDialogRef | null { openBookDetailsDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(BookMetadataCenterComponent, { return this.openDialog(BookMetadataCenterComponent, {
header: 'Book Details', showHeader: false,
styleClass: 'book-details-dialog dialog-maximal', styleClass: `book-details-dialog ${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: { data: {
bookId: bookId, bookId: bookId,
}, },
@@ -49,21 +49,21 @@ export class BookDialogHelperService {
return this.openDialog(ShelfAssignerComponent, { return this.openDialog(ShelfAssignerComponent, {
showHeader: false, showHeader: false,
data: data, data: data,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
}); });
} }
openShelfCreatorDialog(): DynamicDialogRef { openShelfCreatorDialog(): DynamicDialogRef {
return this.openDialog(ShelfCreatorComponent, { return this.openDialog(ShelfCreatorComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
})!; })!;
} }
openLockUnlockMetadataDialog(bookIds: Set<number>): DynamicDialogRef | null { openLockUnlockMetadataDialog(bookIds: Set<number>): DynamicDialogRef | null {
const count = bookIds.size;
return this.openDialog(LockUnlockMetadataDialogComponent, { return this.openDialog(LockUnlockMetadataDialogComponent, {
header: `Lock or Unlock Metadata for ${count} Selected Book${count > 1 ? 's' : ''}`, showHeader: false,
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
data: { data: {
bookIds: Array.from(bookIds), bookIds: Array.from(bookIds),
}, },
@@ -72,82 +72,84 @@ export class BookDialogHelperService {
openMetadataRefreshDialog(bookIds: Set<number>): DynamicDialogRef | null { openMetadataRefreshDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(MultiBookMetadataFetchComponent, { return this.openDialog(MultiBookMetadataFetchComponent, {
header: 'Metadata Refresh Options', showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: { data: {
bookIds: Array.from(bookIds), bookIds: Array.from(bookIds),
metadataRefreshType: MetadataRefreshType.BOOKS, metadataRefreshType: MetadataRefreshType.BOOKS,
}, },
styleClass: 'dialog-maximal',
}); });
} }
openBulkMetadataEditDialog(bookIds: Set<number>): DynamicDialogRef | null { openBulkMetadataEditDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(BulkMetadataUpdateComponent, { return this.openDialog(BulkMetadataUpdateComponent, {
header: 'Bulk Edit Metadata', showHeader: false,
styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
data: { data: {
bookIds: Array.from(bookIds), bookIds: Array.from(bookIds),
}, },
styleClass: 'dialog-maximal'
}); });
} }
openMultibookMetadataEditorDialog(bookIds: Set<number>): DynamicDialogRef | null { openMultibookMetadataEditorDialog(bookIds: Set<number>): DynamicDialogRef | null {
return this.openDialog(MultiBookMetadataEditorComponent, { return this.openDialog(MultiBookMetadataEditorComponent, {
header: 'Multi-Book Metadata Editor', showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: { data: {
bookIds: Array.from(bookIds), bookIds: Array.from(bookIds),
}, },
styleClass: 'dialog-full'
}); });
} }
openFileMoverDialog(bookIds: Set<number>): DynamicDialogRef | null { openFileMoverDialog(bookIds: Set<number>): DynamicDialogRef | null {
const count = bookIds.size;
return this.openDialog(FileMoverComponent, { return this.openDialog(FileMoverComponent, {
header: `Organize Book Files (${count} book${count !== 1 ? 's' : ''})`, showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
maximizable: true,
data: { data: {
bookIds: Array.from(bookIds), bookIds: Array.from(bookIds),
}, },
styleClass: 'dialog-full',
maximizable: true,
}); });
} }
openCustomSendDialog(bookId: number): DynamicDialogRef | null { openCustomSendDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(BookSenderComponent, { return this.openDialog(BookSenderComponent, {
header: 'Send Book to Email', showHeader: false,
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: { data: {
bookId: bookId, bookId: bookId,
} },
}); });
} }
openCoverSearchDialog(bookId: number): DynamicDialogRef | null { openCoverSearchDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(CoverSearchComponent, { return this.openDialog(CoverSearchComponent, {
header: "Search Cover", showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: { data: {
bookId: bookId, bookId: bookId,
}, },
styleClass: 'dialog-maximal',
}); });
} }
openMetadataFetchOptionsDialog(bookId: number): DynamicDialogRef | null { openMetadataFetchOptionsDialog(bookId: number): DynamicDialogRef | null {
return this.openDialog(MetadataFetchOptionsComponent, { return this.openDialog(MetadataFetchOptionsComponent, {
header: 'Metadata Refresh Options', showHeader: false,
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: { data: {
bookIds: [bookId], bookIds: [bookId],
metadataRefreshType: MetadataRefreshType.BOOKS, metadataRefreshType: MetadataRefreshType.BOOKS,
} },
}); });
} }
openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null { openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null {
return this.openDialog(AdditionalFileUploaderComponent, { return this.openDialog(AdditionalFileUploaderComponent, {
header: 'Upload Additional File', showHeader: false,
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
data: { data: {
book: book, book: book,
} },
}); });
} }
} }
@@ -1,29 +1,48 @@
<div class="p-2"> <div class="lock-unlock-container">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-x-24 gap-y-4"> <div class="panel-header">
@for (field of lockableFields; track field) { <div class="header-icon-wrapper">
<div class="flex items-center justify-between"> <i class="pi pi-lock header-icon"></i>
<label class="capitalize">{{ fieldLabels[field] || field }}</label> </div>
<p-button <div class="header-text">
[outlined]="true" <h2 class="panel-title">Lock or Unlock Metadata</h2>
[label]="getLockLabel(field)" <p class="panel-description">{{ bookIds.size }} book{{ bookIds.size > 1 ? 's' : '' }} selected</p>
[icon]="getLockIcon(field)" </div>
[severity]="fieldLocks[field] === true ? 'danger' : fieldLocks[field] === false ? 'success' : 'secondary'" <p-button
(click)="cycleLockState(field)" icon="pi pi-times"
></p-button> [rounded]="true"
</div> [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>
</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 { export class LockUnlockMetadataDialogComponent implements OnInit {
private bookService = inject(BookService); private bookService = inject(BookService);
private dynamicDialogConfig = inject(DynamicDialogConfig); private dynamicDialogConfig = inject(DynamicDialogConfig);
private dialogRef = inject(DynamicDialogRef); dialogRef = inject(DynamicDialogRef);
private messageService = inject(MessageService); private messageService = inject(MessageService);
private loadingService = inject(LoadingService); private loadingService = inject(LoadingService);
fieldLocks: Record<string, boolean | undefined> = {}; 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 <div class="dialog-content">
[options]="emailProviders" <div class="flex flex-col gap-6">
optionLabel="label" <div class="flex flex-col gap-2">
placeholder="Select Email Provider" <label class="text-sm font-medium text-gray-300">Email Provider</label>
[(ngModel)]="selectedProvider" <p-select
appendTo="body" [options]="emailProviders"
class="w-full"> optionLabel="label"
</p-select> placeholder="Select Email Provider"
[(ngModel)]="selectedProvider"
appendTo="body"
class="w-full">
</p-select>
</div>
<p-select <div class="flex flex-col gap-2">
[options]="emailRecipients" <label class="text-sm font-medium text-gray-300">Recipient</label>
optionLabel="label" <p-select
placeholder="Select Book Recipient" [options]="emailRecipients"
[(ngModel)]="selectedRecipient" optionLabel="label"
[disabled]="!selectedProvider" placeholder="Select Book Recipient"
appendTo="body" [(ngModel)]="selectedRecipient"
class="w-full"> [disabled]="!selectedProvider"
</p-select> appendTo="body"
class="w-full">
<p-button </p-select>
icon="pi pi-envelope" </div>
label="Email Book" </div>
[disabled]="!selectedProvider || !selectedRecipient" </div>
(onClick)="sendBook()">
</p-button>
<div class="dialog-footer">
<p-button
icon="pi pi-envelope"
label="Send Book"
[disabled]="!selectedProvider || !selectedRecipient"
(onClick)="sendBook()">
</p-button>
</div>
</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 emailRecipientService = inject(EmailV2RecipientService);
private emailService = inject(EmailService); private emailService = inject(EmailService);
private messageService = inject(MessageService); private messageService = inject(MessageService);
private dynamicDialogRef = inject(DynamicDialogRef); dynamicDialogRef = inject(DynamicDialogRef);
private dynamicDialogConfig = inject(DynamicDialogConfig); private dynamicDialogConfig = inject(DynamicDialogConfig);
bookId: number = this.dynamicDialogConfig.data.bookId; bookId: number = this.dynamicDialogConfig.data.bookId;
@@ -1,53 +1,67 @@
<div class="max-w-3xl mx-auto"> <div class="import-result-container">
<div class="mb-8"> <div class="panel-header">
<div class="p-6 bg-zinc-800/50 rounded-xl border border-zinc-500"> <div class="header-icon-wrapper">
<div class="grid grid-cols-3 gap-6 mb-6"> <i class="pi pi-file-import header-icon"></i>
<div class="text-center p-4 bg-zinc-700/30 rounded-lg"> </div>
<div class="text-3xl font-bold text-blue-400 mb-1">{{ result.totalFiles }}</div> <div class="header-text">
<div class="text-sm text-gray-400 font-medium">Total Files</div> <h2 class="panel-title">Import Summary</h2>
</div> <p class="panel-description">Results of your book import</p>
<div class="text-center p-4 bg-zinc-700/30 rounded-lg"> </div>
<div class="text-3xl font-bold text-green-400 mb-1">{{ result.successfullyImported }}</div> <p-button
<div class="text-sm text-gray-400 font-medium">Successfully Imported</div> icon="pi pi-times"
</div> [rounded]="true"
<div class="text-center p-4 bg-zinc-700/30 rounded-lg"> [text]="true"
<div class="text-3xl font-bold text-red-400 mb-1">{{ result.failed }}</div> severity="secondary"
<div class="text-sm text-gray-400 font-medium">Failed</div> (click)="ref.close()"
</div> styleClass="close-button">
</div> </p-button>
</div>
<div class="text-center pt-4 border-t border-zinc-600"> <div class="dialog-content">
<div class="text-sm text-gray-300 mb-1">Processed at</div> <div class="stats-grid">
<div class="text-base text-white font-mono">{{ result.processedAt | date:'medium' }}</div> <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>
</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"> <div class="processed-info">
<span class="font-medium text-sm text-white"> <div class="processed-label">Processed at</div>
{{ r.fileName }} <div class="processed-time">{{ result.processedAt | date:'medium' }}</div>
</span> </div>
<span class="text-sm text-gray-400">{{ r.message }}</span>
</div> <div class="results-list">
</li> <ul class="file-list">
} @for (r of result.results; track r) {
</ul> <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>
</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 {DatePipe, NgClass} from '@angular/common';
import {BookdropFinalizeResult} from '../../service/bookdrop.service'; import {BookdropFinalizeResult} from '../../service/bookdrop.service';
import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog"; import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog";
import {Button} from 'primeng/button';
@Component({ @Component({
selector: 'app-bookdrop-finalize-result-dialog', selector: 'app-bookdrop-finalize-result-dialog',
imports: [ imports: [
NgClass, NgClass,
DatePipe DatePipe,
Button
], ],
templateUrl: './bookdrop-finalize-result-dialog.component.html', templateUrl: './bookdrop-finalize-result-dialog.component.html',
styleUrl: './bookdrop-finalize-result-dialog.component.scss' styleUrl: './bookdrop-finalize-result-dialog.component.scss'
@@ -1,8 +1,6 @@
@use '../../../shared/styles/panel-shared' as panel; @use '../../../shared/styles/panel-shared' as panel;
.magic-shelf-container { .magic-shelf-container {
width: 75rem;
max-width: 75rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1,5 +1,25 @@
<div class="rounded-xl overflow-hidden border-[1px] border-solid border-[var(--p-content-border-color)]"> <div class="book-metadata-center-container">
<p-tabs [(value)]="tab" lazy="true" scrollable> @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-tablist>
<p-tab value="view"> <p-tab value="view">
<i [class]="'pi pi-book'"></i> <i [class]="'pi pi-book'"></i>
@@ -39,4 +59,5 @@
} }
</p-tabpanels> </p-tabpanels>
</p-tabs> </p-tabs>
</div>
</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 { ::ng-deep .layout-main .tabpanels-responsive {
height: calc(100dvh - 9.7rem); height: calc(100dvh - 9.7rem);
} }
@@ -23,8 +41,3 @@
::ng-deep .book-details-dialog .p-dialog-content { ::ng-deep .book-details-dialog .p-dialog-content {
padding: 0; 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 {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {Tab, TabList, TabPanel, TabPanels, Tabs,} from 'primeng/tabs'; import {Tab, TabList, TabPanel, TabPanels, Tabs,} from 'primeng/tabs';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog'; import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {Button} from 'primeng/button';
import {BookMetadataHostService} from '../../../../shared/service/book-metadata-host.service'; import {BookMetadataHostService} from '../../../../shared/service/book-metadata-host.service';
import {MetadataViewerComponent} from './metadata-viewer/metadata-viewer.component'; import {MetadataViewerComponent} from './metadata-viewer/metadata-viewer.component';
import {MetadataEditorComponent} from './metadata-editor/metadata-editor.component'; import {MetadataEditorComponent} from './metadata-editor/metadata-editor.component';
@@ -25,7 +26,8 @@ import {MetadataSearcherComponent} from './metadata-searcher/metadata-searcher.c
TabPanel, TabPanel,
MetadataViewerComponent, MetadataViewerComponent,
MetadataEditorComponent, MetadataEditorComponent,
MetadataSearcherComponent MetadataSearcherComponent,
Button
], ],
styleUrls: ['./book-metadata-center.component.scss'], styleUrls: ['./book-metadata-center.component.scss'],
}) })
@@ -65,8 +67,8 @@ export class BookMetadataCenterComponent implements OnInit, OnDestroy {
} }
constructor( constructor(
@Optional() private config?: DynamicDialogConfig, @Optional() public config?: DynamicDialogConfig,
@Optional() private ref?: DynamicDialogRef @Optional() public ref?: DynamicDialogRef
) { ) {
} }
@@ -101,6 +101,7 @@ label {
flex-direction: column; flex-direction: column;
flex-grow: 1; flex-grow: 1;
overflow: auto; overflow: auto;
height: 72.5dvh;
@media (min-width: 768px) { @media (min-width: 768px) {
padding: 0.5rem; padding: 0.5rem;
@@ -315,8 +316,7 @@ label {
z-index: 10; z-index: 10;
@media (min-width: 768px) { @media (min-width: 768px) {
padding: 0.5rem; padding: 1rem;
padding-bottom: 1rem;
} }
} }
@@ -1,362 +1,382 @@
<div class="relative"> <div class="bulk-update-container">
@if (loading) { <div class="panel-header">
<div class="absolute inset-0 z-50 flex items-center justify-center bg-black/60"> <div class="header-icon-wrapper">
<p-progressSpinner></p-progressSpinner> <i class="pi pi-pencil header-icon"></i>
</div> </div>
} <div class="header-text">
<h2 class="panel-title">Bulk Edit Metadata</h2>
<div class="p-4 border border-gray-700 rounded-md mb-4 bg-gray-900 text-gray-200"> <p class="panel-description">{{ books.length }} book{{ books.length !== 1 ? 's' : '' }} selected</p>
<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> </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="dialog-content relative">
<div class="max-h-48 overflow-y-auto border-t border-gray-700 pt-2 pl-1 text-sm text-gray-300"> @if (loading) {
<ul class="list-disc pl-5 space-y-1"> <div class="absolute inset-0 z-50 flex items-center justify-center bg-black/60">
@for (book of books; track book) { <p-progressSpinner></p-progressSpinner>
<li>{{ book.metadata?.title || 'Untitled Book' }}</li>
}
</ul>
</div> </div>
} }
</div>
<div class="px-4 text-sm text-yellow-500 mb-2"> <div class="p-4 border border-gray-700 rounded-md mb-4 bg-gray-900 text-gray-200">
<i class="pi pi-exclamation-triangle mr-1"></i> <div class="flex justify-between items-center mb-2">
Checking <strong>Clear</strong> will remove that field’s metadata from <strong>all selected books</strong>. <p class="text-base font-semibold">
</div> 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"> <div class="px-4 text-sm text-yellow-500 mb-2">
<!-- Authors --> <i class="pi pi-exclamation-triangle mr-1"></i>
<div class="flex flex-col gap-2 w-full md:basis-[80%]"> Checking <strong>Clear</strong> will remove that field's metadata from <strong>all selected books</strong>.
<label for="authors" class="flex items-center justify-between gap-2"> </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"> <span class="flex items-center gap-2">
Author(s) Genre(s)
<i class="pi pi-info-circle text-sky-600" <i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple authors. Press Enter after typing each name." pTooltip="Enter multiple genres. Press Enter after typing each genre."
tooltipPosition="right" tooltipPosition="right"
style="cursor: pointer"></i> style="cursor: pointer"></i>
</span> </span>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.authors" [ngModelOptions]="{standalone: true}" (onChange)="onFieldClearToggle('authors')" binary="true" inputId="clearAuthors"/> <p-checkbox [(ngModel)]="clearFields.genres" [ngModelOptions]="{standalone: true}"
<label for="clearAuthors" class="text-sm text-gray-300 cursor-pointer">Clear</label> (onChange)="onFieldClearToggle('genres')" binary="true" inputId="clearGenres"/>
<label for="clearGenres" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div> </div>
</label> </label>
<p-autoComplete <p-autoComplete
class="w-full" class="w-full"
id="authors" id="genres"
formControlName="authors" formControlName="genres"
[disabled]="clearFields.authors" [disabled]="clearFields.genres"
[multiple]="true" [multiple]="true"
[dropdown]="false" [dropdown]="false"
[forceSelection]="false" [forceSelection]="false"
[suggestions]="filteredAuthors" [suggestions]="filteredGenres"
(completeMethod)="filterAuthors($event)" (completeMethod)="filterGenres($event)"
(onKeyUp)="onAutoCompleteKeyUp('authors', $event)" (onKeyUp)="onAutoCompleteKeyUp('genres', $event)"
(onSelect)="onAutoCompleteSelect('authors', $event)"> (onSelect)="onAutoCompleteSelect('genres', $event)">
</p-autoComplete> </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> </div>
<!-- Language --> <!-- Moods -->
<div class="flex flex-col gap-2 md:basis-[20%]"> <div class="flex flex-col gap-2">
<label for="language" class="flex items-center justify-between gap-2"> <label for="moods" 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"> <span class="flex items-center gap-2">
Total Books Mood(s)
<i class="pi pi-info-circle text-sky-600" <i class="pi pi-info-circle text-sky-600"
pTooltip="Total number of books in the series." pTooltip="Enter multiple moods. Press Enter after typing each mood."
tooltipPosition="right" tooltipPosition="right"
style="cursor: pointer"></i> style="cursor: pointer"></i>
</span> </span>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.seriesTotal" [ngModelOptions]="{standalone: true}" <p-checkbox [(ngModel)]="clearFields.moods" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('seriesTotal')" binary="true" inputId="clearSeriesTotal"/> (onChange)="onFieldClearToggle('moods')" binary="true" inputId="clearMoods"/>
<label for="clearSeriesTotal" class="text-sm text-gray-300 cursor-pointer">Clear</label> <label for="clearMoods" class="text-sm text-gray-300 cursor-pointer">Clear</label>
</div> </div>
</label> </label>
<input pInputText id="seriesTotal" type="number" min="1" formControlName="seriesTotal" <p-autoComplete
[disabled]="clearFields.seriesTotal" class="w-full"/> class="w-full"
</div> id="moods"
</div> 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 items-center gap-2 mt-2">
<div class="flex flex-col gap-2"> <p-checkbox
<label for="genres" class="flex items-center justify-between gap-2"> inputId="mergeMoods"
<span class="flex items-center gap-2"> name="mergeMoods"
Genre(s) [(ngModel)]="mergeMoods"
<i class="pi pi-info-circle text-sky-600" [ngModelOptions]="{ standalone: true }"
pTooltip="Enter multiple genres. Press Enter after typing each genre." binary="true"
tooltipPosition="right" />
style="cursor: pointer"></i> <label for="mergeMoods" class="text-sm text-gray-300 cursor-pointer">
</span> Keep existing moods and add new ones (uncheck to remove all existing moods)
<div class="flex items-center gap-1"> </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> </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>
</div>
<!-- Moods --> <!-- Tags -->
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<label for="moods" class="flex items-center justify-between gap-2"> <label for="tags" class="flex items-center justify-between gap-2">
<span class="flex items-center gap-2"> <span class="flex items-center gap-2">
Mood(s) Tag(s)
<i class="pi pi-info-circle text-sky-600" <i class="pi pi-info-circle text-sky-600"
pTooltip="Enter multiple moods. Press Enter after typing each mood." pTooltip="Enter multiple tags. Press Enter after typing each tag."
tooltipPosition="right" tooltipPosition="right"
style="cursor: pointer"></i> style="cursor: pointer"></i>
</span> </span>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<p-checkbox [(ngModel)]="clearFields.moods" [ngModelOptions]="{standalone: true}" <p-checkbox [(ngModel)]="clearFields.tags" [ngModelOptions]="{standalone: true}"
(onChange)="onFieldClearToggle('moods')" binary="true" inputId="clearMoods"/> (onChange)="onFieldClearToggle('tags')" binary="true" inputId="clearTags"/>
<label for="clearMoods" class="text-sm text-gray-300 cursor-pointer">Clear</label> <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> </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>
</div>
<!-- Tags --> <!-- Cover Image Upload Section -->
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2 border border-gray-700 rounded-md p-4 bg-gray-900">
<label for="tags" class="flex items-center justify-between gap-2"> <label class="flex items-center gap-2 text-base font-semibold">
<span class="flex items-center gap-2"> <i class="pi pi-image"></i>
Tag(s) Cover Image
<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> </label>
</div> <p class="text-sm text-gray-400">
</div> Upload an image to set as the cover for all selected books.
</p>
<!-- Cover Image Upload Section --> <div class="flex items-center gap-4 mt-2">
<div class="flex flex-col gap-2 border border-gray-700 rounded-md p-4 bg-gray-900"> @if (selectedCoverFile) {
<label class="flex items-center gap-2 text-base font-semibold"> <div class="flex items-center gap-2 text-sm text-gray-300">
<i class="pi pi-image"></i> <i class="pi pi-file-image"></i>
Cover Image <span>{{ selectedCoverFile.name }}</span>
</label> <p-button
<p class="text-sm text-gray-400"> icon="pi pi-times"
Upload an image to set as the cover for all selected books. [text]="true"
</p> size="small"
<div class="flex items-center gap-4 mt-2"> severity="danger"
@if (selectedCoverFile) { (onClick)="clearCoverFile()"
<div class="flex items-center gap-2 text-sm text-gray-300"> pTooltip="Remove file"
<i class="pi pi-file-image"></i> tooltipPosition="top">
<span>{{ selectedCoverFile.name }}</span> </p-button>
</div>
} @else {
<input
type="file"
#coverFileInput
accept="image/jpeg,image/png,image/webp"
(change)="onCoverFileSelect($event)"
class="hidden">
<p-button <p-button
icon="pi pi-times" icon="pi pi-upload"
[text]="true" label="Select Image"
[outlined]="true"
size="small" size="small"
severity="danger" severity="info"
(onClick)="clearCoverFile()" (onClick)="coverFileInput.click()">
pTooltip="Remove file"
tooltipPosition="top">
</p-button> </p-button>
</div> }
} @else { </div>
<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"> <div class="flex justify-end mt-4">
<p-button type="submit" label="Apply to Selected" [disabled]="loading"/> <p-button type="submit" label="Apply to Selected" [disabled]="loading"/>
</div> </div>
</form> </form>
</div>
</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 { ::ng-deep .p-inputchips {
width: 100%; width: 100%;
} }
@@ -57,7 +57,7 @@ export class BulkMetadataUpdateComponent implements OnInit {
}; };
private readonly config = inject(DynamicDialogConfig); private readonly config = inject(DynamicDialogConfig);
private readonly ref = inject(DynamicDialogRef); readonly ref = inject(DynamicDialogRef);
private readonly fb = inject(FormBuilder); private readonly fb = inject(FormBuilder);
private readonly bookService = inject(BookService); private readonly bookService = inject(BookService);
private readonly messageService = inject(MessageService); private readonly messageService = inject(MessageService);
@@ -1,99 +1,150 @@
<div class="cover-search-container"> <div class="cover-search-container">
<div class="search-section"> <div class="panel-header">
<form [formGroup]="searchForm" (ngSubmit)="onSearch()"> <div class="header-icon-wrapper">
<div class="form-grid"> <i class="pi pi-image header-icon"></i>
<div class="form-field"> </div>
<label for="title">Title *</label> <div class="header-text">
<input <h2 class="panel-title">Search Cover Images</h2>
pInputText <p class="panel-description">Find and select a cover for your book</p>
id="title" </div>
formControlName="title" <p-button
placeholder="Enter book title" icon="pi pi-times"
/> [rounded]="true"
@if (searchForm.get('title')?.invalid && searchForm.get('title')?.touched) { [text]="true"
<small class="error-message"> severity="secondary"
Title is required (click)="dynamicDialogRef.close()"
</small> styleClass="close-button">
} </p-button>
</div> </div>
<div class="form-field"> <div class="dialog-content">
<label for="author">Author</label> <!-- Search Form -->
<input <div class="search-section">
pInputText <form [formGroup]="searchForm" (ngSubmit)="onSearch()">
id="author" <div class="form-row">
formControlName="author" <div class="form-field title-field">
placeholder="Enter author name" <label for="title">
/> <i class="pi pi-book"></i>
</div> 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"> <div class="form-field author-field">
<label>&nbsp;</label> <label for="author">
<div class="button-group"> <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 <p-button
type="submit" type="submit"
outlined label="Search"
label="Search Covers"
icon="pi pi-search" icon="pi pi-search"
[loading]="loading" [loading]="loading"
[disabled]="searchForm.invalid"> [disabled]="searchForm.invalid">
</p-button> </p-button>
<p-button <p-button
type="button" type="button"
label="Clear" icon="pi pi-refresh"
icon="pi pi-times" [text]="true"
[rounded]="true"
severity="secondary"
(click)="onClear()" (click)="onClear()"
styleClass="p-button-secondary p-button-outlined"> pTooltip="Reset search"
tooltipPosition="top">
</p-button> </p-button>
</div> </div>
</div> </div>
</div> </form>
</form> </div>
</div>
@if (hasSearched) { <!-- Results Area -->
<div class="results-section"> <div class="results-section">
@if (loading) { @if (!hasSearched) {
<div class="loading-container"> <!-- Initial State -->
<p-progressSpinner></p-progressSpinner> <div class="empty-state">
<p>Searching for book covers...</p> <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> </div>
} } @else if (loading) {
<!-- Loading State -->
@if (!loading && coverImages.length === 0) { <div class="loading-state">
<div class="no-results"> <p-progressSpinner strokeWidth="3" animationDuration="1s"></p-progressSpinner>
<i class="pi pi-info-circle"></i> <p>Searching for covers...</p>
<p>No cover images found. Try adjusting your search terms.</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> </div>
}
@if (!loading && coverImages.length > 0) {
<div class="covers-grid"> <div class="covers-grid">
@for (cover of coverImages; track cover.url; let i = $index) { @for (cover of coverImages; track cover.url; let i = $index) {
<div class="cover-item"> <div class="cover-card">
<p-image <div class="cover-image-wrapper">
[src]="cover.url" <p-image
[alt]="'Book cover ' + (i + 1)" [src]="cover.url"
appendTo="body" [alt]="'Book cover ' + (i + 1)"
[preview]="true"> appendTo="body"
</p-image> [preview]="true">
@if (cover.width && cover.height) { </p-image>
<div class="resolution-overlay"> @if (cover.width && cover.height) {
{{cover.width}} x {{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> </div>
} </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>
} </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 { .cover-search-container {
margin: 0 auto; display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
.search-section { .panel-header {
background: var(--surface-card); @include panel.panel-header;
border: 1px solid var(--surface-border); flex-shrink: 0;
border-radius: 8px; }
padding: 0 1.5rem 0 1.5rem;
margin-bottom: 2rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
h2 { .dialog-content {
margin: 0 0 1.5rem 0; flex: 1;
color: var(--text-color); 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 { &.author-field {
display: grid; flex: 1;
grid-template-columns: 1fr 1fr auto; }
gap: 1rem;
align-items: end;
.form-field { label {
display: flex; display: flex;
flex-direction: column; align-items: center;
gap: 0.5rem; gap: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
color: var(--text-color-secondary);
label { i {
font-weight: 500; font-size: 0.875rem;
color: var(--text-color); color: var(--primary-color);
} }
.error-message { .required {
color: var(--red-500); color: var(--red-400);
font-size: 0.875rem;
}
} }
} }
.button-group { input {
width: 100%;
}
.error-message {
display: flex; display: flex;
gap: 0.5rem; align-items: center;
flex-wrap: wrap; gap: 0.35rem;
color: var(--red-400);
font-size: 0.8rem;
i {
font-size: 0.75rem;
}
} }
} }
.results-section { .form-actions {
padding: 0 1.5rem 0 1.5rem; display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 1px;
}
}
.loading-container { // Results Section
display: flex; .results-section {
flex-direction: column; flex: 1;
align-items: center; display: flex;
padding: 3rem; flex-direction: column;
background: var(--surface-card); min-height: 0;
border-radius: 8px; }
border: 1px solid var(--surface-border);
p { // Empty & Loading States
margin-top: 1rem; .empty-state,
color: var(--text-secondary-color); .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 { h3 {
display: flex; margin: 0 0 0.5rem;
flex-direction: column; font-size: 1.125rem;
align-items: center; font-weight: 600;
padding: 3rem; color: var(--text-color);
color: var(--text-secondary-color); }
background: var(--surface-card);
border-radius: 8px;
border: 1px solid var(--surface-border);
i { p {
font-size: 2rem; margin: 0;
margin-bottom: 1rem; font-size: 0.9rem;
} color: var(--text-color-secondary);
} max-width: 300px;
}
}
.covers-grid { .empty-state-icon {
display: grid; width: 80px;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); height: 80px;
gap: 1.5rem; display: flex;
padding: 1rem 0; 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 { i {
position: relative; font-size: 2rem;
border: 1px solid transparent; color: var(--primary-color);
border-radius: 8px; }
padding: 4px;
transition: all 0.3s ease;
&:hover { &.warning {
border-color: var(--primary-color); background: linear-gradient(135deg, var(--yellow-100), var(--yellow-50));
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.resolution-overlay { i {
position: absolute; color: var(--yellow-600);
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;
}
}
} }
} }
} }
.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) { @media (max-width: 768px) {
.cover-search-container .search-section .form-grid { .search-section .form-row {
grid-template-columns: 1fr; flex-direction: column;
align-items: stretch;
.form-field .button-group { .form-field {
justify-content: stretch; &.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; 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 {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {BookService} from '../../../book/service/book.service'; import {BookService} from '../../../book/service/book.service';
import {Image} from 'primeng/image'; import {Image} from 'primeng/image';
import {Tooltip} from 'primeng/tooltip';
@Component({ @Component({
selector: 'app-cover-search', selector: 'app-cover-search',
@@ -20,7 +21,8 @@ import {Image} from 'primeng/image';
FormsModule, FormsModule,
InputText, InputText,
ProgressSpinner, ProgressSpinner,
Image Image,
Tooltip
], ],
styleUrls: ['./cover-search.component.scss'] styleUrls: ['./cover-search.component.scss']
}) })
@@ -1,7 +1,9 @@
<div class="flex flex-col space-y-6"> <div class="metadata-fetch-options-container">
<app-metadata-advanced-fetch-options <div class="dialog-content">
(metadataOptionsSubmitted)="onMetadataSubmit($event)" <app-metadata-advanced-fetch-options
[currentMetadataOptions]="currentMetadataOptions" (metadataOptionsSubmitted)="onMetadataSubmit($event)"
[submitButtonLabel]="'Start Refresh'"> [currentMetadataOptions]="currentMetadataOptions"
</app-metadata-advanced-fetch-options> [submitButtonLabel]="'Start Refresh'">
</app-metadata-advanced-fetch-options>
</div>
</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 {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {filter, take} from 'rxjs/operators'; import {filter, take} from 'rxjs/operators';
import {MetadataAdvancedFetchOptionsComponent} from '../metadata-advanced-fetch-options/metadata-advanced-fetch-options.component'; 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'; import {TaskHelperService} from '../../../../settings/task-management/task-helper.service';
@Component({ @Component({
@@ -25,7 +24,7 @@ export class MetadataFetchOptionsComponent {
currentMetadataOptions!: MetadataRefreshOptions; currentMetadataOptions!: MetadataRefreshOptions;
private dynamicDialogConfig = inject(DynamicDialogConfig); private dynamicDialogConfig = inject(DynamicDialogConfig);
private dynamicDialogRef = inject(DynamicDialogRef); dynamicDialogRef = inject(DynamicDialogRef);
private taskHelperService = inject(TaskHelperService); private taskHelperService = inject(TaskHelperService);
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
@@ -1,6 +1,24 @@
@if (!loading) { <div class="metadata-review-container">
<div class="px-4 pt-4 pb-2 h-full flex flex-col"> <div class="panel-header">
<div class="flex-grow overflow-auto"> <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) { @if (currentProposal?.metadataJson; as proposed) {
<app-metadata-picker <app-metadata-picker
[fetchedMetadata]="proposed" [fetchedMetadata]="proposed"
@@ -11,25 +29,21 @@
} }
</div> </div>
<p-divider/> <div class="dialog-footer">
<div class="footer-info">
<div class="flex justify-between items-center flex-wrap gap-2 pt-4"> <div class="progress-group" pTooltip="{{ currentIndex + 1 }} of {{ proposals.length }} processed ({{ ((currentIndex + 1) / proposals.length * 100) | number: '1.0-0' }}%)" tooltipPosition="top">
<p-progressBar
<div class="flex items-center gap-2 pl-1 group" [value]="((currentIndex + 1) / proposals.length) * 100"
pTooltip="{{ currentIndex + 1 }} of {{ proposals.length }} processed ({{ ((currentIndex + 1) / proposals.length * 100) | number: '1.0-0' }}%)" class="progress-bar"
tooltipPosition="top"> showValue="false">
<p-progressBar </p-progressBar>
[value]="((currentIndex + 1) / proposals.length) * 100" <span class="progress-text">
class="w-40 h-3 transition-all duration-300 ease-in-out group-hover:shadow-md" Book {{ currentIndex + 1 }} / {{ proposals.length }}
showValue="false"> </span>
</p-progressBar> </div>
<span class="text-sm text-gray-300 font-medium tabular-nums whitespace-nowrap">
Book {{ currentIndex + 1 }} / {{ proposals.length }}
</span>
</div> </div>
<div class="flex flex-wrap gap-2 justify-end"> <div class="footer-actions">
<p-button <p-button
label="Close" label="Close"
icon="pi pi-times-circle" icon="pi pi-times-circle"
@@ -77,12 +91,11 @@
[outlined]="true" [outlined]="true"
(click)="onNext()"> (click)="onNext()">
</p-button> </p-button>
</div> </div>
</div> </div>
</div> } @else {
} @else { <div class="dialog-content loading-state">
<div class="p-4 h-full flex items-center justify-center"> <p-progressSpinner class="spinner" strokeWidth="4"></p-progressSpinner>
<p-progressSpinner class="w-8 h-8" strokeWidth="4"></p-progressSpinner> </div>
</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"> <div class="multi-book-editor-container">
<p-tabs [value]="'edit'" lazy="true"> <div class="panel-header">
<p-tablist> <div class="header-icon-wrapper">
@if (admin || canEditMetadata) { <i class="pi pi-pencil header-icon"></i>
<p-tab value="edit">Edit Metadata</p-tab> </div>
} <div class="header-text">
@if (admin || canEditMetadata) { <h2 class="panel-title">Edit Metadata</h2>
<p-tab value="match">Search Metadata</p-tab> <p class="panel-description">{{ filteredBooks.length }} book{{ filteredBooks.length !== 1 ? 's' : '' }} selected</p>
} </div>
</p-tablist> <p-button
<p-tabpanels class="h-[78dvh]"> icon="pi pi-times"
@if (admin || canEditMetadata) { [rounded]="true"
<p-tabpanel value="edit"> [text]="true"
<app-metadata-editor severity="secondary"
[book$]="book$" (click)="ref.close()"
[disableNext]="disableNext" styleClass="close-button">
[disablePrevious]="disablePrevious" </p-button>
(nextBookClicked)="handleNextBook()" </div>
(previousBookClicked)="handlePreviousBook()"
(closeDialogButtonClicked)="handleCloseDialogButton()" <div class="dialog-content">
[showNavigationButtons]="true" <p-tabs [value]="'edit'" lazy="true">
></app-metadata-editor> <p-tablist>
</p-tabpanel> @if (admin || canEditMetadata) {
} <p-tab value="edit">Edit Metadata</p-tab>
@if (admin || canEditMetadata) { }
<p-tabpanel value="match"> @if (admin || canEditMetadata) {
<app-metadata-searcher [book$]="book$"></app-metadata-searcher> <p-tab value="match">Search Metadata</p-tab>
</p-tabpanel> }
} </p-tablist>
</p-tabpanels> <p-tabpanels>
</p-tabs> @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> </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 {distinctUntilChanged, filter, map, shareReplay, switchMap, takeUntil} from 'rxjs/operators';
import {MetadataEditorComponent} from '../book-metadata-center/metadata-editor/metadata-editor.component'; import {MetadataEditorComponent} from '../book-metadata-center/metadata-editor/metadata-editor.component';
import {MetadataSearcherComponent} from '../book-metadata-center/metadata-searcher/metadata-searcher.component'; import {MetadataSearcherComponent} from '../book-metadata-center/metadata-searcher/metadata-searcher.component';
import {Button} from 'primeng/button';
@Component({ @Component({
selector: 'app-multi-book-metadata-editor-component', selector: 'app-multi-book-metadata-editor-component',
@@ -18,7 +19,8 @@ import {MetadataSearcherComponent} from '../book-metadata-center/metadata-search
TabList, TabList,
TabPanel, TabPanel,
TabPanels, TabPanels,
Tabs Tabs,
Button
], ],
templateUrl: './multi-book-metadata-editor-component.html', templateUrl: './multi-book-metadata-editor-component.html',
standalone: true, standalone: true,
@@ -37,7 +39,7 @@ export class MultiBookMetadataEditorComponent implements OnInit, OnDestroy {
admin = false; admin = false;
private readonly config = inject(DynamicDialogConfig); private readonly config = inject(DynamicDialogConfig);
private readonly ref = inject(DynamicDialogRef); readonly ref = inject(DynamicDialogRef);
private readonly bookService = inject(BookService); private readonly bookService = inject(BookService);
private readonly userService = inject(UserService); private readonly userService = inject(UserService);
@@ -1,16 +1,35 @@
<div class="mx-4 mb-4"> <div class="multi-book-fetch-container">
<p class="text-sm font-semibold mb-2 text-[var(--primary-color)]"> <div class="panel-header">
{{ booksToShow.length }} Books Selected <div class="header-icon-wrapper">
</p> <i class="pi pi-sync header-icon"></i>
<div class="max-h-24 overflow-auto border border-gray-500 rounded p-2 text-sm"> </div>
<ul class="list-disc pl-5 space-y-1"> <div class="header-text">
@for (book of booksToShow; track book.id) { <h2 class="panel-title">Metadata Refresh Options</h2>
<li> <p class="panel-description">{{ booksToShow.length }} books selected</p>
<span class="text-gray-400">#{{ book.id }}</span>: {{ book.metadata?.title || 'Untitled' }} </div>
</li> <p-button
} icon="pi pi-times"
</ul> [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>
</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 {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
import {MetadataRefreshOptions} from '../../model/request/metadata-refresh-options.model'; 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 {BookService} from '../../../book/service/book.service';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {Book} from '../../../book/model/book.model'; import {Book} from '../../../book/model/book.model';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {MetadataFetchOptionsComponent} from '../metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component'; import {MetadataFetchOptionsComponent} from '../metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component';
import {Button} from 'primeng/button';
@Component({ @Component({
selector: 'app-multi-book-metadata-fetch-component', selector: 'app-multi-book-metadata-fetch-component',
standalone: true, standalone: true,
templateUrl: './multi-book-metadata-fetch-component.html', templateUrl: './multi-book-metadata-fetch-component.html',
styleUrl: './multi-book-metadata-fetch-component.scss', styleUrl: './multi-book-metadata-fetch-component.scss',
imports: [MetadataFetchOptionsComponent, FormsModule], imports: [MetadataFetchOptionsComponent, FormsModule, Button],
}) })
export class MultiBookMetadataFetchComponent implements OnInit, OnDestroy { export class MultiBookMetadataFetchComponent implements OnInit, OnDestroy {
bookIds!: number[]; bookIds!: number[];
@@ -27,6 +28,7 @@ export class MultiBookMetadataFetchComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>(); private destroy$ = new Subject<void>();
private dynamicDialogConfig = inject(DynamicDialogConfig); private dynamicDialogConfig = inject(DynamicDialogConfig);
dialogRef = inject(DynamicDialogRef);
private bookService = inject(BookService); private bookService = inject(BookService);
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
expanded = false; expanded = false;
@@ -10,6 +10,7 @@ import {Tooltip} from 'primeng/tooltip';
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog'; import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
import {FontUploadDialogComponent} from './font-upload-dialog/font-upload-dialog.component'; import {FontUploadDialogComponent} from './font-upload-dialog/font-upload-dialog.component';
import {Skeleton} from 'primeng/skeleton'; import {Skeleton} from 'primeng/skeleton';
import {DialogSize, DialogStyle} from '../../../shared/services/dialog-launcher.service';
@Component({ @Component({
selector: 'app-custom-fonts', selector: 'app-custom-fonts',
@@ -79,14 +80,10 @@ export class CustomFontsComponent implements OnInit {
this.uploadDialogRef = this.dialogService.open(FontUploadDialogComponent, { this.uploadDialogRef = this.dialogService.open(FontUploadDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
modal: true, modal: true,
dismissableMask: false, dismissableMask: false,
closable: false, closable: false,
width: '700px',
breakpoints: {
'768px': '95vw'
}
}); });
if (this.uploadDialogRef) { if (this.uploadDialogRef) {
@@ -1,8 +1,6 @@
@use '../../../../shared/styles/panel-shared' as panel; @use '../../../../shared/styles/panel-shared' as panel;
.create-user-dialog { .create-user-dialog {
width: 800px;
max-width: 800px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1,7 +1,6 @@
@use '../../../shared/styles/panel-shared' as panel; @use '../../../shared/styles/panel-shared' as panel;
.user-profile-dialog { .user-profile-dialog {
width: 500px;
max-width: 650px; max-width: 650px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -1,9 +1,27 @@
<div class="p-fluid px-4 py-2 rounded-xl flex flex-col h-full"> <div class="file-mover-container">
<div class="panel-header">
<div class="header-icon-wrapper">
<i class="pi pi-folder-open header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">Move & Organize Files</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>
<div class="px-4 mx-2 mb-4 py-3 rounded-lg border border-[var(--border-color)] transition-all"> <div class="dialog-content">
<p class="text-[var(--primary-color)] font-semibold mb-1"> <div class="px-4 mx-2 mb-4 py-3 rounded-lg border border-[var(--border-color)] transition-all">
File Organization Preview <p class="text-[var(--primary-color)] font-semibold mb-1">
</p> File Organization Preview
</p>
<div class="text-sm text-gray-300 space-y-3"> <div class="text-sm text-gray-300 space-y-3">
<p> <p>
Your files will be automatically renamed, organized, and can be moved between libraries based on your preferences. Your files will be automatically renamed, organized, and can be moved between libraries based on your preferences.
@@ -157,9 +175,9 @@
</p-table> </p-table>
</div> </div>
<p-divider></p-divider> </div>
<div class="flex justify-end items-center gap-4 flex-shrink-0 px-4 pt-4"> <div class="dialog-footer">
@if (movedFileCount > 0) { @if (movedFileCount > 0) {
<span class="text-green-500 flex items-center font-semibold drop-shadow-sm select-none"> <span class="text-green-500 flex items-center font-semibold drop-shadow-sm select-none">
{{ movedFileCount }} file{{ movedFileCount > 1 ? 's' : '' }} successfully moved {{ movedFileCount }} file{{ movedFileCount > 1 ? 's' : '' }} successfully moved
@@ -182,7 +200,8 @@
<p-button <p-button
label="Cancel" label="Cancel"
icon="pi pi-times" icon="pi pi-times"
severity="danger" severity="secondary"
[text]="true"
(click)="cancel()" (click)="cancel()"
></p-button> ></p-button>
} @else { } @else {
@@ -1,3 +1,42 @@
@use '../../styles/panel-shared' as panel;
:host {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.file-mover-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: 1rem;
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;
}
:host ::ng-deep .p-datatable-tbody > tr > td { :host ::ng-deep .p-datatable-tbody > tr > td {
padding: 0.5rem 1rem !important; padding: 0.5rem 1rem !important;
} }
@@ -2,7 +2,6 @@ import {Component, inject, OnDestroy} from '@angular/core';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {TableModule} from 'primeng/table'; import {TableModule} from 'primeng/table';
import {Divider} from 'primeng/divider';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog'; import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {MessageService} from 'primeng/api'; import {MessageService} from 'primeng/api';
import {filter, take, takeUntil} from 'rxjs/operators'; import {filter, take, takeUntil} from 'rxjs/operators';
@@ -36,13 +35,13 @@ interface FilePreview {
@Component({ @Component({
selector: 'app-file-mover-component', selector: 'app-file-mover-component',
standalone: true, standalone: true,
imports: [Button, FormsModule, TableModule, Divider, Select], imports: [Button, FormsModule, TableModule, Select],
templateUrl: './file-mover-component.html', templateUrl: './file-mover-component.html',
styleUrl: './file-mover-component.scss' styleUrl: './file-mover-component.scss'
}) })
export class FileMoverComponent implements OnDestroy { export class FileMoverComponent implements OnDestroy {
private config = inject(DynamicDialogConfig); private config = inject(DynamicDialogConfig);
private ref = inject(DynamicDialogRef); ref = inject(DynamicDialogRef);
private bookService = inject(BookService); private bookService = inject(BookService);
private libraryService = inject(LibraryService); private libraryService = inject(LibraryService);
private fileOperationsService = inject(FileOperationsService); private fileOperationsService = inject(FileOperationsService);
@@ -1,58 +1,78 @@
<div class="support-dialog-container"> <div class="support-dialog-container">
<div class="header-section"> <div class="panel-header">
<span class="badge"> <div class="header-icon-wrapper">
Open Source & Community Driven <i class="pi pi-heart header-icon"></i>
</span> </div>
<h2 class="title"> <div class="header-text">
Booklore <h2 class="panel-title">Support Booklore</h2>
</h2> <p class="panel-description">Help us grow and improve</p>
<p class="description"> </div>
A modern platform crafted to help you curate, organize, and cherish your personal library with elegance and simplicity. <p-button
</p> icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="close()"
styleClass="close-button">
</p-button>
</div> </div>
<div class="actions-section"> <div class="dialog-content">
<a href="https://github.com/booklore-app/booklore" target="_blank" rel="noopener noreferrer"> <div class="header-section">
<p-button <span class="badge">
label="Star on GitHub" Open Source & Community Driven
icon="pi pi-github" </span>
outlined <h2 class="title">
severity="success" Booklore
styleClass="action-button"> </h2>
</p-button> <p class="description">
</a> A modern platform crafted to help you curate, organize, and cherish your personal library with elegance and simplicity.
<a href="https://opencollective.com/booklore" target="_blank" rel="noopener noreferrer">
<p-button
label="Support via Open Collective"
icon="pi pi-heart"
severity="info"
outlined
styleClass="action-button">
</p-button>
</a>
</div>
<div class="footer-section">
<div class="support-info">
<p>
Starring the project on <span class="highlight github">GitHub</span> increases visibility, helps Booklore reach more book lovers, and motivates ongoing development.
</p>
<p>
Financial contributions through <span class="highlight open-collective">Open Collective</span> directly support hosting infrastructure, feature development, and long-term sustainability.
</p>
<p class="final-message">
Every form of support, stars, feedback, or contributions, helps keep Booklore thriving and accessible for all book enthusiasts.
</p> </p>
</div> </div>
<p class="commitment">
Booklore is and will always remain free for everyone.
</p>
</div>
<div class="message-section"> <div class="actions-section">
<p class="message"> <a href="https://github.com/booklore-app/booklore" target="_blank" rel="noopener noreferrer">
Your support and engagement fuel Booklore's continuous evolution and inspire meaningful improvements. <p-button
</p> label="Star on GitHub"
<p class="author">- Aditya, Creator & Maintainer</p> icon="pi pi-github"
outlined
severity="success"
styleClass="action-button">
</p-button>
</a>
<a href="https://opencollective.com/booklore" target="_blank" rel="noopener noreferrer">
<p-button
label="Support via Open Collective"
icon="pi pi-heart"
severity="info"
outlined
styleClass="action-button">
</p-button>
</a>
</div>
<div class="footer-section">
<div class="support-info">
<p>
Starring the project on <span class="highlight github">GitHub</span> increases visibility, helps Booklore reach more book lovers, and motivates ongoing development.
</p>
<p>
Financial contributions through <span class="highlight open-collective">Open Collective</span> directly support hosting infrastructure, feature development, and long-term sustainability.
</p>
<p class="final-message">
Every form of support, stars, feedback, or contributions, helps keep Booklore thriving and accessible for all book enthusiasts.
</p>
</div>
<p class="commitment">
Booklore is and will always remain free for everyone.
</p>
</div>
<div class="message-section">
<p class="message">
Your support and engagement fuel Booklore's continuous evolution and inspire meaningful improvements.
</p>
<p class="author">- Aditya, Creator & Maintainer</p>
</div>
</div> </div>
</div> </div>
@@ -1,12 +1,22 @@
@use '../../styles/panel-shared' as panel;
.support-dialog-container { .support-dialog-container {
max-width: 850px;
margin: 0 auto; margin: 0 auto;
padding: 2rem 1.5rem; display: flex;
flex-direction: column;
}
.panel-header {
@include panel.panel-header;
}
.dialog-content {
padding: 1.5rem 1.5rem 2.5rem;
background: var(--card-background); background: var(--card-background);
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: 0.75rem; border-top: none;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5); border-radius: 0 0 10px 10px;
padding-top: 20px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
} }
.header-section { .header-section {
@@ -96,7 +106,6 @@
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.6; line-height: 1.6;
color: var(--text-color-secondary); color: var(--text-color-secondary);
max-width: 850px;
margin: 0 auto 1.25rem; margin: 0 auto 1.25rem;
p { p {
@@ -1,5 +1,6 @@
import {Component} from '@angular/core'; import {Component, inject} from '@angular/core';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
@Component({ @Component({
selector: 'app-github-support-dialog', selector: 'app-github-support-dialog',
@@ -10,4 +11,9 @@ import {Button} from 'primeng/button';
styleUrls: ['./github-support-dialog.scss'] styleUrls: ['./github-support-dialog.scss']
}) })
export class GithubSupportDialog { export class GithubSupportDialog {
private dialogRef = inject(DynamicDialogRef);
close(): void {
this.dialogRef.close();
}
} }
@@ -1,166 +1,188 @@
<p-tabs [(value)]="activeTabIndex"> <div class="icon-picker-container">
<p-tablist> <div class="panel-header">
<p-tab value="0">Prime Icons</p-tab> <div class="header-icon-wrapper">
<p-tab value="1">SVG Icons</p-tab> <i class="pi pi-palette header-icon"></i>
@if (canManageIcons) { </div>
<p-tab value="2">Add SVG Icon(s)</p-tab> <div class="header-text">
} <h2 class="panel-title">Choose an Icon</h2>
</p-tablist> <p class="panel-description">Select or upload custom icons</p>
<p-tabpanels> </div>
<p-tabpanel value="0"> <p-button
<input type="text" placeholder="Search Prime icons..." [(ngModel)]="searchText" class="icon-search"/> icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="ref.close()"
styleClass="close-button">
</p-button>
</div>
<div class="icon-grid"> <div class="dialog-content">
@for (icon of filteredIcons(); track icon) { <p-tabs [(value)]="activeTabIndex">
<div <p-tablist>
class="icon-item" <p-tab value="0">Prime Icons</p-tab>
(click)="selectIcon(icon)" <p-tab value="1">SVG Icons</p-tab>
[class.selected]="icon === selectedIcon" @if (canManageIcons) {
[title]="icon"> <p-tab value="2">Add SVG Icon(s)</p-tab>
<i [class]="icon"></i>
</div>
} }
</div> </p-tablist>
</p-tabpanel> <p-tabpanels>
<p-tabpanel value="1"> <p-tabpanel value="0">
<div class="svg-browse-container"> <input type="text" placeholder="Search Prime icons..." [(ngModel)]="searchText" class="icon-search"/>
@if (isLoadingSvgIcons) {
<div class="loading-message">Loading icons...</div>
} @else if (svgIconsError) {
<div class="error-message">{{ svgIconsError }}</div>
} @else {
<input type="text" placeholder="Search SVG icons..." [(ngModel)]="svgSearchText" class="icon-search"/>
<div class="icon-grid"> <div class="icon-grid">
@for (iconName of filteredSvgIcons(); track iconName) { @for (icon of filteredIcons(); track icon) {
<div <div
class="icon-item svg-icon-item" class="icon-item"
(click)="selectSvgIcon(iconName)" (click)="selectIcon(icon)"
[class.selected]="iconName === selectedSvgIcon" [class.selected]="icon === selectedIcon"
[title]="iconName" [title]="icon">
draggable="true" <i [class]="icon"></i>
(dragstart)="onSvgIconDragStart(iconName)"
(dragend)="onSvgIconDragEnd()"
>
<div
class="svg-icon-inline"
[innerHTML]="getSvgContent(iconName)"
></div>
</div> </div>
} }
</div> </div>
</p-tabpanel>
<p-tabpanel value="1">
<div class="svg-browse-container">
@if (isLoadingSvgIcons) {
<div class="loading-message">Loading icons...</div>
} @else if (svgIconsError) {
<div class="error-message">{{ svgIconsError }}</div>
} @else {
<input type="text" placeholder="Search SVG icons..." [(ngModel)]="svgSearchText" class="icon-search"/>
<div class="icon-grid">
@if (canManageIcons) { @for (iconName of filteredSvgIcons(); track iconName) {
<div style="display: flex; align-items: center; position: fixed; right: 32px; bottom: 32px; z-index: 101;"> <div
<div class="icon-item svg-icon-item"
class="svg-trash-area" (click)="selectSvgIcon(iconName)"
[class.trash-hover]="isTrashHover" [class.selected]="iconName === selectedSvgIcon"
(dragover)="onTrashDragOver($event)" [title]="iconName"
(dragleave)="onTrashDragLeave($event)" draggable="true"
(drop)="onTrashDrop($event)"> (dragstart)="onSvgIconDragStart(iconName)"
<i class="pi pi-trash"></i> (dragend)="onSvgIconDragEnd()"
<span>Drag here to delete icon</span> >
</div> <div
</div> class="svg-icon-inline"
} [innerHTML]="getSvgContent(iconName)"
} ></div>
</div>
</p-tabpanel>
@if (canManageIcons) {
<p-tabpanel value="2">
<div class="svg-paste-container">
<div class="svg-input-section">
<input
type="text"
[(ngModel)]="svgName"
placeholder="Enter icon name for saving"
class="svg-name-input"
/>
<textarea
[(ngModel)]="svgContent"
(ngModelChange)="onSvgContentChange()"
placeholder="Paste your SVG code here..."
class="svg-textarea"
rows="8"></textarea>
@if (svgContent && svgPreview) {
<div class="svg-preview-section">
<h4 class="preview-title">Preview</h4>
<div class="svg-preview" [innerHTML]="svgPreview"></div>
</div>
}
@if (errorMessage) {
<div class="error-message">{{ errorMessage }}</div>
}
<div class="button-container">
<p-button
(onClick)="addSvgEntry()"
[disabled]="!svgContent || !svgName"
label="Add to Queue"
severity="primary"
outlined
icon="pi pi-plus">
</p-button>
</div>
</div>
@if (svgEntries.length > 0) {
<div class="svg-entries-section">
<div class="entries-header">
<h4 class="entries-title">
Queued Icons ({{ svgEntries.length }})
</h4>
<p-button
(onClick)="clearAllEntries()"
label="Clear All"
severity="danger"
[text]="true"
icon="pi pi-times">
</p-button>
</div>
<div class="entries-grid">
@for (entry of svgEntries; track entry.name; let i = $index) {
<div class="entry-card" [class.has-error]="entry.error">
<div class="entry-header">
<span class="entry-name">{{ entry.name }}</span>
<button
class="entry-remove"
(click)="removeSvgEntry(i)"
title="Remove">
<i class="pi pi-times"></i>
</button>
</div>
<div class="entry-preview" [innerHTML]="entry.preview"></div>
@if (entry.error) {
<div class="entry-error">{{ entry.error }}</div>
}
</div> </div>
} }
</div> </div>
@if (batchErrorMessage) {
<div class="error-message">{{ batchErrorMessage }}</div>
}
<div class="batch-actions"> @if (canManageIcons) {
<p-button <div style="display: flex; align-items: center; position: fixed; right: 32px; bottom: 32px; z-index: 101;">
(onClick)="saveAllSvgs()" <div
[loading]="isSavingBatch" class="svg-trash-area"
[disabled]="svgEntries.length === 0" [class.trash-hover]="isTrashHover"
label="Save All Icons" (dragover)="onTrashDragOver($event)"
severity="success" (dragleave)="onTrashDragLeave($event)"
icon="pi pi-save"> (drop)="onTrashDrop($event)">
</p-button> <i class="pi pi-trash"></i>
<span>Drag here to delete icon</span>
</div>
</div>
}
}
</div>
</p-tabpanel>
@if (canManageIcons) {
<p-tabpanel value="2">
<div class="svg-paste-container">
<div class="svg-input-section">
<input
type="text"
[(ngModel)]="svgName"
placeholder="Enter icon name for saving"
class="svg-name-input"
/>
<textarea
[(ngModel)]="svgContent"
(ngModelChange)="onSvgContentChange()"
placeholder="Paste your SVG code here..."
class="svg-textarea"
rows="8"></textarea>
@if (svgContent && svgPreview) {
<div class="svg-preview-section">
<h4 class="preview-title">Preview</h4>
<div class="svg-preview" [innerHTML]="svgPreview"></div>
</div>
}
@if (errorMessage) {
<div class="error-message">{{ errorMessage }}</div>
}
<div class="button-container">
<p-button
(onClick)="addSvgEntry()"
[disabled]="!svgContent || !svgName"
label="Add to Queue"
severity="primary"
outlined
icon="pi pi-plus">
</p-button>
</div>
</div> </div>
@if (svgEntries.length > 0) {
<div class="svg-entries-section">
<div class="entries-header">
<h4 class="entries-title">
Queued Icons ({{ svgEntries.length }})
</h4>
<p-button
(onClick)="clearAllEntries()"
label="Clear All"
severity="danger"
[text]="true"
icon="pi pi-times">
</p-button>
</div>
<div class="entries-grid">
@for (entry of svgEntries; track entry.name; let i = $index) {
<div class="entry-card" [class.has-error]="entry.error">
<div class="entry-header">
<span class="entry-name">{{ entry.name }}</span>
<button
class="entry-remove"
(click)="removeSvgEntry(i)"
title="Remove">
<i class="pi pi-times"></i>
</button>
</div>
<div class="entry-preview" [innerHTML]="entry.preview"></div>
@if (entry.error) {
<div class="entry-error">{{ entry.error }}</div>
}
</div>
}
</div>
@if (batchErrorMessage) {
<div class="error-message">{{ batchErrorMessage }}</div>
}
<div class="batch-actions">
<p-button
(onClick)="saveAllSvgs()"
[loading]="isSavingBatch"
[disabled]="svgEntries.length === 0"
label="Save All Icons"
severity="success"
icon="pi pi-save">
</p-button>
</div>
</div>
}
</div> </div>
} </p-tabpanel>
</div> }
</p-tabpanel> </p-tabpanels>
} </p-tabs>
</p-tabpanels> </div>
</p-tabs> </div>
@@ -1,3 +1,28 @@
@use '../../styles/panel-shared' as panel;
.icon-picker-container {
display: flex;
flex-direction: column;
max-height: 85dvh;
}
.panel-header {
@include panel.panel-header;
flex-shrink: 0;
}
.dialog-content {
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);
overflow-y: auto;
flex: 1;
min-height: 0;
}
.icon-grid { .icon-grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(25px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(25px, 1fr));
@@ -1,26 +1,48 @@
@if (loading) { <div class="changelog-container">
<div class="p-4 text-center text-gray-400"> <div class="panel-header">
Loading changelog... <div class="header-icon-wrapper">
<i class="pi pi-sparkles header-icon"></i>
</div>
<div class="header-text">
<h2 class="panel-title">What's New</h2>
<p class="panel-description">Latest updates and improvements</p>
</div>
<p-button
icon="pi pi-times"
[rounded]="true"
[text]="true"
severity="secondary"
(click)="dialogRef.close()"
styleClass="close-button">
</p-button>
</div> </div>
}
@if (!loading && changelog.length === 0) { <div class="dialog-content">
<div class="p-4 text-center text-gray-400"> @if (loading) {
No updates available. <div class="loading-state">
</div> Loading changelog...
} </div>
}
@if (!loading && changelog.length > 0) { @if (!loading && changelog.length === 0) {
<div class="space-y-6 p-4 overflow-auto"> <div class="empty-state">
@for (release of changelog; track release) { No updates available.
<div class="border-b pb-4"> </div>
<p class="font-bold text-2xl pb-2"> }
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
{{ release.name }} ({{ release.publishedAt | date: 'mediumDate' }}) @if (!loading && changelog.length > 0) {
</a> <div class="changelog-list">
</p> @for (release of changelog; track release) {
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div> <div class="release-item">
<p class="release-title">
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="release-link">
{{ release.name }} ({{ release.publishedAt | date: 'mediumDate' }})
</a>
</p>
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
</div>
}
</div> </div>
} }
</div> </div>
} </div>
@@ -1,3 +1,64 @@
@use '../../../../../shared/styles/panel-shared' as panel;
.changelog-container {
display: flex;
flex-direction: column;
max-height: 90dvh;
}
.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);
overflow-y: auto;
flex: 1;
}
.loading-state,
.empty-state {
padding: 1rem;
text-align: center;
color: var(--text-secondary-color);
}
.changelog-list {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.release-item {
padding-bottom: 1rem;
border-bottom: 1px solid var(--border-color);
&:last-child {
border-bottom: none;
}
}
.release-title {
font-weight: 700;
font-size: 1.25rem;
padding-bottom: 0.5rem;
margin: 0;
}
.release-link {
color: var(--primary-color);
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
:host ::ng-deep .prose h3 { :host ::ng-deep .prose h3 {
margin-top: 0px; margin-top: 0;
} }
@@ -4,12 +4,15 @@ import { ReleaseNote, VersionService } from '../../../../service/version.service
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import showdown from 'showdown'; import showdown from 'showdown';
import {DatePipe} from '@angular/common'; import {DatePipe} from '@angular/common';
import {DynamicDialogRef} from 'primeng/dynamicdialog';
import {Button} from 'primeng/button';
@Component({ @Component({
selector: 'app-version-changelog-dialog', selector: 'app-version-changelog-dialog',
standalone: true, standalone: true,
imports: [ imports: [
DatePipe DatePipe,
Button
], ],
templateUrl: './version-changelog-dialog.component.html', templateUrl: './version-changelog-dialog.component.html',
styleUrl: './version-changelog-dialog.component.scss' styleUrl: './version-changelog-dialog.component.scss'
@@ -18,6 +21,7 @@ export class VersionChangelogDialogComponent implements OnInit {
private versionService = inject(VersionService); private versionService = inject(VersionService);
private sanitizer = inject(DomSanitizer); private sanitizer = inject(DomSanitizer);
dialogRef = inject(DynamicDialogRef);
changelog: ReleaseNote[] = []; changelog: ReleaseNote[] = [];
loading = true; loading = true;
@@ -19,6 +19,25 @@ import {MetadataFetchOptionsComponent} from '../../features/metadata/component/m
import {ShelfEditDialogComponent} from '../../features/book/components/shelf-edit-dialog/shelf-edit-dialog.component'; import {ShelfEditDialogComponent} from '../../features/book/components/shelf-edit-dialog/shelf-edit-dialog.component';
import {IconPickerComponent} from '../components/icon-picker/icon-picker-component'; import {IconPickerComponent} from '../components/icon-picker/icon-picker-component';
/**
* Dialog size classes - use these to control dialog dimensions
*/
export const DialogSize = {
XS: 'dialog-xs', // ~400px - confirmations, simple alerts
SM: 'dialog-sm', // ~550px - simple forms, pickers
MD: 'dialog-md', // ~700px - standard dialogs
LG: 'dialog-lg', // ~900px - complex forms, lists
XL: 'dialog-xl', // ~1200px - data-heavy views
FULL: 'dialog-full', // viewport - fullscreen editors
} as const;
/**
* Dialog style modifiers - composable with size classes
*/
export const DialogStyle = {
MINIMAL: 'dialog-minimal', // removes padding for custom headers
} as const;
@Injectable({ @Injectable({
providedIn: 'root', providedIn: 'root',
}) })
@@ -41,41 +60,41 @@ export class DialogLauncherService {
return this.dialogService.open(component as Type<any>, { return this.dialogService.open(component as Type<any>, {
...this.defaultDialogOptions, ...this.defaultDialogOptions,
...options, ...options,
}); });
} }
openDashboardSettingsDialog(): DynamicDialogRef | null { openDashboardSettingsDialog(): DynamicDialogRef | null {
return this.openDialog(DashboardSettingsComponent, { return this.openDialog(DashboardSettingsComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
}); });
} }
openGithubSupportDialog(): DynamicDialogRef | null { openGithubSupportDialog(): DynamicDialogRef | null {
return this.openDialog(GithubSupportDialog, { return this.openDialog(GithubSupportDialog, {
header: 'Support Booklore', showHeader: false,
styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
}); });
} }
openLibraryCreateDialog(): DynamicDialogRef | null { openLibraryCreateDialog(): DynamicDialogRef | null {
return this.openDialog(LibraryCreatorComponent, { return this.openDialog(LibraryCreatorComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
}); });
} }
openDirectoryPickerDialog(): DynamicDialogRef | null { openDirectoryPickerDialog(): DynamicDialogRef | null {
return this.openDialog(DirectoryPickerComponent, { return this.openDialog(DirectoryPickerComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
}); });
} }
openLibraryEditDialog(libraryId: number): DynamicDialogRef | null { openLibraryEditDialog(libraryId: number): DynamicDialogRef | null {
return this.openDialog(LibraryCreatorComponent, { return this.openDialog(LibraryCreatorComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
data: { data: {
mode: 'edit', mode: 'edit',
libraryId: libraryId libraryId: libraryId
@@ -85,7 +104,8 @@ export class DialogLauncherService {
openLibraryMetadataFetchDialog(libraryId: number): DynamicDialogRef | null { openLibraryMetadataFetchDialog(libraryId: number): DynamicDialogRef | null {
return this.openDialog(MetadataFetchOptionsComponent, { return this.openDialog(MetadataFetchOptionsComponent, {
header: 'Metadata Refresh Options', showHeader: false,
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: { data: {
libraryId: libraryId, libraryId: libraryId,
metadataRefreshType: MetadataRefreshType.LIBRARY, metadataRefreshType: MetadataRefreshType.LIBRARY,
@@ -96,7 +116,7 @@ export class DialogLauncherService {
openShelfEditDialog(shelfId: number): DynamicDialogRef | null { openShelfEditDialog(shelfId: number): DynamicDialogRef | null {
return this.openDialog(ShelfEditDialogComponent, { return this.openDialog(ShelfEditDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
data: { data: {
shelfId: shelfId shelfId: shelfId
}, },
@@ -106,35 +126,35 @@ export class DialogLauncherService {
openFileUploadDialog(): DynamicDialogRef | null { openFileUploadDialog(): DynamicDialogRef | null {
return this.openDialog(BookUploaderComponent, { return this.openDialog(BookUploaderComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
}); });
} }
openCreateUserDialog(): DynamicDialogRef | null { openCreateUserDialog(): DynamicDialogRef | null {
return this.openDialog(CreateUserDialogComponent, { return this.openDialog(CreateUserDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
}); });
} }
openUserProfileDialog(): DynamicDialogRef | null { openUserProfileDialog(): DynamicDialogRef | null {
return this.openDialog(UserProfileDialogComponent, { return this.openDialog(UserProfileDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
}); });
} }
openMagicShelfCreateDialog(): DynamicDialogRef | null { openMagicShelfCreateDialog(): DynamicDialogRef | null {
return this.openDialog(MagicShelfComponent, { return this.openDialog(MagicShelfComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
}); });
} }
openMagicShelfEditDialog(shelfId: number): DynamicDialogRef | null { openMagicShelfEditDialog(shelfId: number): DynamicDialogRef | null {
return this.openDialog(MagicShelfComponent, { return this.openDialog(MagicShelfComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.XL} ${DialogStyle.MINIMAL}`,
data: { data: {
id: shelfId, id: shelfId,
editMode: true, editMode: true,
@@ -144,28 +164,29 @@ export class DialogLauncherService {
openVersionChangelogDialog(): DynamicDialogRef | null { openVersionChangelogDialog(): DynamicDialogRef | null {
return this.openDialog(VersionChangelogDialogComponent, { return this.openDialog(VersionChangelogDialogComponent, {
header: "What's New", showHeader: false,
styleClass: 'dialog-medium', styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
}); });
} }
openEmailRecipientDialog(): DynamicDialogRef | null { openEmailRecipientDialog(): DynamicDialogRef | null {
return this.openDialog(CreateEmailRecipientDialogComponent, { return this.openDialog(CreateEmailRecipientDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
}); });
} }
openEmailProviderDialog(): DynamicDialogRef | null { openEmailProviderDialog(): DynamicDialogRef | null {
return this.openDialog(CreateEmailProviderDialogComponent, { return this.openDialog(CreateEmailProviderDialogComponent, {
showHeader: false, showHeader: false,
styleClass: 'dynamic-dialog-minimal', styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
}); });
} }
openBookdropFinalizeResultDialog(result: BookdropFinalizeResult): DynamicDialogRef | null { openBookdropFinalizeResultDialog(result: BookdropFinalizeResult): DynamicDialogRef | null {
return this.openDialog(BookdropFinalizeResultDialogComponent, { return this.openDialog(BookdropFinalizeResultDialogComponent, {
header: 'Import Summary', showHeader: false,
styleClass: `${DialogSize.MD} ${DialogStyle.MINIMAL}`,
data: { data: {
result: result, result: result,
}, },
@@ -174,19 +195,18 @@ export class DialogLauncherService {
openMetadataReviewDialog(taskId: string): DynamicDialogRef | null { openMetadataReviewDialog(taskId: string): DynamicDialogRef | null {
return this.openDialog(MetadataReviewDialogComponent, { return this.openDialog(MetadataReviewDialogComponent, {
header: 'Review Metadata Proposal', showHeader: false,
styleClass: `${DialogSize.FULL} ${DialogStyle.MINIMAL}`,
data: { data: {
taskId, taskId,
}, },
styleClass: 'dialog-maximal',
}); });
} }
openIconPickerDialog(): DynamicDialogRef | null { openIconPickerDialog(): DynamicDialogRef | null {
return this.openDialog(IconPickerComponent, { return this.openDialog(IconPickerComponent, {
header: 'Choose an Icon', showHeader: false,
styleClass: 'dialog-medium', styleClass: `${DialogSize.LG} ${DialogStyle.MINIMAL}`,
}); });
} }
} }
@@ -4,14 +4,86 @@
display: none; display: none;
} }
// =============================================================================
// Dialog Base Styles
// =============================================================================
.p-dialog { .p-dialog {
@media (max-width: 768px) { @media (max-width: 768px) {
width: 95vw !important; width: 95vw !important;
max-width: 95vw !important; max-width: 95vw !important;
max-height: 95vh !important; max-height: 95dvh !important;
} }
} }
// =============================================================================
// Dialog Size Classes
// Use these to control dialog dimensions. Sizes are designed for common use cases.
// =============================================================================
// Extra Small - confirmations, simple alerts (~400px)
.dialog-xs.p-dialog {
width: 90vw;
max-width: 400px;
}
// Small - simple forms, pickers (~550px)
.dialog-sm.p-dialog {
width: 90vw;
max-width: 550px;
}
// Medium - standard dialogs (~700px)
.dialog-md.p-dialog {
width: 90vw;
max-width: 700px;
}
// Large - complex forms, lists (~900px)
.dialog-lg.p-dialog {
width: 90vw;
max-width: 900px;
}
// Extra Large - data-heavy views (~1200px)
.dialog-xl.p-dialog {
width: 95vw;
max-width: 1200px;
}
// Full - viewport filling dialogs
.dialog-full.p-dialog {
width: 95vw;
max-width: 95vw;
height: 95dvh;
max-height: 95dvh;
.p-dialog-content {
height: 100%;
display: flex;
flex-direction: column;
}
}
// =============================================================================
// Dialog Style Modifiers
// Composable with size classes (e.g., 'dialog-lg dialog-minimal')
// =============================================================================
// Minimal - removes padding for custom headers/content
.dialog-minimal.p-dialog {
border: none;
.p-dialog-content {
padding: 0;
}
}
// =============================================================================
// Legacy Aliases (for backward compatibility)
// =============================================================================
// @deprecated Use 'dialog-minimal' instead
.dynamic-dialog-minimal.p-dialog { .dynamic-dialog-minimal.p-dialog {
border: none; border: none;
@@ -20,23 +92,20 @@
} }
} }
// @deprecated Use 'dialog-xl' or 'dialog-full' instead
.dialog-maximal.p-dialog { .dialog-maximal.p-dialog {
width: 95vw; width: 95vw;
max-width: 1200px; max-width: 1200px;
height: 95vh; height: 95dvh;
max-height: 95vh; max-height: 95dvh;
}
.dialog-full.p-dialog {
width: 95vw;
height: 95vh;
} }
// @deprecated Use 'dialog-lg' instead
.dialog-medium.p-dialog { .dialog-medium.p-dialog {
width: 90vw; width: 90vw;
max-width: 900px; max-width: 900px;
height: 90vh; height: 90dvh;
max-height: 90vh; max-height: 90dvh;
} }
.gradient-divider { .gradient-divider {