Metadata viewer minor layout tweaks
This commit is contained in:
@@ -48,6 +48,7 @@ import {SidebarFilterTogglePrefService} from './filters/sidebar-filter-toggle-pr
|
||||
import {MetadataRefreshType} from '../../../metadata/model/request/metadata-refresh-type.enum';
|
||||
import {GroupRule} from '../../../magic-shelf/component/magic-shelf-component';
|
||||
import {TaskHelperService} from '../../../settings/task-management/task-helper.service';
|
||||
import {FilterLabelHelper} from './filter-label.helper';
|
||||
|
||||
export enum EntityType {
|
||||
LIBRARY = 'Library',
|
||||
@@ -191,17 +192,18 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
|
||||
if (filterEntries.length === 1) {
|
||||
const [filterType, values] = filterEntries[0];
|
||||
const filterName = this.capitalize(filterType);
|
||||
const filterName = FilterLabelHelper.getFilterTypeName(filterType);
|
||||
|
||||
if (values.length === 1) {
|
||||
return `${filterName}: ${values[0]}`;
|
||||
const displayValue = FilterLabelHelper.getFilterDisplayValue(filterType, values[0]);
|
||||
return `${filterName}: ${displayValue}`;
|
||||
}
|
||||
|
||||
return `${filterName} (${values.length})`;
|
||||
}
|
||||
|
||||
const filterSummary = filterEntries
|
||||
.map(([type, values]) => `${this.capitalize(type)} (${values.length})`)
|
||||
.map(([type, values]) => `${FilterLabelHelper.getFilterTypeName(type)} (${values.length})`)
|
||||
.join(', ');
|
||||
|
||||
return filterSummary.length > 50
|
||||
@@ -209,6 +211,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
: filterSummary;
|
||||
}
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
this.pageTitle.setPageTitle('')
|
||||
this.coverScalePreferenceService.scaleChange$.pipe(debounceTime(1000)).subscribe();
|
||||
@@ -292,7 +295,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
this.bookFilterComponent.setFilters?.(parsedFilters);
|
||||
this.bookFilterComponent.onFiltersChanged?.();
|
||||
}
|
||||
|
||||
|
||||
if (Object.keys(parsedFilters).length > 0) {
|
||||
this.currentFilterLabel = this.computedFilterLabel;
|
||||
}
|
||||
@@ -813,8 +816,4 @@ export class BookBrowserComponent implements OnInit, AfterViewInit {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private capitalize(str: string): string {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import {
|
||||
fileSizeRanges,
|
||||
matchScoreRanges,
|
||||
pageCountRanges,
|
||||
ratingOptions10,
|
||||
ratingRanges
|
||||
} from './book-filter/book-filter.component';
|
||||
|
||||
export class FilterLabelHelper {
|
||||
private static readonly FILTER_TYPE_MAP: Record<string, string> = {
|
||||
author: 'Author',
|
||||
category: 'Genre',
|
||||
series: 'Series',
|
||||
publisher: 'Publisher',
|
||||
readStatus: 'Read Status',
|
||||
personalRating: 'Personal Rating',
|
||||
publishedYear: 'Year Published',
|
||||
matchScore: 'Metadata Match Score',
|
||||
language: 'Language',
|
||||
bookType: 'Book Type',
|
||||
shelfStatus: 'Shelf Status',
|
||||
fileSize: 'File Size',
|
||||
pageCount: 'Page Count',
|
||||
amazonRating: 'Amazon Rating',
|
||||
goodreadsRating: 'Goodreads Rating',
|
||||
hardcoverRating: 'Hardcover Rating',
|
||||
mood: 'Mood',
|
||||
tag: 'Tag',
|
||||
};
|
||||
|
||||
static getFilterTypeName(filterType: string): string {
|
||||
return this.FILTER_TYPE_MAP[filterType] || this.capitalize(filterType);
|
||||
}
|
||||
|
||||
static getFilterDisplayValue(filterType: string, value: string): string {
|
||||
switch (filterType.toLowerCase()) {
|
||||
case 'filesize':
|
||||
const fileSizeRange = fileSizeRanges.find(r => r.id === value);
|
||||
return fileSizeRange?.label || value;
|
||||
case 'pagecount':
|
||||
const pageCountRange = pageCountRanges.find(r => r.id === value);
|
||||
return pageCountRange?.label || value;
|
||||
case 'matchscore':
|
||||
const matchScoreRange = matchScoreRanges.find(r => r.id === value);
|
||||
return matchScoreRange?.label || value;
|
||||
case 'personalrating':
|
||||
const personalRating = ratingOptions10.find(r => r.id === value);
|
||||
return personalRating?.label || value;
|
||||
case 'amazonrating':
|
||||
case 'goodreadsrating':
|
||||
case 'hardcoverrating':
|
||||
const ratingRange = ratingRanges.find(r => r.id === value);
|
||||
return ratingRange?.label || value;
|
||||
default:
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private static capitalize(str: string): string {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -78,9 +78,7 @@
|
||||
|
||||
<p class="authors">
|
||||
@for (author of book?.metadata!.authors; track $index; let isLast = $last) {
|
||||
<a class="author-link" (click)="goToAuthorBooks(author)">
|
||||
{{ author }}
|
||||
</a>
|
||||
<a class="author-link" (click)="goToAuthorBooks(author)">{{ author }}</a>
|
||||
@if (!isLast) {
|
||||
<span class="author-separator">, </span>
|
||||
}
|
||||
@@ -192,7 +190,7 @@
|
||||
<div class="tag-container">
|
||||
@for (category of book.metadata!.categories; track category) {
|
||||
<a (click)="goToCategory(category)" class="tag-clickable">
|
||||
<app-tag color="rose" size="xs">{{ category }}</app-tag>
|
||||
<app-tag color="red" size="xs">{{ category }}</app-tag>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
@@ -222,7 +220,7 @@
|
||||
<div class="tag-container">
|
||||
@for (tag of book.metadata!.tags; track tag) {
|
||||
<a (click)="goToTag(tag)" class="tag-clickable">
|
||||
<app-tag color="cyan" size="xs">{{ tag }}</app-tag>
|
||||
<app-tag color="green" size="xs">{{ tag }}</app-tag>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
|
||||
+13
-11
@@ -126,14 +126,15 @@
|
||||
}
|
||||
|
||||
.series-link {
|
||||
color: #3e9aee;
|
||||
color: var(--primary-color);
|
||||
cursor: pointer;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
transition: color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
color: #72b3ee;
|
||||
color: var(--primary-hover-color);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
@@ -197,13 +198,14 @@
|
||||
}
|
||||
|
||||
.author-link {
|
||||
color: #3e9aee;
|
||||
color: cornflowerblue;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s ease;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.author-link:hover {
|
||||
color: #72b3ee;
|
||||
color: dodgerblue;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
@@ -216,7 +218,6 @@
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
align-items: center;
|
||||
padding: 0.5rem 0;
|
||||
|
||||
@media (min-width: 640px) {
|
||||
flex-direction: row;
|
||||
@@ -302,7 +303,7 @@
|
||||
.tags-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.tag-row {
|
||||
@@ -367,7 +368,7 @@
|
||||
@media (min-width: 768px) {
|
||||
.metadata-grid {
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 0.625rem;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,11 +404,12 @@
|
||||
color: var(--primary-text-color);
|
||||
cursor: pointer;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
font-weight: 500;
|
||||
|
||||
.metadata-link:hover {
|
||||
color: var(--primary-hover-color);
|
||||
text-decoration: underline;
|
||||
&:hover {
|
||||
color: var(--primary-hover-color);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
|
||||
Reference in New Issue
Block a user