Allow metadata fields to be explicitly cleared

This commit is contained in:
aditya.chandel
2025-06-28 14:12:48 -06:00
committed by Aditya Chandel
parent df233d8f95
commit e8cd58cd42
28 changed files with 1044 additions and 612 deletions
@@ -283,7 +283,7 @@ export class BookCardComponent implements OnInit, OnDestroy {
});
} else {
this.dialogService.open(BookMetadataCenterComponent, {
width: '95%',
width: '85%',
data: {bookId: book.id},
modal: true,
dismissableMask: true,
@@ -194,8 +194,8 @@ export class BookFilterComponent implements OnInit, OnDestroy {
.pipe(takeUntil(this.destroy$))
.subscribe(([sortMode]) => {
this.filterStreams = {
author: this.getFilterStream((book: Book) => book.metadata?.authors.map(name => ({id: name, name})) || [], 'id', 'name', sortMode),
category: this.getFilterStream((book: Book) => book.metadata?.categories.map(name => ({id: name, name})) || [], 'id', 'name', sortMode),
author: this.getFilterStream((book: Book) => book.metadata?.authors!.map(name => ({id: name, name})) || [], 'id', 'name', sortMode),
category: this.getFilterStream((book: Book) => book.metadata?.categories!.map(name => ({id: name, name})) || [], 'id', 'name', sortMode),
series: this.getFilterStream((book) => (book.metadata?.seriesName ? [{id: book.metadata.seriesName, name: book.metadata.seriesName}] : []), 'id', 'name', sortMode),
publisher: this.getFilterStream((book) => (book.metadata?.publisher ? [{id: book.metadata.publisher, name: book.metadata.publisher}] : []), 'id', 'name', sortMode),
readStatus: this.getFilterStream((book: Book) => [{id: book.readStatus ?? ReadStatus.UNREAD, name: getReadStatusName(book.readStatus)}], 'id', 'name', sortMode),
@@ -15,7 +15,7 @@ export class HeaderFilter implements BookFilter {
const filteredBooks = bookState.books?.filter(book => {
const matchesTitle = book.metadata?.title?.toLowerCase().includes(term.toLowerCase());
const matchesSeries = book.metadata?.seriesName?.toLowerCase().includes(term.toLowerCase());
const matchesAuthor = book.metadata?.authors.some(author =>
const matchesAuthor = book.metadata?.authors?.some(author =>
author.toLowerCase().includes(term.toLowerCase())
);
return matchesTitle || matchesSeries || matchesAuthor;
@@ -26,8 +26,8 @@
@if (backupMetadata.subtitle) {
<div><strong>Subtitle:</strong> {{ backupMetadata.subtitle }}</div>
}
@if (backupMetadata.authors.length) {
<div><strong>Authors:</strong> {{ backupMetadata.authors.join(', ') }}</div>
@if (backupMetadata.authors!.length) {
<div><strong>Authors:</strong> {{ backupMetadata.authors!.join(', ') }}</div>
}
@if (backupMetadata.publisher) {
<div><strong>Publisher:</strong> {{ backupMetadata.publisher }}</div>