fix(filter): add missing filters for: Lubimyczytac, RanobeDB, and Audible ratings, comic specific metadata fields (#647)
This commit is contained in:
@@ -27,6 +27,9 @@ public record AppFilterOptions(
|
||||
List<CountedOption> amazonRatings,
|
||||
List<CountedOption> goodreadsRatings,
|
||||
List<CountedOption> hardcoverRatings,
|
||||
List<CountedOption> lubimyczytacRatings,
|
||||
List<CountedOption> ranobedbRatings,
|
||||
List<CountedOption> audibleRatings,
|
||||
List<CountedOption> pageCounts,
|
||||
List<CountedOption> shelfStatuses,
|
||||
List<CountedOption> comicCharacters,
|
||||
|
||||
@@ -33,6 +33,9 @@ public record BookListRequest(
|
||||
@Size(max = 20) List<String> amazonRating,
|
||||
@Size(max = 20) List<String> goodreadsRating,
|
||||
@Size(max = 20) List<String> hardcoverRating,
|
||||
@Size(max = 20) List<String> lubimyczytacRating,
|
||||
@Size(max = 20) List<String> ranobedbRating,
|
||||
@Size(max = 20) List<String> audibleRating,
|
||||
@Size(max = 20) List<String> pageCount,
|
||||
@Size(max = 20) List<String> shelfStatus,
|
||||
@Size(max = 20) List<String> comicCharacter,
|
||||
|
||||
@@ -585,6 +585,9 @@ public class AppBookService {
|
||||
List<AppFilterOptions.CountedOption> amazonRatings = queryRatingBuckets("m.amazonRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> goodreadsRatings = queryRatingBuckets("m.goodreadsRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> hardcoverRatings = queryRatingBuckets("m.hardcoverRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> lubimyczytacRatings = queryRatingBuckets("m.lubimyczytacRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> ranobedbRatings = queryRatingBuckets("m.ranobedbRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
List<AppFilterOptions.CountedOption> audibleRatings = queryRatingBuckets("m.audibleRating", scopeClause, accessibleLibraryIds, libraryId, shelfId, magicBookIds);
|
||||
|
||||
List<AppFilterOptions.CountedOption> pageCounts = queryGroupedCount(
|
||||
"CASE " +
|
||||
@@ -663,6 +666,9 @@ public class AppBookService {
|
||||
.amazonRatings(amazonRatings)
|
||||
.goodreadsRatings(goodreadsRatings)
|
||||
.hardcoverRatings(hardcoverRatings)
|
||||
.lubimyczytacRatings(lubimyczytacRatings)
|
||||
.ranobedbRatings(ranobedbRatings)
|
||||
.audibleRatings(audibleRatings)
|
||||
.pageCounts(pageCounts)
|
||||
.shelfStatuses(shelfStatuses)
|
||||
.comicCharacters(comicCharacters)
|
||||
@@ -697,6 +703,9 @@ public class AppBookService {
|
||||
.amazonRatings(Collections.emptyList())
|
||||
.goodreadsRatings(Collections.emptyList())
|
||||
.hardcoverRatings(Collections.emptyList())
|
||||
.lubimyczytacRatings(Collections.emptyList())
|
||||
.ranobedbRatings(Collections.emptyList())
|
||||
.audibleRatings(Collections.emptyList())
|
||||
.pageCounts(Collections.emptyList())
|
||||
.shelfStatuses(Collections.emptyList())
|
||||
.comicCharacters(Collections.emptyList())
|
||||
@@ -958,6 +967,27 @@ public class AppBookService {
|
||||
}
|
||||
}
|
||||
|
||||
if (req.lubimyczytacRating() != null && !req.lubimyczytacRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.lubimyczytacRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withLubimyczytacRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.ranobedbRating() != null && !req.ranobedbRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.ranobedbRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withRanobedbRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.audibleRating() != null && !req.audibleRating().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.audibleRating());
|
||||
if (!cleaned.isEmpty()) {
|
||||
specs.add(AppBookSpecification.withAudibleRatings(cleaned, req.effectiveFilterMode()));
|
||||
}
|
||||
}
|
||||
|
||||
if (req.pageCount() != null && !req.pageCount().isEmpty()) {
|
||||
List<String> cleaned = BookListRequest.cleanValues(req.pageCount());
|
||||
if (!cleaned.isEmpty()) {
|
||||
|
||||
@@ -675,6 +675,18 @@ public class AppBookSpecification {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "hardcoverRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withLubimyczytacRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "lubimyczytacRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withRanobedbRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "ranobedbRating");
|
||||
}
|
||||
|
||||
public static Specification<BookEntity> withAudibleRatings(List<String> rangeIds, String mode) {
|
||||
return buildRatingRangeSpec(rangeIds, mode, "audibleRating");
|
||||
}
|
||||
|
||||
private static Specification<BookEntity> buildRatingRangeSpec(
|
||||
List<String> rangeIds, String mode, String fieldName) {
|
||||
return (root, query, cb) -> {
|
||||
|
||||
+37
-39
@@ -17,48 +17,46 @@
|
||||
<div class="filter-content">
|
||||
<p-accordion [value]="expandedPanels()" [multiple]="true" (valueChange)="onExpandedPanelsChange($event)">
|
||||
@for (filterType of visibleFilterTypes(); track filterType; let i = $index) {
|
||||
<p-accordion-panel [value]="i">
|
||||
<p-accordion-header>
|
||||
<span class="filter-type-label">
|
||||
<span class="filter-label-text">
|
||||
{{ getFilterLabel(filterType) }}
|
||||
</span>
|
||||
@if (activeFilters()[filterType]?.length; as count) {
|
||||
<span class="active-filter-count">
|
||||
({{ count }})
|
||||
@if (filterSignals[filterType]().length > 0 || activeFilters()[filterType]?.length) {
|
||||
<p-accordion-panel [value]="i">
|
||||
<p-accordion-header>
|
||||
<span class="filter-type-label">
|
||||
<span class="filter-label-text">
|
||||
{{ getFilterLabel(filterType) }}
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
</p-accordion-header>
|
||||
|
||||
<p-accordion-content>
|
||||
@if (expandedPanels().includes(i)) {
|
||||
@if (filterSignals[filterType](); as filters) {
|
||||
@if (filters.length > 0) {
|
||||
<cdk-virtual-scroll-viewport
|
||||
[itemSize]="28"
|
||||
[style.height.px]="getVirtualScrollHeight(filters.length)"
|
||||
class="filter-list">
|
||||
<div
|
||||
*cdkVirtualFor="let filter of filters; trackBy: trackByFilter"
|
||||
class="filter-row"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
[ngClass]="{
|
||||
'active': isActive(filterType, getFilterValueId(filter)),
|
||||
'active-not': isActive(filterType, getFilterValueId(filter)) && selectedFilterMode() === 'not'
|
||||
}"
|
||||
(click)="handleFilterClick(filterType, getFilterValueId(filter))"
|
||||
(keydown.enter)="handleFilterClick(filterType, getFilterValueId(filter))">
|
||||
<span class="filter-value-text">{{ getFilterValueDisplay(filter) }}</span>
|
||||
<p-badge class="filter-value-badge" [value]="filter.bookCount"></p-badge>
|
||||
</div>
|
||||
</cdk-virtual-scroll-viewport>
|
||||
@if (activeFilters()[filterType]?.length; as count) {
|
||||
<span class="active-filter-count">
|
||||
({{ count }})
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
</p-accordion-header>
|
||||
|
||||
<p-accordion-content>
|
||||
@if (expandedPanels().includes(i)) {
|
||||
<cdk-virtual-scroll-viewport
|
||||
[itemSize]="28"
|
||||
[style.height.px]="getVirtualScrollHeight(filterSignals[filterType]().length)"
|
||||
class="filter-list">
|
||||
<div
|
||||
*cdkVirtualFor="let filter of filterSignals[filterType](); trackBy: trackByFilter"
|
||||
class="filter-row"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
[ngClass]="{
|
||||
'active': isActive(filterType, getFilterValueId(filter)),
|
||||
'active-not': isActive(filterType, getFilterValueId(filter)) && selectedFilterMode() === 'not'
|
||||
}"
|
||||
(click)="handleFilterClick(filterType, getFilterValueId(filter))"
|
||||
(keydown.enter)="handleFilterClick(filterType, getFilterValueId(filter))">
|
||||
<span class="filter-value-text">{{ getFilterValueDisplay(filter) }}</span>
|
||||
<p-badge class="filter-value-badge" [value]="filter.bookCount"></p-badge>
|
||||
</div>
|
||||
</cdk-virtual-scroll-viewport>
|
||||
}
|
||||
}
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
</p-accordion-content>
|
||||
</p-accordion-panel>
|
||||
}
|
||||
}
|
||||
</p-accordion>
|
||||
|
||||
|
||||
+16
-2
@@ -19,7 +19,8 @@ export type FilterType =
|
||||
| 'author' | 'category' | 'series' | 'bookType' | 'readStatus'
|
||||
| 'personalRating' | 'publisher' | 'matchScore' | 'library' | 'shelf'
|
||||
| 'shelfStatus' | 'tag' | 'publishedDate' | 'fileSize' | 'amazonRating'
|
||||
| 'goodreadsRating' | 'hardcoverRating' | 'language' | 'pageCount' | 'mood'
|
||||
| 'goodreadsRating' | 'hardcoverRating' | 'lubimyczytacRating' | 'ranobedbRating'
|
||||
| 'audibleRating' | 'language' | 'pageCount' | 'mood'
|
||||
| 'ageRating' | 'contentRating'
|
||||
| 'narrator'
|
||||
| 'comicCharacter' | 'comicTeam' | 'comicLocation' | 'comicCreator';
|
||||
@@ -133,7 +134,8 @@ export const ageRatingRanges = AGE_RATING_OPTIONS;
|
||||
|
||||
export const NUMERIC_ID_FILTER_TYPES = new Set<FilterType>([
|
||||
'personalRating', 'matchScore', 'fileSize', 'amazonRating',
|
||||
'goodreadsRating', 'hardcoverRating', 'pageCount', 'library', 'shelf',
|
||||
'goodreadsRating', 'hardcoverRating', 'lubimyczytacRating', 'ranobedbRating',
|
||||
'audibleRating', 'pageCount', 'library', 'shelf',
|
||||
'ageRating'
|
||||
]);
|
||||
|
||||
@@ -155,6 +157,9 @@ export const FILTER_LABELS: Readonly<Record<FilterType, string>> = {
|
||||
amazonRating: 'Amazon Rating',
|
||||
goodreadsRating: 'Goodreads Rating',
|
||||
hardcoverRating: 'Hardcover Rating',
|
||||
lubimyczytacRating: 'Lubimyczytac Rating',
|
||||
ranobedbRating: 'RanobeDB Rating',
|
||||
audibleRating: 'Audible Rating',
|
||||
language: 'Language',
|
||||
pageCount: 'Page Count',
|
||||
mood: 'Mood',
|
||||
@@ -223,6 +228,9 @@ export const FILTER_EXTRACTORS: Readonly<Record<Exclude<FilterType, 'library'>,
|
||||
amazonRating: (book) => findInRange(book.metadata?.amazonRating, RATING_RANGES_5),
|
||||
goodreadsRating: (book) => findInRange(book.metadata?.goodreadsRating, RATING_RANGES_5),
|
||||
hardcoverRating: (book) => findInRange(book.metadata?.hardcoverRating, RATING_RANGES_5),
|
||||
lubimyczytacRating: (book) => findInRange(book.metadata?.lubimyczytacRating, RATING_RANGES_5),
|
||||
ranobedbRating: (book) => findInRange(book.metadata?.ranobedbRating, RATING_RANGES_5),
|
||||
audibleRating: (book) => findInRange(book.metadata?.audibleRating, RATING_RANGES_5),
|
||||
language: (book) => extractSingleString(book.metadata?.language),
|
||||
pageCount: (book) => findInRange(book.metadata?.pageCount, PAGE_COUNT_RANGES),
|
||||
mood: (book) => extractStringsAsFilters(book.metadata?.moods),
|
||||
@@ -283,6 +291,9 @@ export const FILTER_LABEL_KEYS: Readonly<Record<FilterType, string>> = {
|
||||
amazonRating: 'book.filter.labels.amazonRating',
|
||||
goodreadsRating: 'book.filter.labels.goodreadsRating',
|
||||
hardcoverRating: 'book.filter.labels.hardcoverRating',
|
||||
lubimyczytacRating: 'book.filter.labels.lubimyczytacRating',
|
||||
ranobedbRating: 'book.filter.labels.ranobedbRating',
|
||||
audibleRating: 'book.filter.labels.audibleRating',
|
||||
language: 'book.filter.labels.language',
|
||||
pageCount: 'book.filter.labels.pageCount',
|
||||
mood: 'book.filter.labels.mood',
|
||||
@@ -347,6 +358,9 @@ export const FILTER_CONFIGS: Readonly<Record<Exclude<FilterType, 'library'>, Omi
|
||||
amazonRating: {label: 'Amazon Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
goodreadsRating: {label: 'Goodreads Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
hardcoverRating: {label: 'Hardcover Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
lubimyczytacRating: {label: 'Lubimyczytac Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
ranobedbRating: {label: 'RanobeDB Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
audibleRating: {label: 'Audible Rating', sortMode: 'sortIndex', isNumericId: true},
|
||||
language: {label: 'Language', sortMode: 'count'},
|
||||
pageCount: {label: 'Page Count', sortMode: 'sortIndex', isNumericId: true},
|
||||
mood: {label: 'Mood', sortMode: 'count'},
|
||||
|
||||
+9
@@ -109,6 +109,9 @@ export class BookFilterService {
|
||||
signals['amazonRating'] = computed(() => this.rangedFilters(this.appBooksApi.amazonRatingOptions(), ratingRanges));
|
||||
signals['goodreadsRating'] = computed(() => this.rangedFilters(this.appBooksApi.goodreadsRatingOptions(), ratingRanges));
|
||||
signals['hardcoverRating'] = computed(() => this.rangedFilters(this.appBooksApi.hardcoverRatingOptions(), ratingRanges));
|
||||
signals['lubimyczytacRating'] = computed(() => this.rangedFilters(this.appBooksApi.lubimyczytacRatingOptions(), ratingRanges));
|
||||
signals['ranobedbRating'] = computed(() => this.rangedFilters(this.appBooksApi.ranobedbRatingOptions(), ratingRanges));
|
||||
signals['audibleRating'] = computed(() => this.rangedFilters(this.appBooksApi.audibleRatingOptions(), ratingRanges));
|
||||
signals['pageCount'] = computed(() => this.rangedFilters(this.appBooksApi.pageCountOptions(), pageCountRanges));
|
||||
signals['shelfStatus'] = computed(() => this.appBooksApi.shelfStatusOptions().map(item => ({
|
||||
value: {id: item.name, name: item.name.charAt(0).toUpperCase() + item.name.slice(1)},
|
||||
@@ -199,6 +202,12 @@ export class BookFilterService {
|
||||
return this.rangedFilters(options.goodreadsRatings, ratingRanges);
|
||||
case 'hardcoverRating':
|
||||
return this.rangedFilters(options.hardcoverRatings, ratingRanges);
|
||||
case 'lubimyczytacRating':
|
||||
return this.rangedFilters(options.lubimyczytacRatings, ratingRanges);
|
||||
case 'ranobedbRating':
|
||||
return this.rangedFilters(options.ranobedbRatings, ratingRanges);
|
||||
case 'audibleRating':
|
||||
return this.rangedFilters(options.audibleRatings, ratingRanges);
|
||||
case 'pageCount':
|
||||
return this.rangedFilters(options.pageCounts, pageCountRanges);
|
||||
case 'shelfStatus':
|
||||
|
||||
@@ -18,7 +18,9 @@ export class FilterLabelHelper {
|
||||
amazonRating: 'Amazon Rating',
|
||||
goodreadsRating: 'Goodreads Rating',
|
||||
hardcoverRating: 'Hardcover Rating',
|
||||
ranobedbRating: 'Ranobedb Rating',
|
||||
lubimyczytacRating: 'Lubimyczytac Rating',
|
||||
ranobedbRating: 'RanobeDB Rating',
|
||||
audibleRating: 'Audible Rating',
|
||||
mood: 'Mood',
|
||||
tag: 'Tag',
|
||||
};
|
||||
@@ -57,7 +59,10 @@ export class FilterLabelHelper {
|
||||
|
||||
case 'amazonrating':
|
||||
case 'goodreadsrating':
|
||||
case 'hardcoverrating': {
|
||||
case 'hardcoverrating':
|
||||
case 'lubimyczytacrating':
|
||||
case 'ranobedbrating':
|
||||
case 'audiblerating': {
|
||||
const ratingRange = ratingRanges.find(r => r.id === numericValue);
|
||||
if (ratingRange) return ratingRange.label;
|
||||
return String(value);
|
||||
|
||||
@@ -121,6 +121,12 @@ export function doesBookMatchFilter(
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.goodreadsRating, range as string | number));
|
||||
case 'hardcoverRating':
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.hardcoverRating, range as string | number));
|
||||
case 'lubimyczytacRating':
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.lubimyczytacRating, range as string | number));
|
||||
case 'ranobedbRating':
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.ranobedbRating, range as string | number));
|
||||
case 'audibleRating':
|
||||
return filterValues.some(range => isRatingInRange(book.metadata?.audibleRating, range as string | number));
|
||||
case 'language':
|
||||
return filterValues.includes(book.metadata?.language);
|
||||
case 'pageCount':
|
||||
|
||||
@@ -53,6 +53,9 @@ export interface AppFilterOptions {
|
||||
amazonRatings: CountedOption[];
|
||||
goodreadsRatings: CountedOption[];
|
||||
hardcoverRatings: CountedOption[];
|
||||
lubimyczytacRatings: CountedOption[];
|
||||
ranobedbRatings: CountedOption[];
|
||||
audibleRatings: CountedOption[];
|
||||
pageCounts: CountedOption[];
|
||||
shelfStatuses: CountedOption[];
|
||||
comicCharacters: CountedOption[];
|
||||
@@ -101,6 +104,9 @@ export interface AppBookFilters {
|
||||
amazonRating?: string[];
|
||||
goodreadsRating?: string[];
|
||||
hardcoverRating?: string[];
|
||||
lubimyczytacRating?: string[];
|
||||
ranobedbRating?: string[];
|
||||
audibleRating?: string[];
|
||||
pageCount?: string[];
|
||||
shelfStatus?: string[];
|
||||
comicCharacter?: string[];
|
||||
|
||||
@@ -109,6 +109,9 @@ export class AppBooksApiService {
|
||||
readonly amazonRatingOptions = computed(() => this._filterOptions()?.amazonRatings ?? []);
|
||||
readonly goodreadsRatingOptions = computed(() => this._filterOptions()?.goodreadsRatings ?? []);
|
||||
readonly hardcoverRatingOptions = computed(() => this._filterOptions()?.hardcoverRatings ?? []);
|
||||
readonly lubimyczytacRatingOptions = computed(() => this._filterOptions()?.lubimyczytacRatings ?? []);
|
||||
readonly ranobedbRatingOptions = computed(() => this._filterOptions()?.ranobedbRatings ?? []);
|
||||
readonly audibleRatingOptions = computed(() => this._filterOptions()?.audibleRatings ?? []);
|
||||
readonly pageCountOptions = computed(() => this._filterOptions()?.pageCounts ?? []);
|
||||
readonly shelfStatusOptions = computed(() => this._filterOptions()?.shelfStatuses ?? []);
|
||||
readonly readStatusOptions = computed(() => this._filterOptions()?.readStatuses ?? []);
|
||||
@@ -199,6 +202,9 @@ export class AppBooksApiService {
|
||||
['amazonRating', filters.amazonRating],
|
||||
['goodreadsRating', filters.goodreadsRating],
|
||||
['hardcoverRating', filters.hardcoverRating],
|
||||
['lubimyczytacRating', filters.lubimyczytacRating],
|
||||
['ranobedbRating', filters.ranobedbRating],
|
||||
['audibleRating', filters.audibleRating],
|
||||
['pageCount', filters.pageCount],
|
||||
['shelfStatus', filters.shelfStatus],
|
||||
['comicCharacter', filters.comicCharacter],
|
||||
|
||||
+17
-1
@@ -371,6 +371,22 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (book?.shelves?.length) {
|
||||
<div class="metadata-item">
|
||||
<span class="metadata-key">{{ t('shelvesLabel') }}</span>
|
||||
<div class="metadata-value-group flex-wrap">
|
||||
@for (shelf of book.shelves; track shelf.id; let isLast = $last) {
|
||||
<span class="metadata-value metadata-link" role="button" tabindex="0" (click)="goToShelf(shelf.id!)" (keydown.enter)="goToShelf(shelf.id!)">
|
||||
{{ shelf.name }}
|
||||
</span>
|
||||
@if (!isLast) {
|
||||
<span class="separator">, </span>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="metadata-item">
|
||||
<span class="metadata-key">{{ t('publisherLabel') }}</span>
|
||||
@if (book?.metadata?.publisher) {
|
||||
@@ -632,7 +648,7 @@
|
||||
<p-button
|
||||
icon="pi pi-chevron-left"
|
||||
[disabled]="!canNavigatePrevious()"
|
||||
(onClick)="navigatePrevious()"`
|
||||
(onClick)="navigatePrevious()"
|
||||
outlined
|
||||
severity="secondary"
|
||||
[pTooltip]="t('goToPreviousBook')"
|
||||
|
||||
+6
@@ -448,6 +448,12 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.separator {
|
||||
color: var(--text-color-secondary);
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.format-tags {
|
||||
|
||||
+32
-19
@@ -18,7 +18,7 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {ProgressBar} from 'primeng/progressbar';
|
||||
import {MetadataRefreshType} from '../../../model/request/metadata-refresh-type.enum';
|
||||
import {Router} from '@angular/router';
|
||||
import {tap} from 'rxjs/operators';
|
||||
import {take, tap} from 'rxjs/operators';
|
||||
import {Menu} from 'primeng/menu';
|
||||
import {ResetProgressType, ResetProgressTypes} from '../../../../../shared/constants/reset-progress-type';
|
||||
import {DatePicker} from 'primeng/datepicker';
|
||||
@@ -87,10 +87,28 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
||||
|
||||
private router = inject(Router);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
private dialogRef?: DynamicDialogRef;
|
||||
private dialogRef = inject(DynamicDialogRef, { optional: true });
|
||||
private userState = this.userService.currentUser;
|
||||
private appSettings = this.appSettingsService.appSettings;
|
||||
|
||||
private navigateAfterDialogClose(navigate: () => void): void {
|
||||
if (this.metadataCenterViewMode !== 'dialog') {
|
||||
navigate();
|
||||
return;
|
||||
}
|
||||
|
||||
const dialogRef = this.dialogRef;
|
||||
if (!dialogRef) {
|
||||
navigate();
|
||||
return;
|
||||
}
|
||||
|
||||
dialogRef.onClose
|
||||
.pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe(navigate);
|
||||
dialogRef.close();
|
||||
}
|
||||
|
||||
readonly readMenuItems = computed<MenuItem[]>(() => {
|
||||
const book = this.currentBook();
|
||||
if (!book) {
|
||||
@@ -780,12 +798,7 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
||||
this.authorService.getAuthorByName(author).subscribe({
|
||||
next: (authorDetails) => {
|
||||
const navigate = () => this.router.navigate(['/author', authorDetails.id]);
|
||||
if (this.metadataCenterViewMode === 'dialog') {
|
||||
this.dialogRef?.close();
|
||||
setTimeout(navigate, 200);
|
||||
} else {
|
||||
navigate();
|
||||
}
|
||||
this.navigateAfterDialogClose(() => void navigate());
|
||||
},
|
||||
error: () => {
|
||||
this.handleMetadataClick('author', author);
|
||||
@@ -814,12 +827,15 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
||||
}
|
||||
|
||||
goToLibrary(libraryId: number): void {
|
||||
if (this.metadataCenterViewMode === 'dialog') {
|
||||
this.dialogRef?.close();
|
||||
setTimeout(() => this.router.navigate(['/library', libraryId, 'books']), 200);
|
||||
} else {
|
||||
this.router.navigate(['/library', libraryId, 'books']);
|
||||
}
|
||||
this.navigateAfterDialogClose(() => {
|
||||
void this.router.navigate(['/library', libraryId, 'books']);
|
||||
});
|
||||
}
|
||||
|
||||
goToShelf(shelfId: number): void {
|
||||
this.navigateAfterDialogClose(() => {
|
||||
void this.router.navigate(['/shelf', shelfId, 'books']);
|
||||
});
|
||||
}
|
||||
|
||||
goToPublishedYear(publishedDate: string): void {
|
||||
@@ -908,12 +924,9 @@ export class MetadataViewerComponent implements OnInit, OnChanges, AfterViewChec
|
||||
}
|
||||
|
||||
private handleMetadataClick(filterKey: string, filterValue: string): void {
|
||||
if (this.metadataCenterViewMode === 'dialog') {
|
||||
this.dialogRef?.close();
|
||||
setTimeout(() => this.navigateToFilteredBooks(filterKey, filterValue), 200);
|
||||
} else {
|
||||
this.navigateAfterDialogClose(() => {
|
||||
this.navigateToFilteredBooks(filterKey, filterValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isMetadataFullyLocked(metadata: BookMetadata): boolean {
|
||||
|
||||
@@ -224,7 +224,8 @@ export type VisibleFilterType =
|
||||
| 'author' | 'category' | 'series' | 'bookType' | 'readStatus'
|
||||
| 'personalRating' | 'publisher' | 'matchScore' | 'library' | 'shelf'
|
||||
| 'shelfStatus' | 'tag' | 'publishedDate' | 'fileSize' | 'amazonRating'
|
||||
| 'goodreadsRating' | 'hardcoverRating' | 'language' | 'pageCount' | 'mood'
|
||||
| 'goodreadsRating' | 'hardcoverRating' | 'lubimyczytacRating' | 'ranobedbRating'
|
||||
| 'audibleRating' | 'language' | 'pageCount' | 'mood'
|
||||
| 'ageRating' | 'contentRating'
|
||||
| 'narrator'
|
||||
| 'comicCharacter' | 'comicTeam' | 'comicLocation' | 'comicCreator';
|
||||
@@ -232,9 +233,11 @@ export type VisibleFilterType =
|
||||
export const DEFAULT_VISIBLE_FILTERS: VisibleFilterType[] = [
|
||||
'author', 'category', 'series', 'bookType', 'readStatus',
|
||||
'personalRating', 'amazonRating', 'goodreadsRating', 'hardcoverRating',
|
||||
'library', 'tag', 'ageRating', 'contentRating',
|
||||
'lubimyczytacRating', 'ranobedbRating', 'audibleRating',
|
||||
'library', 'shelf', 'tag', 'ageRating', 'contentRating',
|
||||
'matchScore', 'publisher', 'publishedDate', 'fileSize',
|
||||
'pageCount', 'shelfStatus', 'language', 'mood', 'narrator'
|
||||
'pageCount', 'shelfStatus', 'language', 'mood', 'narrator',
|
||||
'comicCharacter', 'comicTeam', 'comicLocation', 'comicCreator'
|
||||
];
|
||||
|
||||
// Translation key for each filter option — use book.filter.labels.<value>
|
||||
@@ -243,7 +246,8 @@ export const ALL_FILTER_OPTION_VALUES: VisibleFilterType[] = [
|
||||
'personalRating', 'library', 'tag', 'ageRating', 'contentRating',
|
||||
'matchScore', 'publisher', 'publishedDate', 'fileSize', 'shelf',
|
||||
'shelfStatus', 'language', 'pageCount', 'mood', 'amazonRating',
|
||||
'goodreadsRating', 'hardcoverRating', 'narrator',
|
||||
'goodreadsRating', 'hardcoverRating', 'lubimyczytacRating', 'ranobedbRating',
|
||||
'audibleRating', 'narrator',
|
||||
'comicCharacter', 'comicTeam', 'comicLocation', 'comicCreator'
|
||||
];
|
||||
|
||||
@@ -270,6 +274,9 @@ export const ALL_FILTER_OPTIONS: { label: string; value: VisibleFilterType }[] =
|
||||
{ label: 'Amazon Rating', value: 'amazonRating' },
|
||||
{ label: 'Goodreads Rating', value: 'goodreadsRating' },
|
||||
{ label: 'Hardcover Rating', value: 'hardcoverRating' },
|
||||
{ label: 'Lubimyczytac Rating', value: 'lubimyczytacRating' },
|
||||
{ label: 'RanobeDB Rating', value: 'ranobedbRating' },
|
||||
{ label: 'Audible Rating', value: 'audibleRating' },
|
||||
{ label: 'Narrator', value: 'narrator' },
|
||||
{ label: 'Comic Character', value: 'comicCharacter' },
|
||||
{ label: 'Comic Team', value: 'comicTeam' },
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {TranslocoDirective, TranslocoPipe, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
const MIN_VISIBLE_FILTERS = 5;
|
||||
const MAX_VISIBLE_FILTERS = 20;
|
||||
const MAX_VISIBLE_FILTERS = 50;
|
||||
type MutableSettingsBranch = Record<string, unknown>;
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -529,6 +529,9 @@
|
||||
"amazonRating": "Amazon Rating",
|
||||
"goodreadsRating": "Goodreads Rating",
|
||||
"hardcoverRating": "Hardcover Rating",
|
||||
"lubimyczytacRating": "Lubimyczytac Rating",
|
||||
"ranobedbRating": "RanobeDB Rating",
|
||||
"audibleRating": "Audible Rating",
|
||||
"language": "Language",
|
||||
"pageCount": "Page Count",
|
||||
"mood": "Mood",
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
"ranobedbRating": "Ranobedb Rating",
|
||||
"genre": "Genre",
|
||||
"addedOn": "Date Added",
|
||||
"lubimyczytacRating": "Lubimyczytac Rating",
|
||||
"lubimyczytacRating": "LubimyCzytac Rating",
|
||||
"description": "Description",
|
||||
"narrator": "Narrator",
|
||||
"ageRating": "Age Rating",
|
||||
@@ -236,7 +236,7 @@
|
||||
"goodreadsRating": "Goodreads Rating",
|
||||
"hardcoverRating": "Hardcover Rating",
|
||||
"ranobedbRating": "Ranobedb Rating",
|
||||
"lubimyczytacRating": "Lubimyczytac Rating",
|
||||
"lubimyczytacRating": "LubimyCzytac Rating",
|
||||
"audibleRating": "Audible Rating",
|
||||
"amazonReviewCount": "Amazon Reviews",
|
||||
"goodreadsReviewCount": "Goodreads Reviews",
|
||||
|
||||
@@ -240,6 +240,7 @@
|
||||
"moodsLabel": "Moods:",
|
||||
"tagsLabel": "Tags:",
|
||||
"libraryLabel": "Library:",
|
||||
"shelvesLabel": "Shelves:",
|
||||
"publisherLabel": "Publisher:",
|
||||
"publishedLabel": "Published:",
|
||||
"languageLabel": "Language:",
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
"hardcoverReviewCount": "Hardcover Review Count",
|
||||
"comicvineId": "Comicvine ID",
|
||||
"lubimyczytacId": "Lubimyczytac ID",
|
||||
"lubimyczytacRating": "Lubimyczytac Rating",
|
||||
"lubimyczytacRating": "LubimyCzytac Rating",
|
||||
"ranobedbId": "Ranobedb ID",
|
||||
"ranobedbRating": "Ranobedb Rating",
|
||||
"audibleId": "Audible ID",
|
||||
|
||||
Reference in New Issue
Block a user