feat(metadata): add configurable enabled fields for metadata editor and picker + UI tweaks (#2299)

Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
ACX
2026-01-16 19:13:17 -07:00
committed by GitHub
co-authored by acx10
parent 3a41e25aeb
commit 4dc5c0008c
49 changed files with 2631 additions and 1833 deletions
@@ -25,6 +25,7 @@ public enum AppSettingKey {
UPLOAD_FILE_PATTERN ("upload_file_pattern", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)), UPLOAD_FILE_PATTERN ("upload_file_pattern", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)),
MOVE_FILE_PATTERN ("move_file_pattern", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)), MOVE_FILE_PATTERN ("move_file_pattern", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)),
METADATA_DOWNLOAD_ON_BOOKDROP ("metadata_download_on_bookdrop", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)), METADATA_DOWNLOAD_ON_BOOKDROP ("metadata_download_on_bookdrop", false, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)),
METADATA_PROVIDER_SPECIFIC_FIELDS ("metadata_provider_specific_fields", true, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_METADATA_CONFIG)),
// ADMIN + MANAGE_GLOBAL_PREFERENCES // ADMIN + MANAGE_GLOBAL_PREFERENCES
COVER_CROPPING_SETTINGS ("cover_cropping_settings", true, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_GLOBAL_PREFERENCES)), COVER_CROPPING_SETTINGS ("cover_cropping_settings", true, false, List.of(PermissionType.ADMIN, PermissionType.MANAGE_GLOBAL_PREFERENCES)),
@@ -33,4 +33,5 @@ public class AppSettings {
private MetadataPublicReviewsSettings metadataPublicReviewsSettings; private MetadataPublicReviewsSettings metadataPublicReviewsSettings;
private KoboSettings koboSettings; private KoboSettings koboSettings;
private CoverCroppingSettings coverCroppingSettings; private CoverCroppingSettings coverCroppingSettings;
private MetadataProviderSpecificFields metadataProviderSpecificFields;
} }
@@ -0,0 +1,25 @@
package com.adityachandel.booklore.model.dto.settings;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class MetadataProviderSpecificFields {
private Boolean asin;
private Boolean amazonRating;
private Boolean amazonReviewCount;
private Boolean googleId;
private Boolean goodreadsId;
private Boolean goodreadsRating;
private Boolean goodreadsReviewCount;
private Boolean hardcoverId;
private Boolean hardcoverBookId;
private Boolean hardcoverRating;
private Boolean hardcoverReviewCount;
private Boolean comicvineId;
private Boolean lubimyczytacId;
private Boolean lubimyczytacRating;
private Boolean ranobedbId;
private Boolean ranobedbRating;
}
@@ -128,7 +128,15 @@ public class AppSettingService {
builder.metadataPublicReviewsSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.METADATA_PUBLIC_REVIEWS_SETTINGS, MetadataPublicReviewsSettings.class, settingPersistenceHelper.getDefaultMetadataPublicReviewsSettings(), true)); builder.metadataPublicReviewsSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.METADATA_PUBLIC_REVIEWS_SETTINGS, MetadataPublicReviewsSettings.class, settingPersistenceHelper.getDefaultMetadataPublicReviewsSettings(), true));
builder.koboSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.KOBO_SETTINGS, KoboSettings.class, settingPersistenceHelper.getDefaultKoboSettings(), true)); builder.koboSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.KOBO_SETTINGS, KoboSettings.class, settingPersistenceHelper.getDefaultKoboSettings(), true));
builder.coverCroppingSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.COVER_CROPPING_SETTINGS, CoverCroppingSettings.class, settingPersistenceHelper.getDefaultCoverCroppingSettings(), true)); builder.coverCroppingSettings(settingPersistenceHelper.getJsonSetting(settingsMap, AppSettingKey.COVER_CROPPING_SETTINGS, CoverCroppingSettings.class, settingPersistenceHelper.getDefaultCoverCroppingSettings(), true));
builder.metadataProviderSpecificFields(
settingPersistenceHelper.getJsonSetting(
settingsMap,
AppSettingKey.METADATA_PROVIDER_SPECIFIC_FIELDS,
MetadataProviderSpecificFields.class,
settingPersistenceHelper.getDefaultMetadataProviderSpecificFields(),
true
)
);
builder.autoBookSearch(Boolean.parseBoolean(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.AUTO_BOOK_SEARCH, "true"))); builder.autoBookSearch(Boolean.parseBoolean(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.AUTO_BOOK_SEARCH, "true")));
builder.uploadPattern(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.UPLOAD_FILE_PATTERN, "{authors}/<{series}/><{seriesIndex}. >{title}< - {authors}>< ({year})>")); builder.uploadPattern(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.UPLOAD_FILE_PATTERN, "{authors}/<{series}/><{seriesIndex}. >{title}< - {authors}>< ({year})>"));
builder.similarBookRecommendation(Boolean.parseBoolean(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.SIMILAR_BOOK_RECOMMENDATION, "true"))); builder.similarBookRecommendation(Boolean.parseBoolean(settingPersistenceHelper.getOrCreateSetting(AppSettingKey.SIMILAR_BOOK_RECOMMENDATION, "true")));
@@ -301,4 +301,25 @@ public class SettingPersistenceHelper {
.smartCroppingEnabled(false) .smartCroppingEnabled(false)
.build(); .build();
} }
public MetadataProviderSpecificFields getDefaultMetadataProviderSpecificFields() {
MetadataProviderSpecificFields fields = new MetadataProviderSpecificFields();
fields.setAsin(true);
fields.setAmazonRating(true);
fields.setAmazonReviewCount(true);
fields.setGoogleId(true);
fields.setGoodreadsId(true);
fields.setGoodreadsRating(true);
fields.setGoodreadsReviewCount(true);
fields.setHardcoverId(true);
fields.setHardcoverBookId(true);
fields.setHardcoverRating(true);
fields.setHardcoverReviewCount(true);
fields.setComicvineId(true);
fields.setLubimyczytacId(true);
fields.setLubimyczytacRating(true);
fields.setRanobedbId(true);
fields.setRanobedbRating(true);
return fields;
}
} }
@@ -1,155 +0,0 @@
<div class="p-4 w-[54rem]">
<p class="mb-4 text-gray-300">
This will restore the embedded metadata and cover (if available) from a saved backup for the selected book.
</p>
@if (book) {
<div class="mb-4">
<p class="font-semibold text-gray-300 pb-2">Book to Restore:</p>
<div class="border p-3 rounded space-y-1 custom-table">
<div><strong>ID:</strong> {{ book.id }}</div>
<div><strong>Current Title:</strong> {{ book.metadata?.title }}</div>
</div>
</div>
}
@if (backupMetadata) {
<div class="mb-4">
<p class="font-semibold text-gray-300 pb-2">Backup Metadata Preview:</p>
<div class="p-6 rounded custom-table text-sm text-gray-400 flex flex-col gap-6">
<div class="flex">
<div class="flex-1 space-y-1">
@if (backupMetadata.title) {
<div><strong>Title:</strong> {{ backupMetadata.title }}</div>
}
@if (backupMetadata.subtitle) {
<div><strong>Subtitle:</strong> {{ backupMetadata.subtitle }}</div>
}
@if (backupMetadata.authors!.length) {
<div><strong>Authors:</strong> {{ backupMetadata.authors!.join(', ') }}</div>
}
@if (backupMetadata.publisher) {
<div><strong>Publisher:</strong> {{ backupMetadata.publisher }}</div>
}
@if (backupMetadata.publishedDate) {
<div><strong>Published Date:</strong> {{ backupMetadata.publishedDate }}</div>
}
@if (backupMetadata.seriesName) {
<div><strong>Series Name:</strong> {{ backupMetadata.seriesName }}</div>
}
@if (backupMetadata.seriesNumber !== null) {
<div><strong>Series Number:</strong> {{ backupMetadata.seriesNumber }}</div>
}
@if (backupMetadata.seriesTotal !== null) {
<div><strong>Series Total:</strong> {{ backupMetadata.seriesTotal }}</div>
}
@if (backupMetadata.isbn13) {
<div><strong>ISBN-13:</strong> {{ backupMetadata.isbn13 }}</div>
}
@if (backupMetadata.isbn10) {
<div><strong>ISBN-10:</strong> {{ backupMetadata.isbn10 }}</div>
}
@if (backupMetadata.pageCount !== null) {
<div><strong>Page Count:</strong> {{ backupMetadata.pageCount }}</div>
}
@if (backupMetadata.language) {
<div><strong>Language:</strong> {{ backupMetadata.language }}</div>
}
@if (backupMetadata.asin) {
<div><strong>ASIN:</strong> {{ backupMetadata.asin }}</div>
}
@if (backupMetadata.amazonRating !== null) {
<div><strong>Amazon Rating:</strong> {{ backupMetadata.amazonRating }}</div>
}
@if (backupMetadata.amazonReviewCount !== null) {
<div><strong>Amazon Review Count:</strong> {{ backupMetadata.amazonReviewCount }}</div>
}
@if (backupMetadata.comicvineId) {
<div><strong>Comicvine ID:</strong> {{ backupMetadata.comicvineId }}</div>
}
@if (backupMetadata.goodreadsId) {
<div><strong>Goodreads ID:</strong> {{ backupMetadata.goodreadsId }}</div>
}
@if (backupMetadata.goodreadsRating !== null) {
<div><strong>Goodreads Rating:</strong> {{ backupMetadata.goodreadsRating }}</div>
}
@if (backupMetadata.goodreadsReviewCount !== null) {
<div><strong>Goodreads Review Count:</strong> {{ backupMetadata.goodreadsReviewCount }}</div>
}
@if (backupMetadata.hardcoverId) {
<div><strong>Hardcover ID:</strong> {{ backupMetadata.hardcoverId }}</div>
}
@if (backupMetadata.hardcoverBookId !== null) {
<div><strong>Hardcover Book ID:</strong> {{ backupMetadata.hardcoverBookId }}</div>
}
@if (backupMetadata.hardcoverRating !== null) {
<div><strong>Hardcover Rating:</strong> {{ backupMetadata.hardcoverRating }}</div>
}
@if (backupMetadata.hardcoverReviewCount !== null) {
<div><strong>Hardcover Review Count:</strong> {{ backupMetadata.hardcoverReviewCount }}</div>
}
@if (backupMetadata.ranobedbId) {
<div><strong>Ranobedb ID:</strong> {{ backupMetadata.ranobedbId }}</div>
}
@if (backupMetadata.ranobedbRating !== null) {
<div><strong>Ranobedb Rating:</strong> {{ backupMetadata.ranobedbRating }}</div>
}
@if (backupMetadata.googleId) {
<div><strong>Google Books ID:</strong> {{ backupMetadata.googleId }}</div>
}
@if (backupMetadata.categories && backupMetadata.categories.length) {
<div><strong>Categories:</strong> {{ backupMetadata.categories.join(', ') }}</div>
}
</div>
<div class="w-48 flex-shrink-0">
<div class="font-semibold text-gray-300 pb-2">Backup Cover Preview:</div>
<div class="bg-gray-900 border p-2 rounded flex justify-center">
<img
[src]="urlHelperService.getBackupCoverUrl(book?.id!)"
alt="Backup Cover"
class="max-h-80 object-contain rounded shadow"
onerror="this.src='assets/images/missing-cover.jpg'"/>
</div>
</div>
</div>
@if (backupMetadata.description) {
<div class="text-sm text-gray-400">
<div class="font-semibold text-gray-300 pb-1">Description:</div>
{{ backupMetadata.description }}
</div>
}
</div>
</div>
}
@if (!backupMetadata) {
<div class="mb-4">
<div class="p-4 border border-yellow-700 rounded bg-yellow-900 text-yellow-300 text-sm shadow-sm">
<p class="font-medium mb-1 text-yellow-200">No backup available</p>
<p>We couldn't find a saved backup for this book. Metadata and cover cannot be restored.</p>
</div>
</div>
}
<div class="flex justify-end gap-3 mt-6">
<p-button
severity="info"
outlined
label="Cancel"
(onClick)="dynamicDialogRef.close()"
icon="pi pi-times">
</p-button>
<p-button
outlined
severity="danger"
label="Restore"
(onClick)="onRestore()"
icon="pi pi-refresh"
[disabled]="!backupMetadata">
</p-button>
</div>
</div>
@@ -1,4 +0,0 @@
.custom-table {
border: 1px solid var(--border-color);
border-radius: var(--card-border);
}
@@ -1,67 +0,0 @@
import {Component, inject, OnInit} from '@angular/core';
import {DynamicDialogConfig, DynamicDialogRef} from 'primeng/dynamicdialog';
import {Button} from 'primeng/button';
import {BookService} from '../../../service/book.service';
import {Book, BookMetadata} from '../../../model/book.model';
import {MessageService} from 'primeng/api';
import {UrlHelperService} from '../../../../../shared/service/url-helper.service';
@Component({
selector: 'app-metadata-restore-dialog-component',
standalone: true,
imports: [Button],
templateUrl: './metadata-restore-dialog-component.html',
styleUrl: './metadata-restore-dialog-component.scss'
})
export class MetadataRestoreDialogComponent implements OnInit {
bookId!: number;
book!: Book | undefined;
backupMetadata: BookMetadata | null = null;
private dynamicDialogConfig = inject(DynamicDialogConfig);
protected dynamicDialogRef = inject(DynamicDialogRef);
protected bookService = inject(BookService);
private messageService = inject(MessageService);
protected urlHelperService = inject(UrlHelperService);
ngOnInit(): void {
this.bookId = this.dynamicDialogConfig.data.bookId;
this.book = this.bookService.getBookByIdFromState(this.bookId);
this.bookService.getBackupMetadata(this.bookId).subscribe({
next: (data) => {
this.backupMetadata = data;
},
error: err => {
this.messageService.add({
severity: 'warn',
summary: 'No Backup Found',
detail: err?.error?.message || 'Backup metadata could not be retrieved.'
});
this.backupMetadata = null;
}
});
}
onRestore(): void {
this.bookService.restoreMetadata(this.bookId).subscribe({
next: () => {
this.messageService.add({
severity: 'success',
summary: 'Restore Successful',
detail: `Metadata restored for book ID ${this.bookId}`
});
this.dynamicDialogRef.close({ action: 'restore', bookId: this.bookId });
},
error: err => {
const errorMessage = err?.error?.message || err?.message || 'Unknown error';
this.messageService.add({
severity: 'error',
summary: 'Restore Failed',
detail: `Failed to restore metadata: ${errorMessage}`
});
}
});
}
}
@@ -372,6 +372,7 @@
} }
</div> </div>
</div> </div>
@if (isFieldVisible('asin')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="asin">Amazon ASIN</label> <label for="asin">Amazon ASIN</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -384,6 +385,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('amazonRating')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="amazonRating">Amazon ★</label> <label for="amazonRating">Amazon ★</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -396,6 +399,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('amazonReviewCount')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="amazonRatingCount">Amazon #</label> <label for="amazonRatingCount">Amazon #</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -408,6 +413,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('googleId')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="googleId">Google Books ID</label> <label for="googleId">Google Books ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -420,9 +427,8 @@
} }
</div> </div>
</div> </div>
</div> }
@if (isFieldVisible('goodreadsId')) {
<div class="field-row metadata-ids-row">
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="goodreadsId">Goodreads ID</label> <label for="goodreadsId">Goodreads ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -435,6 +441,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('goodreadsRating')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="goodreadsRating">Goodreads ★</label> <label for="goodreadsRating">Goodreads ★</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -447,6 +455,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('goodreadsReviewCount')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="goodreadsReviewCount">Goodreads #</label> <label for="goodreadsReviewCount">Goodreads #</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -459,6 +469,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('hardcoverId')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="hardcoverId">Hardcover ID</label> <label for="hardcoverId">Hardcover ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -471,6 +483,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('hardcoverBookId')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="hardcoverBookId">Hardcover Book ID</label> <label for="hardcoverBookId">Hardcover Book ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -483,6 +497,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('hardcoverRating')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="hardcoverRating">Hardcover ★</label> <label for="hardcoverRating">Hardcover ★</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -495,6 +511,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('hardcoverReviewCount')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="hardcoverReviewCount">Hardcover #</label> <label for="hardcoverReviewCount">Hardcover #</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -507,11 +525,10 @@
} }
</div> </div>
</div> </div>
</div> }
@if (isFieldVisible('lubimyczytacId')) {
<div class="flex flex-col md:flex-row w-full gap-4 mt-2 pb-1">
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="lubimyczytacId">LC ID</label> <label for="lubimyczytacId">Lubimyczytac ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
<input pSize="small" pInputText id="lubimyczytacId" formControlName="lubimyczytacId"/> <input pSize="small" pInputText id="lubimyczytacId" formControlName="lubimyczytacId"/>
@if (!book.metadata!['lubimyczytacIdLocked']) { @if (!book.metadata!['lubimyczytacIdLocked']) {
@@ -522,8 +539,10 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('lubimyczytacRating')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="lubimyczytacRating">LC ★</label> <label for="lubimyczytacRating">Lubimyczytac ★</label>
<div class="field-with-lock"> <div class="field-with-lock">
<input pSize="small" pInputText id="lubimyczytacRating" formControlName="lubimyczytacRating"/> <input pSize="small" pInputText id="lubimyczytacRating" formControlName="lubimyczytacRating"/>
@if (!book.metadata!['lubimyczytacRatingLocked']) { @if (!book.metadata!['lubimyczytacRatingLocked']) {
@@ -534,6 +553,8 @@
} }
</div> </div>
</div> </div>
}
@if (isFieldVisible('comicvineId')) {
<div class="field-group metadata-id-field"> <div class="field-group metadata-id-field">
<label for="comicvineId">Comicvine ID</label> <label for="comicvineId">Comicvine ID</label>
<div class="field-with-lock"> <div class="field-with-lock">
@@ -546,10 +567,12 @@
} }
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 md:w-1/6"> }
<label class="text-sm" for="ranobedbId">Ranobedb ID</label> @if (isFieldVisible('ranobedbId')) {
<div class="flex withbutton"> <div class="field-group metadata-id-field">
<input pSize="small" pInputText id="ranobedbId" formControlName="ranobedbId" class="w-full"/> <label for="ranobedbId">Ranobedb ID</label>
<div class="field-with-lock">
<input pSize="small" pInputText id="ranobedbId" formControlName="ranobedbId"/>
@if (!book.metadata!['ranobedbIdLocked']) { @if (!book.metadata!['ranobedbIdLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbId')" severity="success"></p-button> <p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbId')" severity="success"></p-button>
} }
@@ -558,10 +581,12 @@
} }
</div> </div>
</div> </div>
<div class="flex flex-col gap-1 md:w-1/6"> }
<label class="text-sm" for="ranobedbRating">Ranobedb ★</label> @if (isFieldVisible('ranobedbRating')) {
<div class="flex withbutton"> <div class="field-group metadata-id-field">
<input pSize="small" pInputText id="ranobedbRating" formControlName="ranobedbRating" class="w-full"/> <label for="ranobedbRating">Ranobedb ★</label>
<div class="field-with-lock">
<input pSize="small" pInputText id="ranobedbRating" formControlName="ranobedbRating"/>
@if (!book.metadata!['ranobedbRatingLocked']) { @if (!book.metadata!['ranobedbRatingLocked']) {
<p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbRating')" severity="success"></p-button> <p-button size="small" icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('ranobedbRating')" severity="success"></p-button>
} }
@@ -570,6 +595,7 @@
} }
</div> </div>
</div> </div>
}
</div> </div>
<div class="description-section"> <div class="description-section">
@@ -238,16 +238,19 @@ label {
} }
.metadata-ids-row { .metadata-ids-row {
@media (min-width: 768px) { display: grid;
.field-group { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
width: calc(100% / 6); gap: 1rem;
} width: 100%;
.metadata-id-field {
min-width: 0;
} }
} }
.metadata-id-field { .metadata-id-field {
@media (min-width: 768px) { @media (min-width: 768px) {
width: calc(100% / 6); min-width: 0;
} }
} }
@@ -27,6 +27,8 @@ import {BookNavigationService} from '../../../../book/service/book-navigation.se
import {BookMetadataHostService} from '../../../../../shared/service/book-metadata-host.service'; import {BookMetadataHostService} from '../../../../../shared/service/book-metadata-host.service';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
import {UserService} from '../../../../settings/user-management/user.service'; import {UserService} from '../../../../settings/user-management/user.service';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {MetadataProviderSpecificFields} from '../../../../../shared/model/app-settings.model';
@Component({ @Component({
selector: "app-metadata-editor", selector: "app-metadata-editor",
@@ -70,6 +72,7 @@ export class MetadataEditorComponent implements OnInit {
private router = inject(Router); private router = inject(Router);
private userService = inject(UserService); private userService = inject(UserService);
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
private appSettingsService = inject(AppSettingsService);
metadataForm: FormGroup; metadataForm: FormGroup;
currentBookId!: number; currentBookId!: number;
@@ -98,6 +101,25 @@ export class MetadataEditorComponent implements OnInit {
filteredSeries: string[] = []; filteredSeries: string[] = [];
private metadataCenterViewMode: 'route' | 'dialog' = 'route'; private metadataCenterViewMode: 'route' | 'dialog' = 'route';
providerSpecificFields: MetadataProviderSpecificFields = {
asin: true,
amazonRating: true,
amazonReviewCount: true,
googleId: true,
goodreadsId: true,
goodreadsRating: true,
goodreadsReviewCount: true,
hardcoverId: true,
hardcoverBookId: true,
hardcoverRating: true,
hardcoverReviewCount: true,
comicvineId: true,
lubimyczytacId: true,
lubimyczytacRating: true,
ranobedbId: true,
ranobedbRating: true,
};
navigationState$ = this.bookNavigationService.getNavigationState(); navigationState$ = this.bookNavigationService.getNavigationState();
filterCategories(event: { query: string }) { filterCategories(event: { query: string }) {
@@ -239,6 +261,17 @@ export class MetadataEditorComponent implements OnInit {
this.metadataCenterViewMode = userState.user?.userSettings.metadataCenterViewMode ?? 'route'; this.metadataCenterViewMode = userState.user?.userSettings.metadataCenterViewMode ?? 'route';
this.autoSaveEnabled = userState.user?.userSettings.autoSaveMetadata ?? false; this.autoSaveEnabled = userState.user?.userSettings.autoSaveMetadata ?? false;
}); });
this.appSettingsService.appSettings$
.pipe(
filter(settings => !!settings),
takeUntilDestroyed(this.destroyRef)
)
.subscribe(settings => {
if (settings?.metadataProviderSpecificFields) {
this.providerSpecificFields = settings.metadataProviderSpecificFields;
}
});
} }
private prepareAutoComplete(): void { private prepareAutoComplete(): void {
@@ -493,9 +526,7 @@ export class MetadataEditorComponent implements OnInit {
this.updateMetadata(false); this.updateMetadata(false);
} }
private buildMetadataWrapper( private buildMetadataWrapper(shouldLockAllFields?: boolean): MetadataUpdateWrapper {
shouldLockAllFields?: boolean
): MetadataUpdateWrapper {
const form = this.metadataForm; const form = this.metadataForm;
const metadata: BookMetadata = { const metadata: BookMetadata = {
@@ -839,5 +870,9 @@ export class MetadataEditorComponent implements OnInit {
return position ? `${position.current} of ${position.total}` : ''; return position ? `${position.current} of ${position.total}` : '';
} }
isFieldVisible(field: keyof MetadataProviderSpecificFields): boolean {
return this.providerSpecificFields[field] ?? false;
}
protected readonly sample = sample; protected readonly sample = sample;
} }
@@ -1,23 +1,23 @@
@if (book$ | async; as book) { @if (book$ | async; as book) {
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full w-full"> <form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="form-container">
<div class="flex-grow overflow-auto p-0 md:p-4"> <div class="form-content">
<div class="flex justify-center items-center" [ngStyle]="{'padding-bottom': '0.75rem', 'padding-left': '7.6rem'}"> <div class="metadata-header">
<p class="ml-3 text-lg">Current Metadata</p> <p class="metadata-header-text">Current Metadata</p>
<p-button <p-button
severity="success" severity="info"
icon='pi pi-angle-left' icon='pi pi-angle-left'
[ngStyle]="{'padding-left': '3rem', 'padding-right': '0.5rem'}" class="button-left"
[outlined]="true" [outlined]="true"
pTooltip="Move all missing fields" tooltipPosition="bottom" pTooltip="Move all missing fields" tooltipPosition="bottom"
(onClick)="copyMissing()"></p-button> (onClick)="copyMissing()"></p-button>
<p-button <p-button
severity="success" severity="info"
icon='pi pi-angle-double-left' icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}" class="button-double-left"
[outlined]="true" [outlined]="true"
pTooltip="Move all fields" tooltipPosition="bottom" pTooltip="Move all fields" tooltipPosition="bottom"
(onClick)="copyAll()"></p-button> (onClick)="copyAll()"></p-button>
<p class="text-lg">Fetched Metadata</p> <p class="metadata-header-text">Fetched Metadata</p>
</div> </div>
<div class="form-row"> <div class="form-row">
<label class="label"></label> <label class="label"></label>
@@ -103,9 +103,9 @@
@if (metadataForm.get(field.lockedKey)?.value) { @if (metadataForm.get(field.lockedKey)?.value) {
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="warn"></p-button> <p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="warn"></p-button>
} }
<div class="w-full px-4"> <div class="autocomplete-container">
<p-autoComplete <p-autoComplete
class="w-full" class="autocomplete-full-width"
formControlName="{{field.controlName}}" formControlName="{{field.controlName}}"
[multiple]="true" [multiple]="true"
[dropdown]="false" [dropdown]="false"
@@ -131,12 +131,12 @@
(mouseenter)="onMouseEnter(field.controlName)" (mouseenter)="onMouseEnter(field.controlName)"
(mouseleave)="onMouseLeave(field.controlName)"/> (mouseleave)="onMouseLeave(field.controlName)"/>
<div class="w-full px-4"> <div class="autocomplete-container">
<p-autoComplete <p-autoComplete
[ngModel]="fetchedMetadata[field.fetchedKey] ?? []" [ngModel]="fetchedMetadata[field.fetchedKey] ?? []"
[ngModelOptions]="{ standalone: true }" [ngModelOptions]="{ standalone: true }"
[disabled]="true" [disabled]="true"
[multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" class="w-full"> [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" class="autocomplete-full-width">
</p-autoComplete> </p-autoComplete>
</div> </div>
</div> </div>
@@ -198,33 +198,33 @@
</div> </div>
</div> </div>
} }
<div class="flex justify-center items-center" [ngStyle]="{'padding-bottom': '0.75rem', 'padding-left': '7.6rem'}"> <div class="metadata-header">
<p class="ml-3 text-lg">Current Metadata</p> <p class="metadata-header-text">Current Metadata</p>
<p-button <p-button
severity="success" severity="info"
icon='pi pi-angle-left' icon='pi pi-angle-left'
[ngStyle]="{'padding-left': '3rem', 'padding-right': '0.5rem'}" class="button-left"
[outlined]="true" [outlined]="true"
pTooltip="Move all missing fields" tooltipPosition="bottom" pTooltip="Move all missing fields" tooltipPosition="bottom"
(onClick)="copyMissing()"></p-button> (onClick)="copyMissing()"></p-button>
<p-button <p-button
severity="success" severity="info"
icon='pi pi-angle-double-left' icon='pi pi-angle-double-left'
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}" class="button-double-left"
[outlined]="true" [outlined]="true"
pTooltip="Move all fields" tooltipPosition="bottom" pTooltip="Move all fields" tooltipPosition="bottom"
(onClick)="copyAll()"></p-button> (onClick)="copyAll()"></p-button>
<p class="text-lg">Fetched Metadata</p> <p class="metadata-header-text">Fetched Metadata</p>
</div> </div>
</div> </div>
@if (!reviewMode) { @if (!reviewMode) {
<div class="mt-auto"> <div class="form-footer">
<p-divider></p-divider> <p-divider></p-divider>
<div class="flex justify-between px-2 pt-4"> <div class="footer-buttons">
<p-button label="To Metadata List" icon="pi pi-arrow-left" severity="info" (onClick)="goBackClick()"></p-button> <p-button label="To Metadata List" icon="pi pi-arrow-left" severity="info" (onClick)="goBackClick()"></p-button>
<div class="flex gap-x-4 justify-end"> <div class="footer-buttons-right">
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()"></p-button> <p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()"></p-button>
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()"></p-button> <p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()"></p-button>
<p-divider layout="vertical"/> <p-divider layout="vertical"/>
@@ -1,3 +1,45 @@
.form-container {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
animation: fadeIn 0.3s ease-in;
}
.form-content {
flex-grow: 1;
overflow: auto;
padding: 0;
@media (min-width: 768px) {
padding: 1rem;
}
}
.metadata-header {
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 0.75rem;
padding-left: 9.25rem;
margin-top: 1rem;
}
.metadata-header-text {
margin-left: 0.75rem;
font-size: 1.125rem;
}
.button-left {
padding-left: 3rem;
padding-right: 0.5rem;
}
.button-double-left {
padding-left: 0.5rem;
padding-right: 2rem;
}
.form-row { .form-row {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -7,7 +49,7 @@
} }
.label { .label {
width: 7rem; width: 8rem;
text-align: left; text-align: left;
} }
@@ -25,6 +67,16 @@
margin: 0 1rem; margin: 0 1rem;
} }
.autocomplete-container {
width: 100%;
padding-left: 1rem;
padding-right: 1rem;
}
.autocomplete-full-width {
width: 100%;
}
.thumbnail { .thumbnail {
width: 15.625rem; width: 15.625rem;
height: 21.875rem; height: 21.875rem;
@@ -54,10 +106,31 @@
--p-button-outlined-primary-color: #E32636; --p-button-outlined-primary-color: #E32636;
} }
.form-footer {
margin-top: auto;
}
.footer-buttons {
display: flex;
justify-content: space-between;
padding: 1rem 0.5rem 0;
}
.footer-buttons-right {
display: flex;
gap: 1rem;
justify-content: flex-end;
}
::ng-deep .p-inputchips { ::ng-deep .p-inputchips {
width: 100% !important; width: 100% !important;
} }
.flex.flex-col.h-full.w-full { @keyframes fadeIn {
animation: fadeIn 0.3s ease-in; from {
opacity: 0;
}
to {
opacity: 1;
}
} }
@@ -4,7 +4,7 @@ import {MessageService} from 'primeng/api';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormControl, FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {InputText} from 'primeng/inputtext'; import {InputText} from 'primeng/inputtext';
import {AsyncPipe, NgClass, NgStyle} from '@angular/common'; import {AsyncPipe, NgClass} from '@angular/common';
import {Divider} from 'primeng/divider'; import {Divider} from 'primeng/divider';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {Tooltip} from 'primeng/tooltip'; import {Tooltip} from 'primeng/tooltip';
@@ -13,10 +13,11 @@ import {BookService} from '../../../../book/service/book.service';
import {Textarea} from 'primeng/textarea'; import {Textarea} from 'primeng/textarea';
import {filter, map, take} from 'rxjs/operators'; import {filter, map, take} from 'rxjs/operators';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop'; import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {AutoComplete} from 'primeng/autocomplete'; import {AutoComplete, AutoCompleteSelectEvent} from 'primeng/autocomplete';
import {AutoCompleteSelectEvent} from 'primeng/autocomplete';
import {Image} from 'primeng/image'; import {Image} from 'primeng/image';
import {LazyLoadImageModule} from 'ng-lazyload-image'; import {LazyLoadImageModule} from 'ng-lazyload-image';
import {AppSettingsService} from '../../../../../shared/service/app-settings.service';
import {MetadataProviderSpecificFields} from '../../../../../shared/model/app-settings.model';
@Component({ @Component({
selector: 'app-metadata-picker', selector: 'app-metadata-picker',
@@ -30,7 +31,6 @@ import {LazyLoadImageModule} from 'ng-lazyload-image';
Divider, Divider,
ReactiveFormsModule, ReactiveFormsModule,
NgClass, NgClass,
NgStyle,
Tooltip, Tooltip,
AsyncPipe, AsyncPipe,
Textarea, Textarea,
@@ -66,23 +66,23 @@ export class MetadataPickerComponent implements OnInit {
{label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'}, {label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'},
{label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'}, {label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'},
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'}, {label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
{label: 'ASIN', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'}, {label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'},
{label: 'Amz Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
{label: 'Amz Rating', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating'},
{label: 'Comicvine ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId'},
{label: 'Goodreads ID', controlName: 'goodreadsId', lockedKey: 'goodreadsIdLocked', fetchedKey: 'goodreadsId'},
{label: 'GR Reviews', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'GR Rating', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'Hardcover ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId'},
{label: 'Hardcover Book ID', controlName: 'hardcoverBookId', lockedKey: 'hardcoverBookIdLocked', fetchedKey: 'hardcoverBookId'},
{label: 'HC Reviews', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
{label: 'HC Rating', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'LC ID', controlName: 'lubimyczytacId', lockedKey: 'lubimyczytacIdLocked', fetchedKey: 'lubimyczytacId'},
{label: 'LC Rating', controlName: 'lubimyczytacRating', lockedKey: 'lubimyczytacRatingLocked', fetchedKey: 'lubimyczytacRating'},
{label: 'Ranobedb ID', controlName: 'ranobedbId', lockedKey: 'ranobedbIdLocked', fetchedKey: 'ranobedbId'},
{label: 'RD Rating', controlName: 'ranobedbRating', lockedKey: 'ranobedbRatingLocked', fetchedKey: 'ranobedbRating'},
{label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'}, {label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'},
{label: 'Pages', controlName: 'pageCount', lockedKey: 'pageCountLocked', fetchedKey: 'pageCount'} {label: 'ASIN', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
{label: 'Amazon #', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
{label: 'Amazon ★', controlName: 'amazonRating', lockedKey: 'amazonRatingLocked', fetchedKey: 'amazonRating'},
{label: 'Goodreads ID', controlName: 'goodreadsId', lockedKey: 'goodreadsIdLocked', fetchedKey: 'goodreadsId'},
{label: 'Goodreads ★', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'Goodreads #', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'HC Book ID', controlName: 'hardcoverBookId', lockedKey: 'hardcoverBookIdLocked', fetchedKey: 'hardcoverBookId'},
{label: 'Hardcover ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId'},
{label: 'Hardcover #', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
{label: 'Hardcover ★', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'Comicvine ID', controlName: 'comicvineId', lockedKey: 'comicvineIdLocked', fetchedKey: 'comicvineId'},
{label: 'LB ID', controlName: 'lubimyczytacId', lockedKey: 'lubimyczytacIdLocked', fetchedKey: 'lubimyczytacId'},
{label: 'LB ★', controlName: 'lubimyczytacRating', lockedKey: 'lubimyczytacRatingLocked', fetchedKey: 'lubimyczytacRating'},
{label: 'Ranobedb ID', controlName: 'ranobedbId', lockedKey: 'ranobedbIdLocked', fetchedKey: 'ranobedbId'},
{label: 'Ranobedb ★', controlName: 'ranobedbRating', lockedKey: 'ranobedbRatingLocked', fetchedKey: 'ranobedbRating'}
]; ];
@Input() reviewMode!: boolean; @Input() reviewMode!: boolean;
@@ -131,6 +131,9 @@ export class MetadataPickerComponent implements OnInit {
private bookService = inject(BookService); private bookService = inject(BookService);
protected urlHelper = inject(UrlHelperService); protected urlHelper = inject(UrlHelperService);
private destroyRef = inject(DestroyRef); private destroyRef = inject(DestroyRef);
private appSettingsService = inject(AppSettingsService);
private enabledProviderFields: MetadataProviderSpecificFields | null = null;
constructor() { constructor() {
this.metadataForm = new FormGroup({ this.metadataForm = new FormGroup({
@@ -205,6 +208,17 @@ export class MetadataPickerComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.appSettingsService.appSettings$
.pipe(
filter(settings => !!settings?.metadataProviderSpecificFields),
take(1)
)
.subscribe(settings => {
if (settings?.metadataProviderSpecificFields) {
this.enabledProviderFields = settings.metadataProviderSpecificFields;
this.filterMetadataFields();
}
});
this.bookService.bookState$ this.bookService.bookState$
.pipe( .pipe(
@@ -318,7 +332,6 @@ export class MetadataPickerComponent implements OnInit {
coverLocked: metadata.coverLocked || false, coverLocked: metadata.coverLocked || false,
}); });
// Always enable all fields before applying locked state
Object.keys(this.metadataForm.controls).forEach((key) => { Object.keys(this.metadataForm.controls).forEach((key) => {
if (!key.endsWith('Locked')) { if (!key.endsWith('Locked')) {
this.metadataForm.get(key)?.enable({emitEvent: false}); this.metadataForm.get(key)?.enable({emitEvent: false});
@@ -362,6 +375,34 @@ export class MetadataPickerComponent implements OnInit {
}); });
} }
private filterMetadataFields(): void {
if (!this.enabledProviderFields) return;
const providerFieldMap: Record<string, keyof MetadataProviderSpecificFields> = {
'asin': 'asin',
'amazonRating': 'amazonRating',
'amazonReviewCount': 'amazonReviewCount',
'googleId': 'googleId',
'goodreadsId': 'goodreadsId',
'goodreadsRating': 'goodreadsRating',
'goodreadsReviewCount': 'goodreadsReviewCount',
'hardcoverId': 'hardcoverId',
'hardcoverBookId': 'hardcoverId',
'hardcoverRating': 'hardcoverRating',
'hardcoverReviewCount': 'hardcoverReviewCount',
'comicvineId': 'comicvineId',
'lubimyczytacId': 'lubimyczytacId',
'lubimyczytacRating': 'lubimyczytacRating',
'ranobedbId': 'ranobedbId',
'ranobedbRating': 'ranobedbRating'
};
this.metadataFieldsBottom = this.metadataFieldsBottom.filter(field => {
const providerKey = providerFieldMap[field.controlName];
return !providerKey || this.enabledProviderFields![providerKey];
});
}
onAutoCompleteSelect(fieldName: string, event: AutoCompleteSelectEvent) { onAutoCompleteSelect(fieldName: string, event: AutoCompleteSelectEvent) {
const values = (this.metadataForm.get(fieldName)?.value as string[]) || []; const values = (this.metadataForm.get(fieldName)?.value as string[]) || [];
if (!values.includes(event.value as string)) { if (!values.includes(event.value as string)) {
@@ -387,7 +428,7 @@ export class MetadataPickerComponent implements OnInit {
onSave(): void { onSave(): void {
this.isSaving = true; this.isSaving = true;
const updatedBookMetadata = this.buildMetadataWrapper(undefined); const updatedBookMetadata = this.buildMetadataWrapper(undefined);
this.bookService.updateBookMetadata(this.currentBookId, updatedBookMetadata, true).subscribe({ this.bookService.updateBookMetadata(this.currentBookId, updatedBookMetadata, false).subscribe({
next: (bookMetadata) => { next: (bookMetadata) => {
this.isSaving = false; this.isSaving = false;
Object.keys(this.copiedFields).forEach((field) => { Object.keys(this.copiedFields).forEach((field) => {
@@ -21,7 +21,7 @@
[options]="providers" [options]="providers"
formControlName="provider" formControlName="provider"
placeholder="Select providers" placeholder="Select providers"
[styleClass]="'custom-multiselect'"> class="'custom-multiselect'">
</p-multiselect> </p-multiselect>
</div> </div>
@@ -73,7 +73,7 @@
type="submit" type="submit"
[disabled]="!isSearchEnabled || loading" [disabled]="!isSearchEnabled || loading"
icon="pi pi-search" icon="pi pi-search"
[styleClass]="'custom-search-button'"> class="'custom-search-button'">
</p-button> </p-button>
</div> </div>
</div> </div>
@@ -74,6 +74,23 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.subscription.add(
this.appSettings$
.pipe(filter(settings => !!settings))
.subscribe(settings => {
const providerSettings = settings!.metadataProviderSettings ?? {};
this.providers = Object.entries(providerSettings)
.filter(([_, value]) => !!value && typeof value === 'object' && 'enabled' in value && (value as any).enabled)
.map(([key]) => key.charAt(0).toUpperCase() + key.slice(1));
const currentProviders = this.form.get('provider')?.value || [];
const validProviders = currentProviders.filter((p: string) => this.providers.includes(p));
if (validProviders.length !== currentProviders.length) {
this.form.patchValue({provider: validProviders.length > 0 ? validProviders : null});
}
})
);
this.subscription.add( this.subscription.add(
this.route.paramMap this.route.paramMap
.pipe( .pipe(
@@ -94,11 +111,6 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
distinctUntilChanged(([prevBook], [currBook]) => prevBook?.id === currBook?.id) distinctUntilChanged(([prevBook], [currBook]) => prevBook?.id === currBook?.id)
) )
.subscribe(([book, settings]) => { .subscribe(([book, settings]) => {
const providerSettings = settings?.metadataProviderSettings ?? {};
this.providers = Object.entries(providerSettings)
.filter(([_, value]) => !!value && typeof value === 'object' && 'enabled' in value && (value as any).enabled)
.map(([key]) => key.charAt(0).toUpperCase() + key.slice(1));
this.resetFormFromBook(book!); this.resetFormFromBook(book!);
if (settings!.autoBookSearch) { if (settings!.autoBookSearch) {
@@ -127,6 +139,7 @@ export class MetadataSearcherComponent implements OnInit, OnDestroy {
ngOnDestroy(): void { ngOnDestroy(): void {
this.cancelRequest$.next(); this.cancelRequest$.next();
this.cancelRequest$.complete();
this.subscription.unsubscribe(); this.subscription.unsubscribe();
this.selectedFetchedMetadata$.complete(); this.selectedFetchedMetadata$.complete();
} }
@@ -25,17 +25,23 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate', 'title', 'subtitle', 'description', 'authors', 'publisher', 'publishedDate',
'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10', 'seriesName', 'seriesNumber', 'seriesTotal', 'isbn13', 'isbn10',
'language', 'categories', 'cover', 'pageCount', 'language', 'categories', 'cover', 'pageCount',
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId', 'asin', 'amazonRating', 'amazonReviewCount',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'googleId',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating', 'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'moods', 'tags' 'hardcoverId', 'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating'
]; ];
providerSpecificFields: (keyof FieldOptions)[] = [ providerSpecificFields: (keyof FieldOptions)[] = [
'asin', 'goodreadsId', 'comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId', 'asin', 'amazonRating', 'amazonReviewCount',
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'googleId',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating', 'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'moods', 'tags' 'hardcoverId', 'hardcoverRating', 'hardcoverReviewCount', 'moods', 'tags',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating',
]; ];
nonProviderSpecificFields: (keyof FieldOptions)[] = [ nonProviderSpecificFields: (keyof FieldOptions)[] = [
@@ -64,9 +70,28 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
private justSubmitted = false; private justSubmitted = false;
private providerSpecificFieldsList = [ private providerSpecificFieldsList = [
'asin', 'goodreadsId','comicvineId', 'hardcoverId', 'googleId', 'lubimyczytacId', 'ranobedbId', // Amazon
'amazonRating', 'amazonReviewCount', 'goodreadsRating', 'goodreadsReviewCount', 'asin', 'amazonRating', 'amazonReviewCount',
'hardcoverRating', 'hardcoverReviewCount', 'lubimyczytacRating', 'ranobedbRating',
// Google
'googleId',
// Goodreads
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
// Hardcover
'hardcoverId', 'hardcoverRating', 'hardcoverReviewCount',
// Comicvine
'comicvineId',
// Lubimyczytac
'lubimyczytacId', 'lubimyczytacRating',
// Ranobedb
'ranobedbId', 'ranobedbRating',
// Generic provider-specific
'moods', 'tags' 'moods', 'tags'
]; ];
@@ -231,7 +256,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
'goodreadsReviewCount': 'Goodreads Review Count', 'goodreadsReviewCount': 'Goodreads Review Count',
'hardcoverRating': 'Hardcover Rating', 'hardcoverRating': 'Hardcover Rating',
'hardcoverReviewCount': 'Hardcover Review Count', 'hardcoverReviewCount': 'Hardcover Review Count',
'lubimyczytacId': 'LC ID', 'lubimyczytacId': 'Lubimyczytac ID',
'lubimyczytacRating': 'Lubimyczytac Rating', 'lubimyczytacRating': 'Lubimyczytac Rating',
'ranobedbId': 'Ranobedb ID', 'ranobedbId': 'Ranobedb ID',
'ranobedbRating': 'Ranobedb Rating', 'ranobedbRating': 'Ranobedb Rating',
@@ -0,0 +1,38 @@
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-list"></i>
Enabled Fields in Metadata Editor & Picker
</h3>
<p class="section-description">
Select which metadata fields to display when editing book information or picking metadata from providers. Disabled fields will be hidden from the interface.
</p>
</div>
<div class="section-body">
<div class="preferences-section">
<div class="provider-groups-container">
@for (group of providerGroups; track group.label) {
<div class="provider-group">
<div class="group-header">
<span class="group-icon pi pi-database"></span>
<h4 class="group-label">{{ group.label }}</h4>
</div>
<div class="field-list">
@for (field of group.fields; track field) {
<div class="field-checkbox">
<p-toggleswitch
[inputId]="field"
[ngModel]="selectedFields.includes(field)"
(ngModelChange)="toggleField(field, $event)">
</p-toggleswitch>
<label [for]="field">{{ fieldLabels[field] || field }}</label>
</div>
}
</div>
</div>
}
</div>
</div>
</div>
</div>
@@ -0,0 +1,146 @@
.preferences-section {
@media (min-width: 768px) {
padding: 0 0.5rem;
}
}
.section-header {
margin-bottom: 2rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.provider-groups-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 1rem;
@media (max-width: 1200px) {
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}
@media (max-width: 768px) {
grid-template-columns: 1fr;
gap: 0.875rem;
}
}
.provider-group {
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 0.875rem;
transition: all 0.2s ease;
display: flex;
flex-direction: column;
&:hover {
border-color: color-mix(in srgb, var(--primary-color) 40%, var(--p-content-border-color) 60%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.group-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.75rem;
padding-bottom: 0.625rem;
border-bottom: 1px solid var(--p-content-border-color);
.group-icon {
color: var(--primary-color);
font-size: 0.9375rem;
flex-shrink: 0;
}
.group-label {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-color);
margin: 0;
letter-spacing: -0.01em;
}
}
.field-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.field-checkbox {
display: flex;
align-items: center;
gap: 0.625rem;
padding: 0.2rem 0.5rem;
border-radius: 5px;
transition: background-color 0.15s ease;
&:hover {
background: color-mix(in srgb, var(--p-surface-800) 70%, transparent 30%);
}
label {
cursor: pointer;
font-size: 0.875rem;
font-weight: 400;
user-select: none;
color: var(--text-color);
margin-bottom: 0;
flex: 1;
}
@media (max-width: 768px) {
padding: 0.375rem 0.4rem;
}
}
.section-body {
> .setting-item {
margin-bottom: 0.75rem;
}
}
.settings-card {
display: flex;
flex-direction: column;
gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
@@ -0,0 +1,121 @@
import {Component, inject, Input, OnInit} from '@angular/core';
import {ToggleSwitchModule} from 'primeng/toggleswitch';
import {FormsModule} from '@angular/forms';
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {AppSettingKey, MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model';
import {filter, take} from 'rxjs/operators';
@Component({
selector: 'app-metadata-provider-field-selector',
standalone: true,
imports: [ToggleSwitchModule, FormsModule],
templateUrl: './metadata-provider-field-selector.component.html',
styleUrl: './metadata-provider-field-selector.component.scss'
})
export class MetadataProviderFieldSelectorComponent implements OnInit {
@Input() selectedFields: string[] = [];
private appSettingsService = inject(AppSettingsService);
providerGroups: { label: string, fields: string[] }[] = [
{
label: 'Amazon',
fields: ['asin', 'amazonRating', 'amazonReviewCount']
},
{
label: 'Google Books',
fields: ['googleId']
},
{
label: 'Goodreads',
fields: ['goodreadsId', 'goodreadsRating', 'goodreadsReviewCount']
},
{
label: 'Hardcover',
fields: ['hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount']
},
{
label: 'Comicvine',
fields: ['comicvineId']
},
{
label: 'Lubimyczytac',
fields: ['lubimyczytacId', 'lubimyczytacRating']
},
{
label: 'Ranobedb',
fields: ['ranobedbId', 'ranobedbRating']
}
];
fieldLabels: Record<string, string> = {
'asin': 'Amazon ASIN',
'amazonRating': 'Amazon Rating',
'amazonReviewCount': 'Amazon Review Count',
'googleId': 'Google Books ID',
'goodreadsId': 'Goodreads ID',
'goodreadsRating': 'Goodreads Rating',
'goodreadsReviewCount': 'Goodreads Review Count',
'hardcoverId': 'Hardcover ID',
'hardcoverBookId': 'Hardcover Book ID',
'hardcoverRating': 'Hardcover Rating',
'hardcoverReviewCount': 'Hardcover Review Count',
'comicvineId': 'Comicvine ID',
'lubimyczytacId': 'Lubimyczytac ID',
'lubimyczytacRating': 'Lubimyczytac Rating',
'ranobedbId': 'Ranobedb ID',
'ranobedbRating': 'Ranobedb Rating',
};
private readonly allFieldNames: (keyof MetadataProviderSpecificFields)[] = [
'asin', 'amazonRating', 'amazonReviewCount',
'googleId',
'goodreadsId', 'goodreadsRating', 'goodreadsReviewCount',
'hardcoverId', 'hardcoverBookId', 'hardcoverRating', 'hardcoverReviewCount',
'comicvineId',
'lubimyczytacId', 'lubimyczytacRating',
'ranobedbId', 'ranobedbRating'
];
ngOnInit(): void {
this.appSettingsService.appSettings$
.pipe(
filter(settings => !!settings?.metadataProviderSpecificFields),
take(1)
)
.subscribe(settings => {
if (settings?.metadataProviderSpecificFields) {
this.selectedFields = this.toFieldArray(settings.metadataProviderSpecificFields);
}
});
}
toggleField(field: string, checked: boolean) {
this.selectedFields = checked
? [...this.selectedFields, field]
: this.selectedFields.filter(f => f !== field);
this.appSettingsService.saveSettings([{
key: AppSettingKey.METADATA_PROVIDER_SPECIFIC_FIELDS ?? 'metadataProviderSpecificFields',
newValue: this.toFieldState(this.selectedFields)
}]).subscribe();
}
private toFieldArray(fieldState: MetadataProviderSpecificFields): string[] {
const selectedFields: string[] = [];
for (const [field, enabled] of Object.entries(fieldState)) {
if (enabled) {
selectedFields.push(field);
}
}
return selectedFields;
}
private toFieldState(selectedFields: string[]): MetadataProviderSpecificFields {
const fieldState: any = {};
for (const field of this.allFieldNames) {
fieldState[field] = selectedFields.includes(field);
}
return fieldState;
}
}
@@ -1,16 +1,26 @@
<div class="flex pb-8"> <div class="settings-card">
<p class="text-lg flex items-center gap-2"> <div class="section-header">
Recalculate Metadata Scores: <h3 class="section-title">
<i <i class="pi pi-sliders-h"></i>
class="pi pi-info-circle text-blue-500" Metadata Match Weights
pTooltip="Recomputes match scores for all books based on the latest weights." </h3>
tooltipPosition="right" <p class="section-description">
style="cursor: help;" Configure how important each metadata field is when computing match scores. Higher weights make fields more influential in determining the overall match quality.
></i>
</p> </p>
</div>
<div class="section-body">
<div class="preferences-section">
<div class="action-section">
<div class="action-content">
<div class="action-info">
<span class="action-label">Recalculate Metadata Scores</span>
<span class="action-description">
<i class="pi pi-info-circle"></i>
Recomputes match scores for all books based on the latest weights.
</span>
</div>
<p-button <p-button
class="pl-4"
type="button" type="button"
icon="pi pi-refresh" icon="pi pi-refresh"
label="Recalculate" label="Recalculate"
@@ -19,28 +29,23 @@
outlined outlined
></p-button> ></p-button>
</div> </div>
</div>
<div class="weights-section">
<div class="weights-header">
<span class="weights-icon pi pi-sliders-v"></span>
<h4 class="weights-label">Metadata Field Weights</h4>
</div>
<p class="text-lg flex items-center gap-2"> <form [formGroup]="form" class="weights-form">
Metadata Field Weights <div class="weights-grid">
<i
class="pi pi-info-circle text-blue-500"
pTooltip="Adjust how important each metadata field is when computing match scores. Higher weights make fields more influential."
tooltipPosition="right"
style="cursor: help;"
></i>
</p>
<div class="flex flex-col space-y-6 p-4">
<div class="p-4 space-y-4 max-w-4xl custom-border">
<form [formGroup]="form">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-4 gap-x-6">
@for (key of orderedKeys; track key) { @for (key of orderedKeys; track key) {
<div class="flex text-sm items-center gap-2"> <div class="weight-field">
<label class="capitalize w-full max-w-[150px]"> <label class="field-label">
{{ labelMap[key] }} {{ labelMap[key] }}
</label> </label>
<p-inputNumber <p-inputNumber
size="small"
[formControlName]="key" [formControlName]="key"
[min]="0" [min]="0"
[max]="10" [max]="10"
@@ -50,11 +55,11 @@
</div> </div>
} }
</div> </div>
<div class="mt-4 flex justify-end"> <div class="form-actions">
<p-button <p-button
type="button" type="button"
severity="success" severity="success"
label="Save" label="Save Weights"
icon="pi pi-save" icon="pi pi-save"
outlined outlined
[disabled]="isSaving" [disabled]="isSaving"
@@ -64,3 +69,5 @@
</form> </form>
</div> </div>
</div> </div>
</div>
</div>
@@ -2,3 +2,202 @@
border: 1px solid var(--border-color); border: 1px solid var(--border-color);
border-radius: var(--card-border); border-radius: var(--card-border);
} }
.settings-card {
display: flex;
flex-direction: column;
gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 0.5rem;
}
}
.section-header {
margin-bottom: 2rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.action-section {
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1rem;
margin-bottom: 1rem;
transition: all 0.2s ease;
&:hover {
border-color: color-mix(in srgb, var(--primary-color) 40%, var(--p-content-border-color) 60%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
@media (max-width: 768px) {
padding: 0.875rem;
}
}
.action-content {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;
}
}
.action-info {
display: flex;
flex-direction: column;
gap: 0.375rem;
flex: 1;
}
.action-label {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-color);
}
.action-description {
display: flex;
align-items: center;
gap: 0.375rem;
font-size: 0.8125rem;
color: var(--p-text-muted-color);
line-height: 1.4;
.pi {
font-size: 0.875rem;
color: var(--primary-color);
}
}
.weights-section {
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 0.875rem;
transition: all 0.2s ease;
&:hover {
border-color: color-mix(in srgb, var(--primary-color) 40%, var(--p-content-border-color) 60%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.weights-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1rem;
padding-bottom: 0.625rem;
border-bottom: 1px solid var(--p-content-border-color);
.weights-icon {
color: var(--primary-color);
font-size: 0.9375rem;
flex-shrink: 0;
}
.weights-label {
font-size: 0.9375rem;
font-weight: 600;
color: var(--text-color);
margin: 0;
letter-spacing: -0.01em;
}
}
.weights-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.weights-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 1rem;
@media (max-width: 768px) {
grid-template-columns: 1fr;
gap: 0.75rem;
}
}
.weight-field {
display: flex;
flex-direction: column;
gap: 0.375rem;
.field-label {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-color);
text-transform: capitalize;
}
}
.form-actions {
display: flex;
justify-content: flex-end;
padding-top: 1rem;
border-top: 1px solid var(--p-content-border-color);
@media (max-width: 768px) {
justify-content: stretch;
p-button {
width: 100%;
}
}
}
.section-body {
> .setting-item {
margin-bottom: 0.75rem;
}
}
@@ -3,7 +3,6 @@ import {FormBuilder, FormGroup, ReactiveFormsModule, Validators} from '@angular/
import {MessageService} from 'primeng/api'; import {MessageService} from 'primeng/api';
import {MetadataMatchWeightsService} from '../../../../shared/service/metadata-match-weights.service'; import {MetadataMatchWeightsService} from '../../../../shared/service/metadata-match-weights.service';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {Tooltip} from 'primeng/tooltip';
import {filter, take} from 'rxjs/operators'; import {filter, take} from 'rxjs/operators';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
import {AppSettingKey, AppSettings} from '../../../../shared/model/app-settings.model'; import {AppSettingKey, AppSettings} from '../../../../shared/model/app-settings.model';
@@ -16,7 +15,6 @@ import {InputNumber} from 'primeng/inputnumber';
imports: [ imports: [
ReactiveFormsModule, ReactiveFormsModule,
Button, Button,
Tooltip,
InputNumber InputNumber
], ],
templateUrl: './metadata-match-weights-component.html', templateUrl: './metadata-match-weights-component.html',
@@ -1,24 +1,31 @@
<div class="metadata-settings"> <div class="metadata-settings">
<div class="setting-item"> <div class="settings-card">
<div class="setting-info"> <div class="section-header">
<label class="setting-label">Enabled Metadata Providers</label> <h3 class="section-title">
<p class="setting-description"> <i class="pi pi-cloud"></i>
<i class="pi pi-info-circle"></i> Metadata Providers
Enable or configure third-party metadata sources for enhanced book information. Each provider offers different types of data and coverage. </h3>
<p class="section-description">
Configure which online sources to use for fetching book metadata. Enable providers and set up their API tokens or cookies to access richer book information.
</p> </p>
</div> </div>
</div>
<div class="providers-list"> <div class="section-body">
<div class="provider-item"> <div>
<div class="provider-control"> <h4 class="provider-group-title">Providers with Configuration</h4>
<div class="provider-info">
<p-checkbox [(ngModel)]="amazonEnabled" [binary]="true"></p-checkbox>
<label class="provider-label">Amazon</label>
</div>
</div>
<div class="provider-config"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Amazon</label>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Enabled:</label>
<p-toggleswitch [(ngModel)]="amazonEnabled"></p-toggleswitch>
</div>
@if (amazonEnabled) {
<div class="provider-config-fields">
<div class="config-field"> <div class="config-field">
<label class="config-label">Region</label> <label class="config-label">Region</label>
<p-select <p-select
@@ -36,39 +43,35 @@
</div> </div>
<p class="config-description"> <p class="config-description">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
Providing your Amazon session cookie allows the app to access richer book metadata and bypass rate limits. Optional but recommended for best results. <span>Providing your Amazon session cookie allows the app to access richer book metadata and bypass rate limits.</span>
</p> </p>
<input <input
type="text" type="text"
pInputText pInputText
placeholder="Paste your Amazon cookie" placeholder="Paste your Amazon cookie"
fluid [(ngModel)]="amazonCookie"
class="max-w-[60rem]" class="config-input"/>
[(ngModel)]="amazonCookie"/> </div>
</div>
}
</div> </div>
</div> </div>
</div> </div>
<div class="provider-item"> <div class="setting-item">
<div class="provider-control"> <div class="setting-info">
<div class="provider-info"> <label class="setting-label">Google Books</label>
<p-checkbox [(ngModel)]="goodreadsEnabled" [binary]="true"></p-checkbox>
<label class="provider-label">Goodreads</label>
</div> </div>
<div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Enabled:</label>
<p-toggleswitch [(ngModel)]="googleEnabled"></p-toggleswitch>
</div> </div>
</div> @if (googleEnabled) {
<div class="provider-config-fields">
<div class="provider-item">
<div class="provider-control">
<div class="provider-info">
<p-checkbox [(ngModel)]="googleEnabled" [binary]="true"></p-checkbox>
<label class="provider-label">Google</label>
</div>
</div>
<div class="provider-config">
<div class="config-field"> <div class="config-field">
<label class="config-label">Language restriction</label> <label class="config-label">Language Restriction</label>
<p-select <p-select
[options]="googleLanguages" [options]="googleLanguages"
[(ngModel)]="selectedGoogleLanguage" [(ngModel)]="selectedGoogleLanguage"
@@ -78,21 +81,26 @@
</p-select> </p-select>
</div> </div>
</div> </div>
}
</div>
</div>
</div> </div>
<div class="provider-item"> <div class="setting-item">
<div class="provider-control"> <div class="setting-info">
<div class="provider-info"> <label class="setting-label">Hardcover</label>
<p-checkbox </div>
[binary]="true" <div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Enabled:</label>
<p-toggleswitch
[(ngModel)]="hardcoverEnabled" [(ngModel)]="hardcoverEnabled"
[disabled]="!hardcoverToken"> [disabled]="!hardcoverToken">
</p-checkbox> </p-toggleswitch>
<label class="provider-label">Hardcover</label>
</div> </div>
</div> @if (hardcoverEnabled) {
<div class="provider-config-fields">
<div class="provider-config">
<div class="config-field"> <div class="config-field">
<div class="config-label-row"> <div class="config-label-row">
<label class="config-label">API Token</label> <label class="config-label">API Token</label>
@@ -102,70 +110,82 @@
type="text" type="text"
pInputText pInputText
placeholder="Enter Hardcover API token" placeholder="Enter Hardcover API token"
fluid
class="max-w-[60rem]"
[(ngModel)]="hardcoverToken" [(ngModel)]="hardcoverToken"
(ngModelChange)="onTokenChange($event)"/> (ngModelChange)="onTokenChange($event)"
class="config-input"/>
</div>
</div>
}
</div> </div>
</div> </div>
</div> </div>
<div class="provider-item"> <div class="setting-item">
<div class="provider-control"> <div class="setting-info">
<div class="provider-info"> <label class="setting-label">Comic Vine</label>
<p-checkbox
[binary]="true"
[(ngModel)]="comicvineEnabled"
[disabled]="!comicvineToken">
</p-checkbox>
<label class="provider-label">Comic Vine</label>
</div> </div>
<div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Enabled:</label>
<p-toggleswitch [(ngModel)]="comicvineEnabled"></p-toggleswitch>
</div> </div>
@if (comicvineEnabled) {
<div class="provider-config"> <div class="provider-config-fields">
<div class="config-field"> <div class="config-field">
<label class="config-label">API Token</label> <label class="config-label">API Token</label>
<input <input
type="text" type="text"
pInputText pInputText
placeholder="Enter Comic Vine API token" placeholder="Enter Comic Vine API token"
fluid
class="max-w-[60rem]"
[(ngModel)]="comicvineToken" [(ngModel)]="comicvineToken"
(ngModelChange)="onComicTokenChange($event)"/> (ngModelChange)="onComicTokenChange($event)"
class="config-input"/>
</div>
</div>
}
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="provider-item"> <div>
<div class="provider-control"> <h4 class="provider-group-title">Ready-to-Use Providers</h4>
<div class="provider-info">
<p-checkbox [(ngModel)]="doubanEnabled" [binary]="true"></p-checkbox> <div class="simple-providers-grid">
<label class="provider-label">Douban</label> <div class="simple-provider-item">
</div> <div class="simple-provider-header">
<label class="setting-label">Goodreads</label>
<p-toggleswitch [(ngModel)]="goodreadsEnabled"></p-toggleswitch>
</div> </div>
</div> </div>
<div class="provider-item"> <div class="simple-provider-item">
<div class="provider-control"> <div class="simple-provider-header">
<div class="provider-info"> <label class="setting-label">Douban</label>
<p-checkbox [(ngModel)]="lubimyCzytacEnabled" [binary]="true"></p-checkbox> <p-toggleswitch [(ngModel)]="doubanEnabled"></p-toggleswitch>
<label class="provider-label">Lubimyczytac</label>
</div>
</div> </div>
</div> </div>
<div class="provider-item"> <div class="simple-provider-item">
<div class="provider-control"> <div class="simple-provider-header">
<div class="provider-info"> <label class="setting-label">Lubimyczytac</label>
<p-checkbox [(ngModel)]="ranobedbEnabled" [binary]="true"></p-checkbox> <p-toggleswitch [(ngModel)]="lubimyCzytacEnabled"></p-toggleswitch>
<label class="provider-label">Ranobedb</label> </div>
</div>
<div class="simple-provider-item">
<div class="simple-provider-header">
<label class="setting-label">Ranobedb</label>
<p-toggleswitch [(ngModel)]="ranobedbEnabled"></p-toggleswitch>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="setting-actions"> <div class="setting-actions">
<p-button label="Save" icon="pi pi-save" severity="success" [outlined]="true" (click)="saveSettings()"></p-button> <p-button label="Save Configurations" icon="pi pi-save" severity="success" [outlined]="true" (click)="saveSettings()"></p-button>
</div>
</div>
</div> </div>
</div> </div>
@@ -1,22 +1,144 @@
.metadata-settings { .metadata-settings {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.5rem; }
.section-header {
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.settings-card {
display: flex;
flex-direction: column;
gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
.provider-group-title {
font-size: 1rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.25rem 0;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--p-content-border-color);
}
.provider-group-description {
font-size: 0.8125rem;
color: var(--p-text-muted-color);
margin: 0 0 0.75rem 0;
}
.simple-providers-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1rem;
@media (max-width: 768px) {
grid-template-columns: 1fr;
gap: 0.75rem;
}
}
.simple-provider-item {
background: var(--p-surface-800);
border: 1px solid var(--p-content-border-color);
border-radius: 6px;
padding: 0.875rem 1rem;
transition: all 0.2s ease;
&:hover {
border-color: var(--primary-color);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.simple-provider-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
.setting-label {
margin: 0;
font-weight: 500;
color: var(--text-color);
font-size: 0.9375rem;
}
} }
.setting-item { .setting-item {
display: flex; display: flex;
align-items: flex-start; flex-direction: column;
gap: 2rem; padding-bottom: 1rem;
border-bottom: 1px solid var(--p-content-border-color);
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
padding-bottom: 0; padding-bottom: 0;
} }
&.setting-item-indented {
display: inline-flex;
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 3px solid var(--primary-color);
border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative;
&::before {
display: none;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
&.setting-item-indented {
max-width: 100%;
margin-left: 0;
padding: 0.625rem 0.625rem 0.5rem 0.625rem;
}
} }
} }
@@ -27,15 +149,30 @@
.setting-label { .setting-label {
display: block; display: block;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
letter-spacing: -0.01em;
}
.setting-label-row {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
.setting-label {
margin-bottom: 0;
flex-shrink: 0;
font-size: 0.9375rem;
color: var(--text-color-secondary);
}
} }
.setting-description { .setting-description {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 0.5rem; gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
@@ -44,7 +181,11 @@
.pi { .pi {
margin-top: 0.125rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
color: var(--p-primary-color); font-size: 0.875rem;
}
.pi-info-circle {
color: var(--primary-color);
} }
} }
} }
@@ -85,12 +226,20 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
align-items: flex-start;
@media (max-width: 768px) { @media (max-width: 768px) {
padding-left: 0; padding-left: 0;
} }
} }
.provider-config-fields {
display: flex;
flex-direction: column;
gap: 1rem;
margin-top: 0.5rem;
}
.config-field { .config-field {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -98,7 +247,7 @@
.config-label { .config-label {
font-weight: 500; font-weight: 500;
color: var(--p-text-color); color: var(--text-color);
font-size: 0.875rem; font-size: 0.875rem;
} }
@@ -115,27 +264,61 @@
.config-description { .config-description {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 0.5rem; gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.8125rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
.pi { .pi {
margin-top: 0.125rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
color: var(--p-primary-color); font-size: 0.8125rem;
color: var(--primary-color);
} }
} }
.config-select { ::ng-deep .config-select {
width: 100%; width: 100%;
max-width: 13rem; max-width: 20rem;
}
.config-input {
width: 100%;
max-width: 40rem;
padding: 0.5rem 0.75rem;
border: 1px solid var(--p-content-border-color);
border-radius: 6px;
background: var(--ground-background);
color: var(--text-color);
font-size: 0.9375rem;
transition: all 0.2s ease;
&:hover {
border-color: var(--primary-color);
}
&:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 15%, transparent 85%);
}
&::placeholder {
color: var(--p-text-muted-color);
}
} }
} }
.setting-actions { .setting-actions {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-end;
padding-top: 1rem; }
.section-body {
padding-left: 1rem;
> .setting-item {
margin-bottom: 0.75rem;
}
} }
@@ -1,27 +1,28 @@
import {Component, inject, OnInit} from '@angular/core'; import {Component, DestroyRef, inject, OnInit} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {TableModule} from 'primeng/table'; import {TableModule} from 'primeng/table';
import {Checkbox} from 'primeng/checkbox';
import {InputText} from 'primeng/inputtext'; import {InputText} from 'primeng/inputtext';
import {Button} from 'primeng/button'; import {Button} from 'primeng/button';
import {AppSettingsService} from '../../../../shared/service/app-settings.service'; import {AppSettingsService} from '../../../../shared/service/app-settings.service';
import {filter, take} from 'rxjs/operators'; import {filter} from 'rxjs/operators';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {MessageService} from 'primeng/api'; import {MessageService} from 'primeng/api';
import {AppSettingKey} from '../../../../shared/model/app-settings.model'; import {AppSettingKey} from '../../../../shared/model/app-settings.model';
import {Select} from 'primeng/select'; import {Select} from 'primeng/select';
import {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component'; import {ExternalDocLinkComponent} from '../../../../shared/components/external-doc-link/external-doc-link.component';
import { ToggleSwitchModule } from 'primeng/toggleswitch';
@Component({ @Component({
selector: 'app-metadata-provider-settings', selector: 'app-metadata-provider-settings',
imports: [ imports: [
ReactiveFormsModule, ReactiveFormsModule,
TableModule, TableModule,
Checkbox,
InputText, InputText,
Button, Button,
FormsModule, FormsModule,
Select, Select,
ExternalDocLinkComponent ExternalDocLinkComponent,
ToggleSwitchModule
], ],
templateUrl: './metadata-provider-settings.component.html', templateUrl: './metadata-provider-settings.component.html',
styleUrl: './metadata-provider-settings.component.scss' styleUrl: './metadata-provider-settings.component.scss'
@@ -81,6 +82,7 @@ export class MetadataProviderSettingsComponent implements OnInit {
private appSettingsService = inject(AppSettingsService); private appSettingsService = inject(AppSettingsService);
private messageService = inject(MessageService); private messageService = inject(MessageService);
private destroyRef = inject(DestroyRef);
private appSettings$ = this.appSettingsService.appSettings$; private appSettings$ = this.appSettingsService.appSettings$;
@@ -88,7 +90,7 @@ export class MetadataProviderSettingsComponent implements OnInit {
this.appSettings$ this.appSettings$
.pipe( .pipe(
filter(settings => settings != null), filter(settings => settings != null),
take(1) takeUntilDestroyed(this.destroyRef)
) )
.subscribe(settings => { .subscribe(settings => {
const metadataProviderSettings = settings!.metadataProviderSettings; const metadataProviderSettings = settings!.metadataProviderSettings;
@@ -117,9 +119,6 @@ export class MetadataProviderSettingsComponent implements OnInit {
onComicTokenChange(newToken: string): void { onComicTokenChange(newToken: string): void {
this.comicvineToken = newToken; this.comicvineToken = newToken;
if (!newToken.trim()) {
this.comicvineEnabled = false;
}
} }
saveSettings(): void { saveSettings(): void {
@@ -132,12 +131,10 @@ export class MetadataProviderSettingsComponent implements OnInit {
cookie: this.amazonCookie, cookie: this.amazonCookie,
domain: this.selectedAmazonDomain domain: this.selectedAmazonDomain
}, },
comicvine: { comicvine: {
enabled: this.comicvineEnabled, enabled: this.comicvineEnabled,
apiKey: this.comicvineToken.trim() apiKey: this.comicvineToken.trim()
}, },
goodReads: {enabled: this.goodreadsEnabled}, goodReads: {enabled: this.goodreadsEnabled},
google: { google: {
enabled: this.googleEnabled, enabled: this.googleEnabled,
@@ -1,12 +1,15 @@
<div class="preferences-section"> <div class="settings-card">
<div class="section-header"> <div class="section-header">
<h3 class="section-title"> <h3 class="section-title">
<i class="pi pi-save"></i> <i class="pi pi-save"></i>
Metadata Persistence Metadata Persistence
</h3> </h3>
<p class="section-description">
Configure how metadata is written to original files and how files are moved or renamed when metadata changes.
</p>
</div> </div>
<div class="settings-card"> <div class="section-notice">
<div class="warning-notice"> <div class="warning-notice">
<i class="pi pi-exclamation-triangle"></i> <i class="pi pi-exclamation-triangle"></i>
<div> <div>
@@ -14,23 +17,22 @@
incomplete writes, or permanent data loss. Github issues related to network storage will not be supported. incomplete writes, or permanent data loss. Github issues related to network storage will not be supported.
</div> </div>
</div> </div>
<div class="info-notice unsupported-formats-note">
<div class="info-notice unsupported-formats-note" style="margin-bottom: 1rem;">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
<div> <div>
<strong>Note:</strong> Writing metadata is <b>not supported</b> for FB2, AZW3, and MOBI formats. <strong>Note:</strong> Writing metadata is <b>not supported</b> for FB2, AZW3, and MOBI formats.
</div> </div>
</div> </div>
</div>
<div class="section-body">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Write Metadata to EPUB</label> <label class="setting-label">Write Metadata to EPUB</label>
<p class="setting-description"> <p class="setting-description">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
Write metadata directly into EPUB files when editing book information. <span>Write metadata directly into EPUB files when editing book information.</span>
</p> </p>
<div class="setting-item setting-item-indented"> <div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">Enabled:</label> <label class="setting-label">Enabled:</label>
<p-toggleswitch <p-toggleswitch
@@ -39,7 +41,7 @@
</p-toggleswitch> </p-toggleswitch>
</div> </div>
@if (metadataPersistence.saveToOriginalFile.epub.enabled) { @if (metadataPersistence.saveToOriginalFile.epub.enabled) {
<div class="filesize-input" style="margin-top: 0.5rem;"> <div class="filesize-input">
<label>Max File Size (MB):</label> <label>Max File Size (MB):</label>
<input <input
type="number" type="number"
@@ -52,24 +54,20 @@
class="pi pi-info-circle text-blue-500" class="pi pi-info-circle text-blue-500"
pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored." pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored."
tooltipPosition="right" tooltipPosition="right"
style="cursor: help; margin-left: 4px;" style="cursor: help;"
></i> ></i>
</div> </div>
} }
</div> </div>
</div> </div>
</div>
</div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Write Metadata to CBX</label> <label class="setting-label">Write Metadata to CBX</label>
<p class="setting-description"> <p class="setting-description">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
Write metadata directly into CBX files when editing book information. <span>Write metadata directly into CBX files when editing book information.</span>
</p> </p>
<div class="setting-item setting-item-indented"> <div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">Enabled:</label> <label class="setting-label">Enabled:</label>
<p-toggleswitch <p-toggleswitch
@@ -78,7 +76,7 @@
</p-toggleswitch> </p-toggleswitch>
</div> </div>
@if (metadataPersistence.saveToOriginalFile.cbx.enabled) { @if (metadataPersistence.saveToOriginalFile.cbx.enabled) {
<div class="filesize-input" style="margin-top: 0.5rem;"> <div class="filesize-input">
<label>Max File Size (MB):</label> <label>Max File Size (MB):</label>
<input <input
type="number" type="number"
@@ -91,25 +89,21 @@
class="pi pi-info-circle text-blue-500" class="pi pi-info-circle text-blue-500"
pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored." pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored."
tooltipPosition="right" tooltipPosition="right"
style="cursor: help; margin-left: 4px;" style="cursor: help;"
></i> ></i>
</div> </div>
} }
</div> </div>
</div> </div>
</div>
</div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Write Metadata to PDF</label> <label class="setting-label">Write Metadata to PDF</label>
<p class="setting-description"> <p class="setting-description">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
Write metadata directly into PDF files when editing book information. <br> <span>Write metadata directly into PDF files when editing book information. <br>
Note: PDFs do not support embedded covers, and only a limited set of metadata can be updated (Title, Authors, Publisher, Categories, Description, Language, Published Date). This is a limitation of the PDF format. <strong>Note:</strong> PDFs do not support embedded covers, and only a limited set of metadata can be updated (Title, Authors, Publisher, Categories, Description, Language, Published Date). This is a limitation of the PDF format.</span>
</p> </p>
<div class="setting-item setting-item-indented"> <div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">Enabled:</label> <label class="setting-label">Enabled:</label>
<p-toggleswitch <p-toggleswitch
@@ -118,7 +112,7 @@
</p-toggleswitch> </p-toggleswitch>
</div> </div>
@if (metadataPersistence.saveToOriginalFile.pdf.enabled) { @if (metadataPersistence.saveToOriginalFile.pdf.enabled) {
<div class="filesize-input" style="margin-top: 0.5rem;"> <div class="filesize-input">
<label>Max File Size (MB):</label> <label>Max File Size (MB):</label>
<input <input
type="number" type="number"
@@ -131,24 +125,20 @@
class="pi pi-info-circle text-blue-500" class="pi pi-info-circle text-blue-500"
pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored." pTooltip="Only files up to this size (MB) will be updated. Larger files are ignored."
tooltipPosition="right" tooltipPosition="right"
style="cursor: help; margin-left: 4px;" style="cursor: help;"
></i> ></i>
</div> </div>
} }
</div> </div>
</div> </div>
</div>
</div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Auto-Move Files on Metadata Update</label> <label class="setting-label">Auto-Move Files on Metadata Update</label>
<p class="setting-description"> <p class="setting-description">
<i class="pi pi-info-circle"></i> <i class="pi pi-info-circle"></i>
Automatically move and rename files according to their library's naming pattern when metadata is updated, either through manual editing or auto-fetch operations. <span>Automatically move and rename files according to their library's naming pattern when metadata is updated, either through manual editing or auto-fetch operations.</span>
</p> </p>
<div class="setting-item setting-item-indented"> <div class="setting-item setting-item-indented">
<div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">Enabled:</label> <label class="setting-label">Enabled:</label>
<p-toggleswitch <p-toggleswitch
@@ -160,5 +150,3 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
@@ -1,46 +1,63 @@
.enclosing-container {
border-color: var(--p-content-border-color);
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 1rem;
}
}
.section-header { .section-header {
margin-bottom: 1rem; margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
} }
.section-title { .section-title {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
font-size: 1.125rem; font-size: 1.25rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
margin: 0; margin: 0 0 0.5rem 0;
.pi { .pi {
color: var(--p-primary-color); color: var(--primary-color);
font-size: 1.125rem;
} }
} }
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.settings-card { .settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.5rem; gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
.section-notice {
display: flex;
flex-direction: column;
gap: 1rem;
}
.section-body {
padding-left: 1rem;
> .setting-item {
margin-bottom: 0.75rem;
}
} }
.setting-item { .setting-item {
display: flex; padding-bottom: 1rem;
align-items: flex-start; border-bottom: 1px solid var(--p-content-border-color);
gap: 2rem;
flex-wrap: wrap;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
@@ -48,94 +65,67 @@
} }
&.setting-item-indented { &.setting-item-indented {
margin-top: 1rem; margin-top: 0.5rem;
margin-left: 1.5rem; margin-left: 0;
padding-left: 1rem; padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 2px solid var(--p-border-color); border-left: 3px solid var(--primary-color);
border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative; position: relative;
&::before { &::before {
content: ''; display: none;
position: absolute;
left: -2px;
top: 0;
bottom: 0;
width: 2px;
background: var(--p-primary-color);
opacity: 0.3;
} }
} }
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
&.setting-item-indented { &.setting-item-indented {
margin-left: 1rem; margin-left: 0;
padding-left: 0.75rem; padding: 0.625rem 0.625rem 0.5rem 0.625rem;
} }
} }
}
.setting-info {
flex: 1;
min-width: 0;
.setting-label { .setting-label {
display: block; display: block;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
letter-spacing: -0.01em;
} }
.setting-label-row { .setting-label-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1rem; gap: 0.75rem;
margin-bottom: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
.setting-label { .setting-label {
margin-bottom: 0; margin-bottom: 0;
flex-shrink: 0; flex-shrink: 0;
font-size: 0.9375rem;
color: var(--text-color-secondary);
} }
} }
.setting-description { .setting-description {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 0.5rem; gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0 0 0.5rem 0;
.pi { .pi {
margin-top: 0.125rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
font-size: 0.875rem;
color: var(--primary-color);
} }
.pi-exclamation-triangle {
color: var(--p-orange-500);
}
.pi-info-circle {
color: var(--p-primary-color);
}
}
}
.setting-control {
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 0.75rem;
align-items: flex-end;
@media (max-width: 768px) {
align-items: flex-start;
width: 100%;
} }
} }
@@ -143,99 +133,100 @@
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 0.75rem; gap: 0.75rem;
font-size: 0.9375rem;
font-size: 0.9rem; line-height: 1.5;
line-height: 1.55; padding: 0.75rem 1rem;
border-radius: 8px;
padding: 0.875rem 1rem; background: color-mix(in srgb, var(--ground-background) 85%, var(--p-red-600) 15%);
border-radius: 10px; border: 1px solid color-mix(in srgb, var(--p-red-500) 30%, transparent 70%);
border-left: 3px solid var(--p-red-500);
background: color-mix( color: var(--text-color);
in srgb, box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
var(--p-surface-900) 85%,
var(--p-red-600) 15%
);
border-left: 4px solid var(--p-red-500);
color: var(--p-text-color);
.pi-exclamation-triangle { .pi-exclamation-triangle {
color: var(--p-red-400); color: var(--p-red-400);
margin-top: 0.15rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
font-size: 1.125rem;
} }
strong { strong {
font-weight: 700; font-weight: 700;
color: var(--p-red-300); color: var(--p-red-300);
} }
}
.nested-settings { @media (max-width: 768px) {
margin-top: 1rem; padding: 0.625rem 0.75rem;
margin-left: 1.5rem; gap: 0.625rem;
padding-left: 1rem;
border-left: 2px solid var(--surface-border);
}
.format-setting {
margin-bottom: 1rem;
&:last-child {
margin-bottom: 0;
}
}
.filesize-input {
display: flex;
align-items: center;
gap: 0.5rem;
label {
font-size: 0.875rem;
font-weight: 600;
white-space: nowrap;
}
.filesize-field {
width: 100px;
padding: 0.5rem;
border: 1px solid var(--p-content-border-color);
border-radius: 6px;
background: var(--p-content-background);
color: var(--p-text-color);
&:focus {
outline: none;
border-color: var(--p-primary-color);
box-shadow: 0 0 0 2px var(--p-primary-color-transparent);
}
} }
} }
.info-notice.unsupported-formats-note { .info-notice.unsupported-formats-note {
background: color-mix( background: color-mix(in srgb, var(--ground-background) 90%, var(--p-blue-600) 10%);
in srgb, border: 1px solid color-mix(in srgb, var(--p-blue-400) 30%, transparent 70%);
var(--p-surface-900) 90%, border-left: 3px solid var(--p-blue-400);
var(--p-blue-600) 10% color: var(--text-color);
);
border-left: 4px solid var(--p-blue-400);
color: var(--p-text-color);
padding: 0.75rem 1rem; padding: 0.75rem 1rem;
border-radius: 8px; border-radius: 8px;
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: 0.75rem; gap: 0.75rem;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
margin-bottom: 1rem;
.pi-info-circle { .pi-info-circle {
color: var(--p-blue-400); color: var(--p-blue-400);
margin-top: 0.15rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
font-size: 1.125rem;
} }
strong { strong {
color: var(--p-blue-300); color: var(--p-blue-300);
font-weight: 700; font-weight: 700;
} }
@media (max-width: 768px) {
padding: 0.625rem 0.75rem;
gap: 0.625rem;
}
}
.filesize-input {
display: flex;
align-items: center;
gap: 0.625rem;
margin-top: 0.5rem;
label {
font-size: 0.875rem;
font-weight: 500;
color: var(--text-color-secondary);
white-space: nowrap;
}
.filesize-field {
width: 100px;
padding: 0.375rem 0.625rem;
border: 1px solid var(--p-content-border-color);
border-radius: 6px;
background: var(--ground-background);
color: var(--text-color);
font-size: 0.9375rem;
transition: all 0.2s ease;
&:hover {
border-color: var(--primary-color);
}
&:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 15%, transparent 85%);
}
}
@media (max-width: 768px) {
gap: 0.5rem;
}
} }
@@ -1,24 +1,19 @@
<div class="main-container enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto">
<div class="settings-header"> <app-metadata-persistence-settings-component></app-metadata-persistence-settings-component>
<h2 class="settings-title"> <div class="pt-10"><hr></div>
<i class="pi pi-sliders-h"></i>
Metadata Settings
</h2>
<p class="settings-description">
Configure how metadata is retrieved, stored, and managed for your books. Set up automatic downloads, persistence options, and provider preferences.
</p>
</div>
<div class="settings-content">
<div class="preferences-section"> <div class="preferences-section">
<div class="settings-card">
<div class="section-header"> <div class="section-header">
<h3 class="section-title"> <h3 class="section-title">
<i class="pi pi-download"></i> <i class="pi pi-download"></i>
Auto-Download Metadata Auto-Download Metadata
</h3> </h3>
<p class="section-description">
<i class="pi pi-exclamation-triangle"></i>
Automatically downloads metadata from your configured sources when files are added to the Bookdrop folder. Use with caution if adding many files at once as metadata fetching can take time.
</p>
</div> </div>
<div class="settings-card">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
@@ -28,56 +23,16 @@
(onChange)="onMetadataDownloadOnBookdropToggle($event.checked)"> (onChange)="onMetadataDownloadOnBookdropToggle($event.checked)">
</p-toggleswitch> </p-toggleswitch>
</div> </div>
<p class="setting-description">
<i class="pi pi-exclamation-triangle"></i>
Automatically downloads metadata from your configured sources (Amazon, Goodreads, etc.) when files are added to the Bookdrop folder. Use with caution if adding many files at once as metadata fetching can take time.
</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="pt-10"><hr></div>
<div class="metadata-persistence-section">
<app-metadata-persistence-settings-component></app-metadata-persistence-settings-component>
</div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-cloud"></i>
Metadata Providers
</h3>
</div>
<div class="settings-card">
<app-metadata-provider-settings></app-metadata-provider-settings> <app-metadata-provider-settings></app-metadata-provider-settings>
</div> <div class="pt-10"><hr></div>
</div> <app-metadata-provider-field-selector></app-metadata-provider-field-selector>
<div class="pt-10"><hr></div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-star"></i>
Public Reviews
</h3>
</div>
<div class="settings-card">
<app-public-reviews-settings-component></app-public-reviews-settings-component> <app-public-reviews-settings-component></app-public-reviews-settings-component>
</div> <div class="pt-10"><hr></div>
</div>
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-sliders-h"></i>
Metadata Match Weights
</h3>
</div>
<div class="settings-card">
<app-metadata-match-weights-component></app-metadata-match-weights-component> <app-metadata-match-weights-component></app-metadata-match-weights-component>
</div> </div>
</div>
</div>
</div>
@@ -1,21 +1,3 @@
.main-container {
width: 100%;
padding: 1rem;
height: calc(100dvh - 10.5rem);
overflow-y: auto;
border-width: 1px;
border-radius: 0.5rem;
@media (min-width: 768px) {
height: calc(100dvh - 11.65rem);
}
}
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header { .settings-header {
margin-top: 1rem; margin-top: 1rem;
margin-bottom: 2rem; margin-bottom: 2rem;
@@ -49,13 +31,6 @@
gap: 2rem; gap: 2rem;
} }
.preferences-section {
@media (min-width: 768px) {
padding: 0 1rem;
}
}
.section-header { .section-header {
margin-bottom: 1rem; margin-bottom: 1rem;
@@ -69,10 +44,17 @@
gap: 0.5rem; gap: 0.5rem;
.pi { .pi {
color: var(--p-primary-color);
margin-top: 0.125rem; margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
} }
.pi-exclamation-triangle {
color: var(--p-orange-500);
}
.pi-info-circle {
color: var(--p-primary-color);
}
} }
} }
@@ -97,7 +79,17 @@
padding: 1.5rem; padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.5rem; gap: 1rem;
.section-header {
padding-bottom: 1rem;
border-bottom: 1px solid var(--p-content-border-color);
margin-bottom: 0;
+ .setting-item {
margin-top: 0.5rem;
}
}
} }
.setting-item { .setting-item {
@@ -11,6 +11,7 @@ import {ToggleSwitch} from 'primeng/toggleswitch';
import {MetadataMatchWeightsComponent} from '../global-preferences/metadata-match-weights/metadata-match-weights-component'; import {MetadataMatchWeightsComponent} from '../global-preferences/metadata-match-weights/metadata-match-weights-component';
import {MetadataPersistenceSettingsComponent} from './metadata-persistence-settings/metadata-persistence-settings-component'; import {MetadataPersistenceSettingsComponent} from './metadata-persistence-settings/metadata-persistence-settings-component';
import {PublicReviewsSettingsComponent} from './public-reviews-settings/public-reviews-settings-component'; import {PublicReviewsSettingsComponent} from './public-reviews-settings/public-reviews-settings-component';
import {MetadataProviderFieldSelectorComponent} from '../../metadata/component/metadata-provider-field-selector/metadata-provider-field-selector.component';
@Component({ @Component({
selector: 'app-metadata-settings-component', selector: 'app-metadata-settings-component',
@@ -22,7 +23,8 @@ import {PublicReviewsSettingsComponent} from './public-reviews-settings/public-r
MetadataMatchWeightsComponent, MetadataMatchWeightsComponent,
ToggleSwitch, ToggleSwitch,
MetadataPersistenceSettingsComponent, MetadataPersistenceSettingsComponent,
PublicReviewsSettingsComponent PublicReviewsSettingsComponent,
MetadataProviderFieldSelectorComponent
], ],
templateUrl: './metadata-settings-component.html', templateUrl: './metadata-settings-component.html',
styleUrl: './metadata-settings-component.scss' styleUrl: './metadata-settings-component.scss'
@@ -1,3 +1,15 @@
<div class="settings-card">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-star"></i>
Public Reviews
</h3>
<p class="section-description">
Configure automatic downloading of user reviews from external platforms. Reviews can be fetched from Amazon, Goodreads, and Hardcover for offline access.
</p>
</div>
<div class="section-body">
<div class="reviews-settings"> <div class="reviews-settings">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info"> <div class="setting-info">
@@ -34,9 +46,10 @@
<div class="review-sources-section"> <div class="review-sources-section">
<div class="sources-header"> <div class="sources-header">
<span class="group-icon pi pi-database"></span>
<h4 class="subsection-title">Review Sources</h4> <h4 class="subsection-title">Review Sources</h4>
<p class="subsection-description">Configure which platforms to download reviews from and set limits for each source.</p>
</div> </div>
<p class="subsection-description">Configure which platforms to download reviews from and set limits for each source.</p>
<div class="providers-list"> <div class="providers-list">
@for (provider of publicReviewSettings.providers; track provider.provider) { @for (provider of publicReviewSettings.providers; track provider.provider) {
@@ -78,3 +91,5 @@
</div> </div>
} }
</div> </div>
</div>
</div>
@@ -1,3 +1,57 @@
.settings-card {
display: flex;
flex-direction: column;
gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
.section-header {
margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-body {
padding-left: 1rem;
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 0.5rem;
}
}
.reviews-settings { .reviews-settings {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -9,6 +63,7 @@
align-items: flex-start; align-items: flex-start;
gap: 2rem; gap: 2rem;
padding-bottom: 1.5rem; padding-bottom: 1.5rem;
border-bottom: 1px solid var(--p-content-border-color);
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
@@ -77,48 +132,66 @@
} }
.review-sources-section { .review-sources-section {
padding-left: 2rem; padding-top: 1rem;
margin-top: -1rem; margin-top: 0.5rem;
border-top: 1px solid var(--p-content-border-color);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
@media (max-width: 768px) {
padding-left: 0;
}
} }
.sources-header { .sources-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 0.5rem;
.group-icon {
color: var(--primary-color);
font-size: 0.9375rem;
flex-shrink: 0;
}
.subsection-title { .subsection-title {
font-size: 1rem; font-size: 0.9375rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--p-text-color);
margin-bottom: 0.5rem; margin: 0;
letter-spacing: -0.01em;
}
} }
.subsection-description { .subsection-description {
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0 0 1rem 0;
}
} }
.providers-list { .providers-list {
display: flex; display: grid;
flex-direction: column; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 1rem; gap: 0.875rem;
@media (max-width: 768px) {
grid-template-columns: 1fr;
}
} }
.provider-item { .provider-item {
width: 25rem; background: var(--card-background);
border-radius: 6px; border: 1px solid var(--p-content-border-color);
padding: 0.75rem; border-radius: 8px;
background: var(--p-surface-800); padding: 0.875rem;
transition: all 0.2s ease;
&:hover {
border-color: color-mix(in srgb, var(--primary-color) 40%, var(--p-content-border-color) 60%);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
@media (max-width: 768px) { @media (max-width: 768px) {
width: 100%; padding: 0.75rem;
max-width: none;
} }
} }
@@ -136,6 +209,9 @@
.provider-label-row { .provider-label-row {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
width: 100%;
gap: 1rem;
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; flex-direction: column;
@@ -145,14 +221,9 @@
.provider-label { .provider-label {
font-weight: 500; font-weight: 500;
width: 6rem;
color: var(--p-text-color); color: var(--p-text-color);
font-size: 0.875rem;
flex-shrink: 0; flex-shrink: 0;
@media (max-width: 768px) {
width: auto;
margin-bottom: 0.5rem;
}
} }
.provider-controls { .provider-controls {
@@ -209,8 +280,10 @@
.max-reviews-input { .max-reviews-input {
width: 4rem; width: 4rem;
padding: 0.25rem; padding: 0.375rem 0.5rem;
border: 1px solid var(--p-content-border-color);
border-radius: 4px; border-radius: 4px;
background: var(--p-surface-800);
color: var(--p-text-color); color: var(--p-text-color);
font-size: 0.875rem; font-size: 0.875rem;
text-align: center; text-align: center;
@@ -1,28 +1,26 @@
<div class="main-container enclosing-container"> <div class="settings-card">
<div class="settings-header"> <div class="section-header">
<h2 class="settings-title"> <h3 class="section-title">
<i class="pi pi-sort-alt"></i> <i class="pi pi-filter"></i>
Filter Preferences Filter Preferences
</h2> </h3>
<p class="settings-description"> <p class="section-description">
Configure default options for filter controls shown in the sidebar. Configure default options for filter controls shown in the sidebar.
</p> </p>
</div> </div>
<div class="settings-content"> <div class="section-body">
<div class="preferences-section">
<div class="settings-card">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Filter Mode</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose the default mode for combining filters selected from the right filter sidebar.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Filter Mode
<i class="pi pi-info-circle text-sky-600"
pTooltip="Choose the default mode for combining filters selected from the filter sidebar."
tooltipPosition="right"
style="cursor: pointer;">
</i>
</label>
<p-select <p-select
size="small" size="small"
[options]="filterModes" [options]="filterModes"
@@ -31,23 +29,21 @@
appendTo="body"> appendTo="body">
</p-select> </p-select>
</div> </div>
<p class="setting-description"> </div>
Choose the default mode for combining filters selected from the right filter sidebar.
</p>
</div> </div>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Sorting Mode</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose how filter options are sorted in the sidebar.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Sorting Mode
<i class="pi pi-info-circle text-sky-600"
pTooltip="Choose how filter options are sorted in the sidebar."
tooltipPosition="right"
style="cursor: pointer;">
</i>
</label>
<p-select <p-select
size="small" size="small"
[options]="filterSortingModes" [options]="filterSortingModes"
@@ -56,10 +52,6 @@
appendTo="body"> appendTo="body">
</p-select> </p-select>
</div> </div>
<p class="setting-description">
Choose how filter options are sorted in the sidebar.
</p>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -1,77 +1,89 @@
.main-container { .section-header {
width: 100%;
padding: 1rem;
overflow-y: auto;
}
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header {
margin-top: 1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
} }
.settings-title { .section-title {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.75rem; gap: 0.5rem;
font-size: 1.25rem; font-size: 1.25rem;
font-weight: 700; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
margin: 0 0 0.75rem 0; margin: 0 0 0.5rem 0;
.pi { .pi {
color: var(--p-primary-color); color: var(--primary-color);
font-size: 1.25rem; font-size: 1.125rem;
} }
} }
.settings-description { .section-description {
color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin-bottom: 1rem; color: var(--p-text-muted-color);
margin: 0;
} }
.settings-content { .section-body {
display: flex; padding-left: 1rem;
flex-direction: column;
gap: 2rem;
}
.preferences-section { > .setting-item {
@media (min-width: 768px) { margin-bottom: 0.75rem;
padding: 0 1rem;
} }
} }
.settings-card { .settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
} }
.setting-item { .setting-item {
display: flex; display: flex;
align-items: flex-start; flex-direction: column;
gap: 2rem; gap: 0.5rem;
padding: 0.25rem 0; padding-bottom: 1rem;
border-bottom: 1px solid var(--p-content-border-color);
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
padding-bottom: 0; padding-bottom: 0;
} }
&.setting-item-indented {
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 3px solid var(--primary-color);
border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative;
&::before {
display: none;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
&.setting-item-indented {
margin-left: 0;
padding: 0.625rem 0.625rem 0.5rem 0.625rem;
}
} }
} }
@@ -80,54 +92,53 @@
min-width: 0; min-width: 0;
.setting-label { .setting-label {
display: flex; display: block;
align-items: center;
gap: 0.5rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
letter-spacing: -0.01em;
} }
.setting-label-row { .setting-label-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1rem; gap: 0.75rem;
margin-bottom: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
.setting-label { .setting-label {
margin-bottom: 0; margin-bottom: 0;
flex-shrink: 0; flex-shrink: 0;
min-width: 120px; font-size: 0.9375rem;
color: var(--text-color-secondary);
} }
p-select { p-select {
min-width: 200px; min-width: 200px;
@media (max-width: 768px) { @media (max-width: 768px) {
min-width: 180px; min-width: 100%;
} }
} }
} }
.setting-description { .setting-description {
display: flex;
align-items: flex-start;
gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
}
}
.setting-control { .pi {
margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
display: flex; font-size: 0.875rem;
flex-direction: column; }
gap: 0.75rem;
align-items: flex-end;
@media (max-width: 768px) { .pi-info-circle {
align-items: flex-start; color: var(--primary-color);
width: 100%; }
} }
} }
@@ -1,7 +1,6 @@
import {Component, inject, OnDestroy, OnInit} from '@angular/core'; import {Component, inject, OnDestroy, OnInit} from '@angular/core';
import {Select} from 'primeng/select'; import {Select} from 'primeng/select';
import {Tooltip} from 'primeng/tooltip'; import {BookFilterMode, FilterSortingMode, User, UserService, UserSettings, UserState} from '../../user-management/user.service';
import {BookFilterMode, FilterSortingMode, SidebarLibrarySorting, SidebarShelfSorting, User, UserService, UserSettings, UserState} from '../../user-management/user.service';
import {MessageService} from 'primeng/api'; import {MessageService} from 'primeng/api';
import {Observable, Subject} from 'rxjs'; import {Observable, Subject} from 'rxjs';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
@@ -11,7 +10,6 @@ import {filter, takeUntil} from 'rxjs/operators';
selector: 'app-filter-preferences', selector: 'app-filter-preferences',
imports: [ imports: [
Select, Select,
Tooltip,
FormsModule FormsModule
], ],
templateUrl: './filter-preferences.component.html', templateUrl: './filter-preferences.component.html',
@@ -1,28 +1,26 @@
<div class="main-container enclosing-container"> <div class="settings-card">
<div class="settings-header"> <div class="section-header">
<h2 class="settings-title"> <h3 class="section-title">
<i class="pi pi-cog"></i> <i class="pi pi-cog"></i>
View Preferences View Preferences
</h2> </h3>
<p class="settings-description"> <p class="section-description">
Customize how you view metadata and series information. Customize how you view metadata and series information.
</p> </p>
</div> </div>
<div class="settings-content"> <div class="section-body">
<div class="preferences-section">
<div class="settings-card">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Metadata Center Display Mode</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose whether to open the Metadata Center in the current page or as a popup dialog window.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Metadata Center Display Mode
<i class="pi pi-info-circle text-sky-600"
pTooltip="Choose whether to open the Metadata Center in the current page or as a popup dialog window."
tooltipPosition="right"
style="cursor: pointer;">
</i>
</label>
<div class="button-group"> <div class="button-group">
<button <button
type="button" type="button"
@@ -42,23 +40,21 @@
</button> </button>
</div> </div>
</div> </div>
<p class="setting-description">
Choose whether to open the Metadata Center in the current page or as a popup dialog window.
</p>
</div> </div>
</div> </div>
<!-- Series View Mode Setting --> </div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Series View Mode</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Enable or disable the series view mode for displaying series information.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Series View Mode
<i class="pi pi-info-circle text-sky-600"
pTooltip="Enable or disable the series view mode for displaying series information."
tooltipPosition="right"
style="cursor: pointer;">
</i>
</label>
<div class="button-group"> <div class="button-group">
<button <button
type="button" type="button"
@@ -78,10 +74,6 @@
</button> </button>
</div> </div>
</div> </div>
<p class="setting-description">
Enable or disable the series view mode for displaying series information.
</p>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -1,14 +1,8 @@
.main-container { .main-container {
width: 100%; width: 100%;
padding: 1rem;
overflow-y: auto; overflow-y: auto;
} }
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header { .settings-header {
margin-top: 1.25rem; margin-top: 1.25rem;
margin-bottom: 1rem; margin-bottom: 1rem;
@@ -36,42 +30,98 @@
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.section-body {
padding-left: 1rem;
> .setting-item {
margin-bottom: 0.75rem;
}
}
.settings-content { .settings-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 2rem; gap: 2rem;
} }
.preferences-section { .section-header {
@media (min-width: 768px) { margin-bottom: 1rem;
padding: 0 1rem; padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
} }
} }
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.settings-card { .settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1.5rem; gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
} }
.setting-item { .setting-item {
display: flex; display: flex;
align-items: flex-start; flex-direction: column;
gap: 2rem; gap: 0.5rem;
padding: 0.25rem 0; padding-bottom: 1rem;
border-bottom: 1px solid var(--p-content-border-color);
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
padding-bottom: 0; padding-bottom: 0;
} }
&.setting-item-indented {
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 3px solid var(--primary-color);
border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative;
&::before {
display: none;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
&.setting-item-indented {
margin-left: 0;
padding: 0.625rem 0.625rem 0.5rem 0.625rem;
}
} }
} }
@@ -80,47 +130,46 @@
min-width: 0; min-width: 0;
.setting-label { .setting-label {
display: flex; display: block;
align-items: center;
gap: 0.5rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
letter-spacing: -0.01em;
} }
.setting-label-row { .setting-label-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1rem; gap: 0.75rem;
margin-bottom: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
.setting-label { .setting-label {
margin-bottom: 0; margin-bottom: 0;
flex-shrink: 0; flex-shrink: 0;
min-width: 150px; font-size: 0.9375rem;
color: var(--text-color-secondary);
} }
} }
.setting-description { .setting-description {
display: flex;
align-items: flex-start;
gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
}
}
.setting-control { .pi {
margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
display: flex; font-size: 0.875rem;
flex-direction: column; }
gap: 0.75rem;
align-items: flex-end;
@media (max-width: 768px) { .pi-info-circle {
align-items: flex-start; color: var(--primary-color);
width: 100%; }
} }
} }
@@ -1,5 +1,4 @@
import {Component, inject, OnDestroy, OnInit} from '@angular/core'; import {Component, inject, OnDestroy, OnInit} from '@angular/core';
import {Tooltip} from 'primeng/tooltip';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {UserService} from '../../user-management/user.service'; import {UserService} from '../../user-management/user.service';
import {MessageService} from 'primeng/api'; import {MessageService} from 'primeng/api';
@@ -9,7 +8,6 @@ import {Subject} from 'rxjs';
@Component({ @Component({
selector: 'app-meta-center-view-mode-component', selector: 'app-meta-center-view-mode-component',
imports: [ imports: [
Tooltip,
FormsModule FormsModule
], ],
templateUrl: './meta-center-view-mode-component.html', templateUrl: './meta-center-view-mode-component.html',
@@ -1,23 +1,26 @@
<div class="main-container enclosing-container"> <div class="settings-card">
<div class="settings-header"> <div class="section-header">
<h2 class="settings-title"> <h3 class="section-title">
<i class="pi pi-sort-alt"></i> <i class="pi pi-sort-alt"></i>
Sidebar Library and Shelf Sorting Preference Sidebar Library and Shelf Sorting Preference
</h2> </h3>
<p class="settings-description"> <p class="section-description">
Configure sorting options for your library and shelves names shown in the left menu sidebar. Configure sorting options for your library and shelves names shown in the left menu sidebar.
</p> </p>
</div> </div>
<div class="settings-content"> <div class="section-body">
<div class="preferences-section">
<div class="settings-card">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Library</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose how library names are sorted and displayed in the sidebar.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Library
</label>
<p-select <p-select
size="small" size="small"
[options]="sortingOptions" [options]="sortingOptions"
@@ -27,18 +30,21 @@
placeholder="Select Sorting"> placeholder="Select Sorting">
</p-select> </p-select>
</div> </div>
<p class="setting-description"> </div>
Choose how library names are sorted and displayed in the sidebar.
</p>
</div> </div>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Shelf</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose how shelf names are sorted and displayed in the sidebar.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Shelf
</label>
<p-select <p-select
size="small" size="small"
[options]="sortingOptions" [options]="sortingOptions"
@@ -48,18 +54,21 @@
placeholder="Select Sorting"> placeholder="Select Sorting">
</p-select> </p-select>
</div> </div>
<p class="setting-description"> </div>
Choose how shelf names are sorted and displayed in the sidebar.
</p>
</div> </div>
</div> </div>
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<label class="setting-label">Magic Shelf</label>
<p class="setting-description">
<i class="pi pi-info-circle"></i>
<span>Choose how magic shelf names are sorted and displayed in the sidebar.</span>
</p>
</div>
<div class="setting-item setting-item-indented">
<div class="setting-info"> <div class="setting-info">
<div class="setting-label-row"> <div class="setting-label-row">
<label class="setting-label">
Magic Shelf
</label>
<p-select <p-select
size="small" size="small"
[options]="sortingOptions" [options]="sortingOptions"
@@ -69,10 +78,6 @@
placeholder="Select Sorting"> placeholder="Select Sorting">
</p-select> </p-select>
</div> </div>
<p class="setting-description">
Choose how magic shelf names are sorted and displayed in the sidebar.
</p>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -1,14 +1,8 @@
.main-container { .main-container {
width: 100%; width: 100%;
padding: 1rem;
overflow-y: auto; overflow-y: auto;
} }
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header { .settings-header {
margin-top: 1.25rem; margin-top: 1.25rem;
margin-bottom: 1rem; margin-bottom: 1rem;
@@ -42,36 +36,93 @@
gap: 2rem; gap: 2rem;
} }
.preferences-section { .section-header {
@media (min-width: 768px) { margin-bottom: 1rem;
padding: 0 1rem; padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
}
.section-body {
padding-left: 1rem;
> .setting-item {
margin-bottom: 0.75rem;
} }
} }
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.25rem;
font-weight: 600;
color: var(--text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--primary-color);
font-size: 1.125rem;
}
}
.section-description {
font-size: 0.875rem;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0;
}
.settings-card { .settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
} }
.setting-item { .setting-item {
display: flex; display: flex;
align-items: flex-start; flex-direction: column;
gap: 2rem; gap: 0.5rem;
padding: 0.25rem 0; padding-bottom: 1rem;
border-bottom: 1px solid var(--p-content-border-color);
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
padding-bottom: 0; padding-bottom: 0;
} }
&.setting-item-indented {
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 3px solid var(--primary-color);
border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative;
&::before {
display: none;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
&.setting-item-indented {
margin-left: 0;
padding: 0.625rem 0.625rem 0.5rem 0.625rem;
}
} }
} }
@@ -80,54 +131,53 @@
min-width: 0; min-width: 0;
.setting-label { .setting-label {
display: flex; display: block;
align-items: center;
gap: 0.5rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
letter-spacing: -0.01em;
} }
.setting-label-row { .setting-label-row {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1rem; gap: 0.75rem;
margin-bottom: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
.setting-label { .setting-label {
margin-bottom: 0; margin-bottom: 0;
flex-shrink: 0; flex-shrink: 0;
min-width: 120px; font-size: 0.9375rem;
color: var(--text-color-secondary);
} }
p-select { p-select {
min-width: 200px; min-width: 200px;
@media (max-width: 768px) { @media (max-width: 768px) {
min-width: 180px; min-width: 100%;
} }
} }
} }
.setting-description { .setting-description {
display: flex;
align-items: flex-start;
gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0;
}
}
.setting-control { .pi {
margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
display: flex; font-size: 0.875rem;
flex-direction: column; }
gap: 0.75rem;
align-items: flex-end;
@media (max-width: 768px) { .pi-info-circle {
align-items: flex-start; color: var(--primary-color);
width: 100%; }
} }
} }
@@ -1,18 +1,9 @@
<div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto border rounded-lg enclosing-container"> <div class="w-full h-[calc(100dvh-10.5rem)] md:h-[calc(100dvh-11.65rem)] overflow-y-auto">
<app-view-preferences></app-view-preferences> <app-view-preferences></app-view-preferences>
<div class="pt-8"> <div class="pt-10"><hr></div>
<p-divider></p-divider>
</div>
<app-filter-preferences></app-filter-preferences> <app-filter-preferences></app-filter-preferences>
<div class="pt-8"> <div class="pt-10"><hr></div>
<p-divider></p-divider>
</div>
<app-sidebar-sorting-preferences></app-sidebar-sorting-preferences> <app-sidebar-sorting-preferences></app-sidebar-sorting-preferences>
<div class="pt-8"> <div class="pt-10"><hr></div>
<p-divider></p-divider>
</div>
<app-meta-center-view-mode-component></app-meta-center-view-mode-component> <app-meta-center-view-mode-component></app-meta-center-view-mode-component>
<div class="pt-8">
<p-divider></p-divider>
</div>
</div> </div>
@@ -1,5 +1,4 @@
import {Component} from '@angular/core'; import {Component} from '@angular/core';
import {Divider} from 'primeng/divider';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {TableModule} from 'primeng/table'; import {TableModule} from 'primeng/table';
import {ToastModule} from 'primeng/toast'; import {ToastModule} from 'primeng/toast';
@@ -12,7 +11,6 @@ import {FilterPreferencesComponent} from './filter-preferences/filter-preference
selector: 'app-view-preferences-parent', selector: 'app-view-preferences-parent',
standalone: true, standalone: true,
imports: [ imports: [
Divider,
FormsModule, FormsModule,
TableModule, TableModule,
ToastModule, ToastModule,
@@ -1,94 +1,50 @@
<div class="main-container enclosing-container"> <div class="settings-card">
<div class="settings-header"> <div class="section-header">
<h2 class="settings-title"> <h3 class="section-title">
<i class="pi pi-table"></i> <i class="pi pi-table"></i>
Library and Shelf View & Sort Preferences Library and Shelf View & Sort Preferences
</h2> </h3>
<p class="settings-description"> <p class="section-description">
Configure default and per-library/shelf preferences for sorting and view mode (grid or table) in the browser. Configure default and per-library/shelf preferences for sorting and view mode (grid or table) in the browser.
</p> </p>
</div> </div>
<div class="settings-content"> <div class="section-body">
<div class="preferences-section">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-cog"></i>
Default Settings
</h3>
<p class="section-description">
Set the default sorting and view preferences that will apply to all libraries and shelves unless overridden.
</p>
</div>
<div class="settings-card">
<div class="setting-item"> <div class="setting-item">
<div class="setting-info">
<div class="setting-label-row">
<label class="setting-label">Default Preferences</label> <label class="setting-label">Default Preferences</label>
<div class="select-group">
<p-select size="small" [options]="sortOptions" optionLabel="label" optionValue="field"
[(ngModel)]="selectedSort" placeholder="Sort By" class="select-item" appendTo="body"></p-select>
<p-select size="small" [options]="sortDirectionOptions" [(ngModel)]="selectedSortDir"
placeholder="Direction" class="select-item" appendTo="body"></p-select>
<p-select size="small" [options]="viewModeOptions" [(ngModel)]="selectedView"
placeholder="View Mode" class="select-item" appendTo="body"></p-select>
</div>
</div>
<p class="setting-description"> <p class="setting-description">
Configure the default sorting field, direction, and view mode for all libraries and shelves. <i class="pi pi-info-circle"></i>
<span>Configure the default sorting field, direction, and view mode for all libraries and shelves.</span>
</p> </p>
</div> <div class="setting-controls">
</div> <p-select size="small" [options]="sortOptions" optionLabel="label" optionValue="field"
[(ngModel)]="selectedSort" placeholder="Sort By" appendTo="body"></p-select>
<p-select size="small" [options]="sortDirectionOptions" [(ngModel)]="selectedSortDir"
placeholder="Direction" appendTo="body"></p-select>
<p-select size="small" [options]="viewModeOptions" [(ngModel)]="selectedView"
placeholder="View Mode" appendTo="body"></p-select>
</div> </div>
</div> </div>
<div class="preferences-section"> <div class="setting-item">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-pencil"></i>
Metadata Editor Settings
</h3>
<p class="section-description">
Configure behavior for the metadata editor.
</p>
</div>
<div class="settings-card">
<div class="setting-item no-border">
<div class="setting-info">
<label class="setting-label">Auto-save on Navigation</label> <label class="setting-label">Auto-save on Navigation</label>
<p class="setting-description"> <p class="setting-description">
Automatically save changes when navigating to the next or previous book in the metadata editor. <i class="pi pi-info-circle"></i>
<span>Automatically save changes when navigating to the next or previous book in the metadata editor.</span>
</p> </p>
</div> <div class="setting-controls">
<div class="setting-control"> <label class="control-label">Enabled:</label>
<p-toggleswitch [(ngModel)]="autoSaveMetadata"></p-toggleswitch> <p-toggleswitch [(ngModel)]="autoSaveMetadata"></p-toggleswitch>
</div> </div>
</div> </div>
</div>
</div>
<div class="preferences-section"> <div class="setting-item">
<div class="section-header">
<h3 class="section-title">
<i class="pi pi-list"></i>
Specific Overrides
</h3>
<p class="section-description">
Create specific sorting and view preferences for individual libraries or shelves that override the default settings.
</p>
</div>
<div class="settings-card">
<div class="setting-item no-border">
<div class="setting-info">
<label class="setting-label">Override Management</label> <label class="setting-label">Override Management</label>
<p class="setting-description"> <p class="setting-description">
Add custom preferences for specific libraries or shelves. These will override your default settings. <i class="pi pi-info-circle"></i>
<span>Add custom preferences for specific libraries or shelves. These will override your default settings.</span>
</p> </p>
</div> <div class="setting-controls">
<div class="setting-control">
<p-button label="Add Override" outlined size="small" (onClick)="addOverride()" <p-button label="Add Override" outlined size="small" (onClick)="addOverride()"
severity="success" icon="pi pi-plus" [disabled]="availableLibraries.length === 0"></p-button> severity="success" icon="pi pi-plus" [disabled]="availableLibraries.length === 0"></p-button>
</div> </div>
@@ -143,11 +99,9 @@
</p-table> </p-table>
</div> </div>
} }
</div>
</div>
<div class="save-section"> <div class="save-section">
<p-button label="Save Settings" icon="pi pi-save" severity="success" (onClick)="saveSettings()"></p-button> <p-button label="Save Settings" icon="pi pi-save" outlined severity="success" (onClick)="saveSettings()"></p-button>
</div> </div>
</div> </div>
</div> </div>
@@ -1,197 +1,139 @@
.main-container {
width: 100%;
padding: 1rem;
overflow-y: auto;
}
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header {
margin-top: 1rem;
margin-bottom: 2rem;
}
.settings-title {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.25rem;
font-weight: 700;
color: var(--p-text-color);
margin: 0 0 0.75rem 0;
.pi {
color: var(--p-primary-color);
font-size: 1.25rem;
}
}
.settings-description {
color: var(--p-text-muted-color);
font-size: 0.875rem;
line-height: 1.5;
margin-bottom: 1rem;
}
.settings-content {
display: flex;
flex-direction: column;
gap: 2rem;
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 1rem;
}
}
.section-header { .section-header {
margin-bottom: 1rem; margin-bottom: 1rem;
padding-bottom: 0.5rem;
border-bottom: var(--card-border);
border-bottom-color: var(--p-content-border-color);
} }
.section-title { .section-title {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
font-size: 1.125rem; font-size: 1.25rem;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
margin: 0 0 0.5rem 0; margin: 0 0 0.5rem 0;
.pi { .pi {
color: var(--p-primary-color); color: var(--primary-color);
font-size: 1.125rem;
} }
} }
.section-description { .section-description {
display: flex;
align-items: flex-start;
gap: 0.5rem;
color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0; margin: 0;
.pi {
color: var(--p-primary-color);
margin-top: 0.125rem;
flex-shrink: 0;
}
} }
.settings-card { .settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1rem; gap: 1rem;
background: var(--card-background);
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
padding: 1.5rem;
@media (max-width: 768px) {
padding: 0.75rem;
gap: 0.875rem;
}
}
.section-body {
padding-left: 1rem;
> .setting-item {
margin-bottom: 0.75rem;
}
} }
.setting-item { .setting-item {
display: flex; padding-bottom: 1rem;
align-items: flex-start; border-bottom: 1px solid var(--p-content-border-color);
gap: 2rem;
padding: 0.25rem 0;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
padding-bottom: 0; padding-bottom: 0;
} }
&.no-border { &.setting-item-indented {
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem 0.75rem 0.625rem 0.75rem;
border-left: 3px solid var(--primary-color);
border-bottom: none; border-bottom: none;
background: var(--p-surface-800);
border-radius: 6px;
position: relative;
&::before {
display: none;
}
} }
@media (max-width: 768px) { @media (max-width: 768px) {
flex-direction: column; gap: 0.5rem;
gap: 1rem;
}
}
.setting-info { &.setting-item-indented {
flex: 1; margin-left: 0;
min-width: 0; padding: 0.625rem 0.625rem 0.5rem 0.625rem;
}
}
.setting-label { .setting-label {
display: block; display: block;
font-weight: 600; font-weight: 600;
color: var(--p-text-color); color: var(--text-color);
font-size: 1rem; font-size: 1rem;
margin-bottom: 0.5rem; margin-bottom: 0.375rem;
} letter-spacing: -0.01em;
.setting-label-row {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 0.5rem;
flex-wrap: wrap;
.setting-label {
margin-bottom: 0;
flex-shrink: 0;
min-width: 180px;
}
.select-group {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
@media (max-width: 768px) {
flex-direction: column;
gap: 0.5rem;
width: 100%;
}
.select-item {
min-width: 140px;
@media (max-width: 768px) {
min-width: 100%;
}
}
}
} }
.setting-description { .setting-description {
display: flex;
align-items: flex-start;
gap: 0.375rem;
color: var(--p-text-muted-color); color: var(--p-text-muted-color);
font-size: 0.875rem; font-size: 0.875rem;
line-height: 1.5; line-height: 1.5;
margin: 0; margin: 0 0 0.5rem 0;
}
}
.setting-control { .pi {
margin-top: 0.125rem;
flex-shrink: 0; flex-shrink: 0;
display: flex; font-size: 0.875rem;
flex-direction: column; color: var(--primary-color);
gap: 0.75rem;
align-items: flex-end;
@media (max-width: 768px) {
align-items: flex-start;
width: 100%;
} }
} }
.select-group { .setting-controls {
display: flex; display: flex;
align-items: center;
gap: 0.5rem; gap: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
margin-top: 0.5rem;
margin-left: 0;
padding: 0.75rem;
border-left: 3px solid var(--primary-color);
background: var(--p-surface-800);
border-radius: 6px;
@media (max-width: 768px) { @media (max-width: 768px) {
padding: 0.625rem;
flex-direction: column; flex-direction: column;
gap: 0.5rem; align-items: stretch;
width: 100%;
} }
.select-item { .control-label {
font-size: 0.9375rem;
color: var(--text-color-secondary);
font-weight: 600;
}
p-select {
min-width: 140px; min-width: 140px;
@media (max-width: 768px) { @media (max-width: 768px) {
@@ -199,6 +141,7 @@
} }
} }
} }
}
.overrides-table { .overrides-table {
width: 100%; width: 100%;
@@ -239,5 +182,5 @@
.save-section { .save-section {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
padding: 0 1rem; padding-top: 0.5rem;
} }
@@ -158,6 +158,26 @@ export interface AppSettings {
coverCroppingSettings: CoverCroppingSettings; coverCroppingSettings: CoverCroppingSettings;
metadataDownloadOnBookdrop: boolean; metadataDownloadOnBookdrop: boolean;
telemetryEnabled: boolean; telemetryEnabled: boolean;
metadataProviderSpecificFields: MetadataProviderSpecificFields;
}
export interface MetadataProviderSpecificFields {
asin: boolean;
amazonRating: boolean;
amazonReviewCount: boolean;
googleId: boolean;
goodreadsId: boolean;
goodreadsRating: boolean;
goodreadsReviewCount: boolean;
hardcoverId: boolean;
hardcoverBookId: boolean;
hardcoverRating: boolean;
hardcoverReviewCount: boolean;
comicvineId: boolean;
lubimyczytacId: boolean;
lubimyczytacRating: boolean;
ranobedbId: boolean;
ranobedbRating: boolean;
} }
export enum AppSettingKey { export enum AppSettingKey {
@@ -179,4 +199,5 @@ export enum AppSettingKey {
KOBO_SETTINGS = 'KOBO_SETTINGS', KOBO_SETTINGS = 'KOBO_SETTINGS',
COVER_CROPPING_SETTINGS = 'COVER_CROPPING_SETTINGS', COVER_CROPPING_SETTINGS = 'COVER_CROPPING_SETTINGS',
TELEMETRY_ENABLED = 'TELEMETRY_ENABLED', TELEMETRY_ENABLED = 'TELEMETRY_ENABLED',
METADATA_PROVIDER_SPECIFIC_FIELDS = 'METADATA_PROVIDER_SPECIFIC_FIELDS',
} }
@@ -105,7 +105,25 @@ describe('AppSettingsService', () => {
smartCroppingEnabled: false smartCroppingEnabled: false
}, },
metadataDownloadOnBookdrop: false, metadataDownloadOnBookdrop: false,
telemetryEnabled: false telemetryEnabled: false,
metadataProviderSpecificFields: {
asin: false,
amazonRating: false,
amazonReviewCount: false,
googleId: false,
goodreadsId: false,
goodreadsRating: false,
goodreadsReviewCount: false,
hardcoverId: false,
hardcoverBookId: false,
hardcoverRating: false,
hardcoverReviewCount: false,
comicvineId: false,
lubimyczytacId: false,
lubimyczytacRating: false,
ranobedbId: false,
ranobedbRating: false
}
}; };
const mockPublicSettings: PublicAppSettings = { const mockPublicSettings: PublicAppSettings = {
@@ -457,7 +475,25 @@ describe('AppSettingsService - API Contract Tests', () => {
smartCroppingEnabled: false smartCroppingEnabled: false
}, },
metadataDownloadOnBookdrop: false, metadataDownloadOnBookdrop: false,
telemetryEnabled: false telemetryEnabled: false,
metadataProviderSpecificFields: {
asin: false,
amazonRating: false,
amazonReviewCount: false,
googleId: false,
goodreadsId: false,
goodreadsRating: false,
goodreadsReviewCount: false,
hardcoverId: false,
hardcoverBookId: false,
hardcoverRating: false,
hardcoverReviewCount: false,
comicvineId: false,
lubimyczytacId: false,
lubimyczytacRating: false,
ranobedbId: false,
ranobedbRating: false
}
}; };
httpClientMock.get.mockReturnValue(of(mockSettings)); httpClientMock.get.mockReturnValue(of(mockSettings));
service['fetchAppSettings']().subscribe(settings => { service['fetchAppSettings']().subscribe(settings => {
@@ -1,7 +1,7 @@
import {inject, Injectable, Injector} from '@angular/core'; import {inject, Injectable, Injector} from '@angular/core';
import {HttpClient} from '@angular/common/http'; import {HttpClient} from '@angular/common/http';
import {BehaviorSubject, Observable, of} from 'rxjs'; import {BehaviorSubject, Observable, of} from 'rxjs';
import {catchError, finalize, shareReplay, tap} from 'rxjs/operators'; import {catchError, finalize, map, shareReplay, switchMap, tap} from 'rxjs/operators';
import {API_CONFIG} from '../../core/config/api-config'; import {API_CONFIG} from '../../core/config/api-config';
import {AppSettings, OidcProviderDetails} from '../model/app-settings.model'; import {AppSettings, OidcProviderDetails} from '../model/app-settings.model';
import {AuthService} from './auth.service'; import {AuthService} from './auth.service';
@@ -99,20 +99,8 @@ export class AppSettingsService {
})); }));
return this.http.put<void>(this.apiUrl, payload).pipe( return this.http.put<void>(this.apiUrl, payload).pipe(
tap(() => { switchMap(() => this.fetchAppSettings()),
const current = this.appSettingsSubject.value; map(() => void 0),
if (current) {
settings.forEach(s => (current as any)[s.key] = s.newValue);
this.appSettingsSubject.next({...current});
this.syncPublicSettings(current);
} else {
this.loading$ = this.fetchAppSettings().pipe(
shareReplay(1),
finalize(() => (this.loading$ = null))
);
this.loading$.subscribe();
}
}),
catchError(err => { catchError(err => {
console.error('Error saving settings:', err); console.error('Error saving settings:', err);
return of(); return of();
@@ -25,3 +25,4 @@
/* Code, Mark & Selection */ /* Code, Mark & Selection */
--code-background: var(--p-surface-900); --code-background: var(--p-surface-900);
} }