Include physical books in the Book Type filter (#3205)
This commit is contained in:
+2
-1
@@ -203,7 +203,7 @@ export const FILTER_EXTRACTORS: Readonly<Record<Exclude<FilterType, 'library'>,
|
|||||||
author: (book) => extractStringsAsFilters(book.metadata?.authors),
|
author: (book) => extractStringsAsFilters(book.metadata?.authors),
|
||||||
category: (book) => extractStringsAsFilters(book.metadata?.categories),
|
category: (book) => extractStringsAsFilters(book.metadata?.categories),
|
||||||
series: (book) => extractSingleString(book.metadata?.seriesName?.trim()),
|
series: (book) => extractSingleString(book.metadata?.seriesName?.trim()),
|
||||||
bookType: (book) => extractSingleString(book.primaryFile?.bookType),
|
bookType: (book) => book.isPhysical ? [{id: 'PHYSICAL', name: 'PHYSICAL'}] : extractSingleString(book.primaryFile?.bookType),
|
||||||
readStatus: (book) => {
|
readStatus: (book) => {
|
||||||
const status = book.readStatus ?? ReadStatus.UNSET;
|
const status = book.readStatus ?? ReadStatus.UNSET;
|
||||||
const validStatus = status in READ_STATUS_LABELS ? status : ReadStatus.UNSET;
|
const validStatus = status in READ_STATUS_LABELS ? status : ReadStatus.UNSET;
|
||||||
@@ -325,6 +325,7 @@ export const SHELF_STATUS_LABEL_KEYS: Readonly<Record<string, string>> = {
|
|||||||
'unshelved': 'book.filter.shelfStatus.unshelved'
|
'unshelved': 'book.filter.shelfStatus.unshelved'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const COMIC_ROLE_LABEL_KEYS: Readonly<Record<string, string>> = {
|
export const COMIC_ROLE_LABEL_KEYS: Readonly<Record<string, string>> = {
|
||||||
penciller: 'book.filter.comicRoles.penciller',
|
penciller: 'book.filter.comicRoles.penciller',
|
||||||
inker: 'book.filter.comicRoles.inker',
|
inker: 'book.filter.comicRoles.inker',
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export function doesBookMatchFilter(
|
|||||||
? filterValues.some(val => book.metadata?.seriesName?.trim() === val)
|
? filterValues.some(val => book.metadata?.seriesName?.trim() === val)
|
||||||
: filterValues.every(val => book.metadata?.seriesName?.trim() === val);
|
: filterValues.every(val => book.metadata?.seriesName?.trim() === val);
|
||||||
case 'bookType':
|
case 'bookType':
|
||||||
return filterValues.includes(book.primaryFile?.bookType);
|
return book.isPhysical ? filterValues.includes('PHYSICAL') : filterValues.includes(book.primaryFile?.bookType);
|
||||||
case 'readStatus':
|
case 'readStatus':
|
||||||
return doesBookMatchReadStatus(book, filterValues);
|
return doesBookMatchReadStatus(book, filterValues);
|
||||||
case 'personalRating':
|
case 'personalRating':
|
||||||
|
|||||||
Reference in New Issue
Block a user