feat: add i18n translations for stats, pdf reader, magic shelf, and remaining components (en/es) (#2742)
This commit is contained in:
@@ -166,7 +166,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private sideBarFilter = new SideBarFilter(this.selectedFilter, this.selectedFilterMode);
|
||||
private headerFilter = new HeaderFilter(this.searchTerm$);
|
||||
protected bookSorter = new BookSorter(
|
||||
sortCriteria => this.onMultiSortChange(sortCriteria)
|
||||
sortCriteria => this.onMultiSortChange(sortCriteria),
|
||||
this.t
|
||||
);
|
||||
private sortService = inject(SortService);
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
<p-accordion-header>
|
||||
<span class="filter-type-label">
|
||||
<span class="filter-label-text">
|
||||
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
||||
{{ getFilterLabel(filterType) }}
|
||||
</span>
|
||||
@if (activeFilters[filterType]?.length) {
|
||||
<span class="active-filter-count">
|
||||
|
||||
+11
-5
@@ -5,16 +5,16 @@ import {Shelf} from '../../../model/shelf.model';
|
||||
import {EntityType} from '../book-browser.component';
|
||||
import {Accordion, AccordionContent, AccordionHeader, AccordionPanel} from 'primeng/accordion';
|
||||
import {CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport} from '@angular/cdk/scrolling';
|
||||
import {AsyncPipe, NgClass, TitleCasePipe} from '@angular/common';
|
||||
import {AsyncPipe, NgClass} from '@angular/common';
|
||||
import {Badge} from 'primeng/badge';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {SelectButton} from 'primeng/selectbutton';
|
||||
import {BookFilterMode, DEFAULT_VISIBLE_FILTERS, UserService, VisibleFilterType} from '../../../../settings/user-management/user.service';
|
||||
import {MagicShelf} from '../../../../magic-shelf/service/magic-shelf.service';
|
||||
import {Filter, FILTER_LABELS, FilterType} from './book-filter.config';
|
||||
import {Filter, FILTER_LABEL_KEYS, FilterType} from './book-filter.config';
|
||||
import {BookFilterService} from './book-filter.service';
|
||||
import {filter} from 'rxjs/operators';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type FilterModeOption = { label: string; value: BookFilterMode };
|
||||
|
||||
@@ -27,7 +27,7 @@ type FilterModeOption = { label: string; value: BookFilterMode };
|
||||
imports: [
|
||||
Accordion, AccordionPanel, AccordionHeader, AccordionContent,
|
||||
CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf,
|
||||
NgClass, Badge, AsyncPipe, TitleCasePipe, FormsModule, SelectButton,
|
||||
NgClass, Badge, AsyncPipe, FormsModule, SelectButton,
|
||||
TranslocoDirective
|
||||
]
|
||||
})
|
||||
@@ -42,6 +42,7 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
|
||||
private readonly filterService = inject(BookFilterService);
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
private readonly activeFilters$ = new BehaviorSubject<Record<string, unknown[]> | null>(null);
|
||||
@@ -57,7 +58,12 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
||||
private _selectedFilterMode: BookFilterMode = 'and';
|
||||
private _visibleFilters: VisibleFilterType[] = [...DEFAULT_VISIBLE_FILTERS];
|
||||
|
||||
readonly filterLabels = FILTER_LABELS;
|
||||
readonly filterLabelKeys = FILTER_LABEL_KEYS;
|
||||
|
||||
getFilterLabel(type: FilterType): string {
|
||||
const key = this.filterLabelKeys[type];
|
||||
return key ? this.t.translate(key) : type;
|
||||
}
|
||||
readonly filterModeOptions: FilterModeOption[] = [
|
||||
{label: 'AND', value: 'and'},
|
||||
{label: 'OR', value: 'or'},
|
||||
|
||||
+65
@@ -269,6 +269,71 @@ export const FILTER_EXTRACTORS: Readonly<Record<Exclude<FilterType, 'library'>,
|
||||
}
|
||||
};
|
||||
|
||||
// Translation key for each FilterType — used by UI components to translate filter labels
|
||||
export const FILTER_LABEL_KEYS: Readonly<Record<FilterType, string>> = {
|
||||
author: 'book.filter.labels.author',
|
||||
category: 'book.filter.labels.category',
|
||||
series: 'book.filter.labels.series',
|
||||
bookType: 'book.filter.labels.bookType',
|
||||
readStatus: 'book.filter.labels.readStatus',
|
||||
personalRating: 'book.filter.labels.personalRating',
|
||||
publisher: 'book.filter.labels.publisher',
|
||||
matchScore: 'book.filter.labels.matchScore',
|
||||
library: 'book.filter.labels.library',
|
||||
shelf: 'book.filter.labels.shelf',
|
||||
shelfStatus: 'book.filter.labels.shelfStatus',
|
||||
tag: 'book.filter.labels.tag',
|
||||
publishedDate: 'book.filter.labels.publishedDate',
|
||||
fileSize: 'book.filter.labels.fileSize',
|
||||
amazonRating: 'book.filter.labels.amazonRating',
|
||||
goodreadsRating: 'book.filter.labels.goodreadsRating',
|
||||
hardcoverRating: 'book.filter.labels.hardcoverRating',
|
||||
language: 'book.filter.labels.language',
|
||||
pageCount: 'book.filter.labels.pageCount',
|
||||
mood: 'book.filter.labels.mood',
|
||||
ageRating: 'book.filter.labels.ageRating',
|
||||
contentRating: 'book.filter.labels.contentRating',
|
||||
narrator: 'book.filter.labels.narrator',
|
||||
comicCharacter: 'book.filter.labels.comicCharacter',
|
||||
comicTeam: 'book.filter.labels.comicTeam',
|
||||
comicLocation: 'book.filter.labels.comicLocation',
|
||||
comicCreator: 'book.filter.labels.comicCreator'
|
||||
};
|
||||
|
||||
export const READ_STATUS_LABEL_KEYS: Readonly<Record<ReadStatus, string>> = {
|
||||
[ReadStatus.UNREAD]: 'book.filter.readStatus.unread',
|
||||
[ReadStatus.READING]: 'book.filter.readStatus.reading',
|
||||
[ReadStatus.RE_READING]: 'book.filter.readStatus.reReading',
|
||||
[ReadStatus.PARTIALLY_READ]: 'book.filter.readStatus.partiallyRead',
|
||||
[ReadStatus.PAUSED]: 'book.filter.readStatus.paused',
|
||||
[ReadStatus.READ]: 'book.filter.readStatus.read',
|
||||
[ReadStatus.WONT_READ]: 'book.filter.readStatus.wontRead',
|
||||
[ReadStatus.ABANDONED]: 'book.filter.readStatus.abandoned',
|
||||
[ReadStatus.UNSET]: 'book.filter.readStatus.unset'
|
||||
};
|
||||
|
||||
export const CONTENT_RATING_LABEL_KEYS: Readonly<Record<string, string>> = {
|
||||
'EVERYONE': 'book.filter.contentRating.everyone',
|
||||
'TEEN': 'book.filter.contentRating.teen',
|
||||
'MATURE': 'book.filter.contentRating.mature',
|
||||
'ADULT': 'book.filter.contentRating.adult',
|
||||
'EXPLICIT': 'book.filter.contentRating.explicit'
|
||||
};
|
||||
|
||||
export const SHELF_STATUS_LABEL_KEYS: Readonly<Record<string, string>> = {
|
||||
'shelved': 'book.filter.shelfStatus.shelved',
|
||||
'unshelved': 'book.filter.shelfStatus.unshelved'
|
||||
};
|
||||
|
||||
export const COMIC_ROLE_LABEL_KEYS: Readonly<Record<string, string>> = {
|
||||
penciller: 'book.filter.comicRoles.penciller',
|
||||
inker: 'book.filter.comicRoles.inker',
|
||||
colorist: 'book.filter.comicRoles.colorist',
|
||||
letterer: 'book.filter.comicRoles.letterer',
|
||||
coverArtist: 'book.filter.comicRoles.coverArtist',
|
||||
editor: 'book.filter.comicRoles.editor'
|
||||
};
|
||||
|
||||
export const FILTER_CONFIGS: Readonly<Record<Exclude<FilterType, 'library'>, Omit<FilterConfig, 'extractor'>>> = {
|
||||
author: {label: 'Author', sortMode: 'count'},
|
||||
category: {label: 'Genre', sortMode: 'count'},
|
||||
|
||||
+23
-23
@@ -55,29 +55,29 @@ export class BookTableComponent implements OnInit, OnDestroy, OnChanges {
|
||||
private metadataCenterViewMode: 'route' | 'dialog' = 'route';
|
||||
private destroy$ = new Subject<void>();
|
||||
|
||||
readonly allColumns = [
|
||||
{field: 'readStatus', header: '📖'},
|
||||
{field: 'title', header: 'Title'},
|
||||
{field: 'authors', header: 'Authors'},
|
||||
{field: 'publisher', header: 'Publisher'},
|
||||
{field: 'seriesName', header: 'Series'},
|
||||
{field: 'seriesNumber', header: 'Series #'},
|
||||
{field: 'categories', header: 'Genres'},
|
||||
{field: 'publishedDate', header: 'Published'},
|
||||
{field: 'lastReadTime', header: 'Last Read'},
|
||||
{field: 'addedOn', header: 'Added'},
|
||||
{field: 'fileName', header: 'File Name'},
|
||||
{field: 'fileSizeKb', header: 'File Size'},
|
||||
{field: 'language', header: 'Language'},
|
||||
{field: 'isbn', header: 'ISBN'},
|
||||
{field: 'pageCount', header: 'Pages'},
|
||||
{field: 'amazonRating', header: 'Amazon'},
|
||||
{field: 'amazonReviewCount', header: 'AZ #'},
|
||||
{field: 'goodreadsRating', header: 'Goodreads'},
|
||||
{field: 'goodreadsReviewCount', header: 'GR #'},
|
||||
{field: 'hardcoverRating', header: 'Hardcover'},
|
||||
{field: 'hardcoverReviewCount', header: 'HC #'},
|
||||
{field: 'ranobedbRating', header: 'Ranobedb'},
|
||||
readonly allColumns: { field: string; header: string }[] = [
|
||||
{field: 'readStatus', header: this.t.translate('book.columnPref.columns.readStatus')},
|
||||
{field: 'title', header: this.t.translate('book.columnPref.columns.title')},
|
||||
{field: 'authors', header: this.t.translate('book.columnPref.columns.authors')},
|
||||
{field: 'publisher', header: this.t.translate('book.columnPref.columns.publisher')},
|
||||
{field: 'seriesName', header: this.t.translate('book.columnPref.columns.seriesName')},
|
||||
{field: 'seriesNumber', header: this.t.translate('book.columnPref.columns.seriesNumber')},
|
||||
{field: 'categories', header: this.t.translate('book.columnPref.columns.categories')},
|
||||
{field: 'publishedDate', header: this.t.translate('book.columnPref.columns.publishedDate')},
|
||||
{field: 'lastReadTime', header: this.t.translate('book.columnPref.columns.lastReadTime')},
|
||||
{field: 'addedOn', header: this.t.translate('book.columnPref.columns.addedOn')},
|
||||
{field: 'fileName', header: this.t.translate('book.columnPref.columns.fileName')},
|
||||
{field: 'fileSizeKb', header: this.t.translate('book.columnPref.columns.fileSizeKb')},
|
||||
{field: 'language', header: this.t.translate('book.columnPref.columns.language')},
|
||||
{field: 'isbn', header: this.t.translate('book.columnPref.columns.isbn')},
|
||||
{field: 'pageCount', header: this.t.translate('book.columnPref.columns.pageCount')},
|
||||
{field: 'amazonRating', header: this.t.translate('book.columnPref.columns.amazonRating')},
|
||||
{field: 'amazonReviewCount', header: this.t.translate('book.columnPref.columns.amazonReviewCount')},
|
||||
{field: 'goodreadsRating', header: this.t.translate('book.columnPref.columns.goodreadsRating')},
|
||||
{field: 'goodreadsReviewCount', header: this.t.translate('book.columnPref.columns.goodreadsReviewCount')},
|
||||
{field: 'hardcoverRating', header: this.t.translate('book.columnPref.columns.hardcoverRating')},
|
||||
{field: 'hardcoverReviewCount', header: this.t.translate('book.columnPref.columns.hardcoverReviewCount')},
|
||||
{field: 'ranobedbRating', header: this.t.translate('book.columnPref.columns.ranobedbRating')},
|
||||
];
|
||||
|
||||
scrollHeight = 'calc(100dvh - 160px)';
|
||||
|
||||
@@ -1,41 +1,80 @@
|
||||
import {SortDirection, SortOption} from '../../../model/sort.model';
|
||||
import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
export const SORT_OPTION_LABEL_KEYS: Readonly<Record<string, string>> = {
|
||||
title: 'book.sorting.options.title',
|
||||
fileName: 'book.sorting.options.fileName',
|
||||
filePath: 'book.sorting.options.filePath',
|
||||
author: 'book.sorting.options.author',
|
||||
authorSurnameVorname: 'book.sorting.options.authorSurnameVorname',
|
||||
seriesName: 'book.sorting.options.seriesName',
|
||||
seriesNumber: 'book.sorting.options.seriesNumber',
|
||||
lastReadTime: 'book.sorting.options.lastReadTime',
|
||||
personalRating: 'book.sorting.options.personalRating',
|
||||
addedOn: 'book.sorting.options.addedOn',
|
||||
fileSizeKb: 'book.sorting.options.fileSizeKb',
|
||||
locked: 'book.sorting.options.locked',
|
||||
publisher: 'book.sorting.options.publisher',
|
||||
publishedDate: 'book.sorting.options.publishedDate',
|
||||
readStatus: 'book.sorting.options.readStatus',
|
||||
dateFinished: 'book.sorting.options.dateFinished',
|
||||
readingProgress: 'book.sorting.options.readingProgress',
|
||||
bookType: 'book.sorting.options.bookType',
|
||||
amazonRating: 'book.sorting.options.amazonRating',
|
||||
amazonReviewCount: 'book.sorting.options.amazonReviewCount',
|
||||
goodreadsRating: 'book.sorting.options.goodreadsRating',
|
||||
goodreadsReviewCount: 'book.sorting.options.goodreadsReviewCount',
|
||||
hardcoverRating: 'book.sorting.options.hardcoverRating',
|
||||
hardcoverReviewCount: 'book.sorting.options.hardcoverReviewCount',
|
||||
ranobedbRating: 'book.sorting.options.ranobedbRating',
|
||||
narrator: 'book.sorting.options.narrator',
|
||||
pageCount: 'book.sorting.options.pageCount',
|
||||
random: 'book.sorting.options.random'
|
||||
};
|
||||
|
||||
const SORT_FIELDS: { field: string; defaultLabel: string }[] = [
|
||||
{field: 'title', defaultLabel: 'Title'},
|
||||
{field: 'fileName', defaultLabel: 'File Name'},
|
||||
{field: 'filePath', defaultLabel: 'File Path'},
|
||||
{field: 'author', defaultLabel: 'Author'},
|
||||
{field: 'authorSurnameVorname', defaultLabel: 'Author (Surname)'},
|
||||
{field: 'seriesName', defaultLabel: 'Series Name'},
|
||||
{field: 'seriesNumber', defaultLabel: 'Series Number'},
|
||||
{field: 'lastReadTime', defaultLabel: 'Last Read'},
|
||||
{field: 'personalRating', defaultLabel: 'Personal Rating'},
|
||||
{field: 'addedOn', defaultLabel: 'Added On'},
|
||||
{field: 'fileSizeKb', defaultLabel: 'File Size'},
|
||||
{field: 'locked', defaultLabel: 'Locked'},
|
||||
{field: 'publisher', defaultLabel: 'Publisher'},
|
||||
{field: 'publishedDate', defaultLabel: 'Published Date'},
|
||||
{field: 'readStatus', defaultLabel: 'Read Status'},
|
||||
{field: 'dateFinished', defaultLabel: 'Date Finished'},
|
||||
{field: 'readingProgress', defaultLabel: 'Reading Progress'},
|
||||
{field: 'bookType', defaultLabel: 'Book Type'},
|
||||
{field: 'amazonRating', defaultLabel: 'Amazon Rating'},
|
||||
{field: 'amazonReviewCount', defaultLabel: 'Amazon #'},
|
||||
{field: 'goodreadsRating', defaultLabel: 'Goodreads Rating'},
|
||||
{field: 'goodreadsReviewCount', defaultLabel: 'Goodreads #'},
|
||||
{field: 'hardcoverRating', defaultLabel: 'Hardcover Rating'},
|
||||
{field: 'hardcoverReviewCount', defaultLabel: 'Hardcover #'},
|
||||
{field: 'ranobedbRating', defaultLabel: 'Ranobedb Rating'},
|
||||
{field: 'narrator', defaultLabel: 'Narrator'},
|
||||
{field: 'pageCount', defaultLabel: 'Pages'},
|
||||
{field: 'random', defaultLabel: 'Random'},
|
||||
];
|
||||
|
||||
export class BookSorter {
|
||||
selectedSortCriteria: SortOption[] = [];
|
||||
|
||||
sortOptions: SortOption[] = [
|
||||
{label: 'Title', field: 'title', direction: SortDirection.ASCENDING},
|
||||
{label: 'File Name', field: 'fileName', direction: SortDirection.ASCENDING},
|
||||
{label: 'File Path', field: 'filePath', direction: SortDirection.ASCENDING},
|
||||
{label: 'Author', field: 'author', direction: SortDirection.ASCENDING},
|
||||
{label: 'Author (Surname)', field: 'authorSurnameVorname', direction: SortDirection.ASCENDING},
|
||||
{label: 'Series Name', field: 'seriesName', direction: SortDirection.ASCENDING},
|
||||
{label: 'Series Number', field: 'seriesNumber', direction: SortDirection.ASCENDING},
|
||||
{label: 'Last Read', field: 'lastReadTime', direction: SortDirection.ASCENDING},
|
||||
{label: 'Personal Rating', field: 'personalRating', direction: SortDirection.ASCENDING},
|
||||
{label: 'Added On', field: 'addedOn', direction: SortDirection.ASCENDING},
|
||||
{label: 'File Size', field: 'fileSizeKb', direction: SortDirection.ASCENDING},
|
||||
{label: 'Locked', field: 'locked', direction: SortDirection.ASCENDING},
|
||||
{label: 'Publisher', field: 'publisher', direction: SortDirection.ASCENDING},
|
||||
{label: 'Published Date', field: 'publishedDate', direction: SortDirection.ASCENDING},
|
||||
{label: 'Read Status', field: 'readStatus', direction: SortDirection.ASCENDING},
|
||||
{label: 'Date Finished', field: 'dateFinished', direction: SortDirection.ASCENDING},
|
||||
{label: 'Reading Progress', field: 'readingProgress', direction: SortDirection.ASCENDING},
|
||||
{label: 'Book Type', field: 'bookType', direction: SortDirection.ASCENDING},
|
||||
{label: 'Amazon Rating', field: 'amazonRating', direction: SortDirection.ASCENDING},
|
||||
{label: 'Amazon #', field: 'amazonReviewCount', direction: SortDirection.ASCENDING},
|
||||
{label: 'Goodreads Rating', field: 'goodreadsRating', direction: SortDirection.ASCENDING},
|
||||
{label: 'Goodreads #', field: 'goodreadsReviewCount', direction: SortDirection.ASCENDING},
|
||||
{label: 'Hardcover Rating', field: 'hardcoverRating', direction: SortDirection.ASCENDING},
|
||||
{label: 'Hardcover #', field: 'hardcoverReviewCount', direction: SortDirection.ASCENDING},
|
||||
{label: 'Ranobedb Rating', field: 'ranobedbRating', direction: SortDirection.ASCENDING},
|
||||
{label: 'Narrator', field: 'narrator', direction: SortDirection.ASCENDING},
|
||||
{label: 'Pages', field: 'pageCount', direction: SortDirection.ASCENDING},
|
||||
{label: 'Random', field: 'random', direction: SortDirection.ASCENDING},
|
||||
];
|
||||
sortOptions: SortOption[];
|
||||
|
||||
constructor(private onSortChange: (criteria: SortOption[]) => void) {
|
||||
constructor(private onSortChange: (criteria: SortOption[]) => void, translocoService?: TranslocoService) {
|
||||
this.sortOptions = SORT_FIELDS.map(({field, defaultLabel}) => {
|
||||
const key = SORT_OPTION_LABEL_KEYS[field];
|
||||
const label = key && translocoService ? translocoService.translate(key) : defaultLabel;
|
||||
return {label, field, direction: SortDirection.ASCENDING};
|
||||
});
|
||||
}
|
||||
|
||||
// For backward compatibility - get first sort option
|
||||
|
||||
@@ -443,8 +443,8 @@ export class SeriesPageComponent implements OnDestroy {
|
||||
message: this.t.translate('book.browser.confirm.regenCoverMessage', {count}),
|
||||
header: this.t.translate('book.browser.confirm.regenCoverHeader'),
|
||||
icon: 'pi pi-image',
|
||||
acceptLabel: 'Yes',
|
||||
rejectLabel: 'No',
|
||||
acceptLabel: this.t.translate('common.yes'),
|
||||
rejectLabel: this.t.translate('common.no'),
|
||||
acceptButtonProps: {
|
||||
label: this.t.translate('common.yes'),
|
||||
severity: 'success'
|
||||
@@ -483,8 +483,8 @@ export class SeriesPageComponent implements OnDestroy {
|
||||
message: this.t.translate('book.browser.confirm.customCoverMessage', {count}),
|
||||
header: this.t.translate('book.browser.confirm.customCoverHeader'),
|
||||
icon: 'pi pi-palette',
|
||||
acceptLabel: 'Yes',
|
||||
rejectLabel: 'No',
|
||||
acceptLabel: this.t.translate('common.yes'),
|
||||
rejectLabel: this.t.translate('common.no'),
|
||||
acceptButtonProps: {
|
||||
label: this.t.translate('common.yes'),
|
||||
severity: 'success'
|
||||
|
||||
@@ -334,7 +334,7 @@ export class BookMenuService {
|
||||
|
||||
if (allShelfIds.size === 0) {
|
||||
this.loadingService.hide(loader);
|
||||
this.messageService.add({ severity: 'info', summary: 'Info', detail: this.t.translate('book.menuService.toast.noBooksOnShelvesDetail') });
|
||||
this.messageService.add({ severity: 'info', summary: this.t.translate('common.info'), detail: this.t.translate('book.menuService.toast.noBooksOnShelvesDetail') });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'magicShelf'">
|
||||
<div class="magic-shelf-container">
|
||||
<div class="panel-header">
|
||||
<div class="header-icon-wrapper">
|
||||
@@ -5,9 +6,9 @@
|
||||
</div>
|
||||
<div class="header-text">
|
||||
<h2 class="panel-title">
|
||||
{{ editMode ? 'Edit Magic Shelf' : 'Magic Shelf Builder' }}
|
||||
{{ editMode ? t('header.titleEdit') : t('header.titleCreate') }}
|
||||
</h2>
|
||||
<p class="panel-description">Create smart shelves with custom rules to automatically organize your books</p>
|
||||
<p class="panel-description">{{ t('header.description') }}</p>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
@@ -23,12 +24,12 @@
|
||||
<fieldset [disabled]="form.get('isPublic')?.value && !isAdmin">
|
||||
<div class="form-header">
|
||||
<div class="form-field">
|
||||
<label for="shelfName">Magic Shelf Name</label>
|
||||
<input pInputText id="shelfName" type="text" formControlName="name" placeholder="E.g. Rom-Zom-Coms, Fast & Furious, Missing Metadata"/>
|
||||
<label for="shelfName">{{ t('form.shelfName') }}</label>
|
||||
<input pInputText id="shelfName" type="text" formControlName="name" [placeholder]="t('form.namePlaceholder')"/>
|
||||
</div>
|
||||
<div class="icon-picker-section">
|
||||
<div class="icon-picker-wrapper">
|
||||
<label>Shelf Icon</label>
|
||||
<label>{{ t('form.shelfIcon') }}</label>
|
||||
@if (selectedIcon) {
|
||||
<div class="selected-icon-display">
|
||||
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
||||
@@ -38,7 +39,7 @@
|
||||
iconClass="selected-icon"
|
||||
alt="Selected shelf icon">
|
||||
</app-icon-display>
|
||||
<span class="icon-label">Click to change</span>
|
||||
<span class="icon-label">{{ t('form.clickToChange') }}</span>
|
||||
</div>
|
||||
<p-button
|
||||
icon="pi pi-times"
|
||||
@@ -47,7 +48,7 @@
|
||||
[rounded]="true"
|
||||
size="small"
|
||||
(onClick)="clearSelectedIcon()"
|
||||
pTooltip="Remove icon"
|
||||
[pTooltip]="t('form.removeIcon')"
|
||||
tooltipPosition="left"
|
||||
/>
|
||||
</div>
|
||||
@@ -55,7 +56,7 @@
|
||||
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
||||
<div class="icon-placeholder">
|
||||
<i class="pi pi-plus"></i>
|
||||
<span>Select Icon</span>
|
||||
<span>{{ t('form.selectIcon') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -65,7 +66,7 @@
|
||||
<div class="public-checkbox-section">
|
||||
<div class="checkbox-wrapper">
|
||||
<p-checkbox formControlName="isPublic" [binary]="true" inputId="isPublic" (onChange)="onIsPublicChange($event)"></p-checkbox>
|
||||
<label for="isPublic">Public</label>
|
||||
<label for="isPublic">{{ t('form.public') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -80,13 +81,13 @@
|
||||
<div class="dialog-footer">
|
||||
<div class="footer-actions">
|
||||
<p-button
|
||||
label="Cancel"
|
||||
[label]="t('actions.cancel')"
|
||||
severity="secondary"
|
||||
[outlined]="true"
|
||||
(onClick)="cancel()"
|
||||
/>
|
||||
<p-button
|
||||
label="Save Filter"
|
||||
[label]="t('actions.saveFilter')"
|
||||
icon="pi pi-save"
|
||||
severity="success"
|
||||
(onClick)="submit()"
|
||||
@@ -98,10 +99,10 @@
|
||||
<ng-template #groupTemplate let-group="group">
|
||||
<div class="group-container" [formGroup]="group">
|
||||
<div class="group-header">
|
||||
<label>Condition:</label>
|
||||
<label>{{ t('group.condition') }}</label>
|
||||
<p-select [options]="conditionOptions" formControlName="join" class="condition-select" appendTo="body" [showClear]="false"/>
|
||||
<p-button icon="pi pi-plus" size="small" text (click)="addRule(group)" label="Add Rule" outlined></p-button>
|
||||
<p-button icon="pi pi-folder-open" size="small" text (click)="addGroup(group)" label="Add Group" outlined></p-button>
|
||||
<p-button icon="pi pi-plus" size="small" text (click)="addRule(group)" [label]="t('actions.addRule')" outlined></p-button>
|
||||
<p-button icon="pi pi-folder-open" size="small" text (click)="addGroup(group)" [label]="t('actions.addGroup')" outlined></p-button>
|
||||
@if (group.parent) {
|
||||
<p-button icon="pi pi-trash" text (click)="deleteGroup(group)" severity="danger"></p-button>
|
||||
}
|
||||
@@ -115,26 +116,26 @@
|
||||
<ng-container *ngTemplateOutlet="groupTemplate; context: { group: ruleCtrl }"></ng-container>
|
||||
</ng-container>
|
||||
} @else {
|
||||
<p-select [options]="fieldOptions" formControlName="field" (onChange)="onFieldChange(ruleCtrl)" placeholder="Field" appendTo="body" class="field-select"/>
|
||||
<p-select [options]="getOperatorOptionsForField(ruleCtrl.get('field')?.value)" appendTo="body" formControlName="operator" placeholder="Operator" class="operator-select" (onChange)="onOperatorChange(ruleCtrl)"/>
|
||||
<p-select [options]="fieldOptions" formControlName="field" (onChange)="onFieldChange(ruleCtrl)" [placeholder]="t('placeholders.field')" appendTo="body" class="field-select"/>
|
||||
<p-select [options]="getOperatorOptionsForField(ruleCtrl.get('field')?.value)" appendTo="body" formControlName="operator" [placeholder]="t('placeholders.operator')" class="operator-select" (onChange)="onOperatorChange(ruleCtrl)"/>
|
||||
|
||||
@if (!['is_empty', 'is_not_empty'].includes(ruleCtrl.get('operator')?.value)) {
|
||||
@if (ruleCtrl.get('operator')?.value === 'in_between') {
|
||||
@if (ruleCtrl.get('field')?.value === 'publishedDate') {
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="dd-M-yy" placeholder="Start Year" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="dd-M-yy" placeholder="End Year" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="dd-M-yy" [placeholder]="t('placeholders.startYear')" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="dd-M-yy" [placeholder]="t('placeholders.endYear')" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'dateFinished') {
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="dd-M-yy" placeholder="Start Date" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="dd-M-yy" placeholder="End Date" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueStart')" dateFormat="dd-M-yy" [placeholder]="t('placeholders.startDate')" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
<p-datepicker [formControl]="ruleCtrl.get('valueEnd')" dateFormat="dd-M-yy" [placeholder]="t('placeholders.endDate')" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'number') {
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" [min]="0" class="value-input" placeholder="Start Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" [min]="0" class="value-input" placeholder="End Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" [min]="0" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" [min]="0" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
|
||||
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'decimal') {
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" placeholder="Start Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" placeholder="End Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueStart')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.startValue')" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber [formControl]="ruleCtrl.get('valueEnd')" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
|
||||
} @else {
|
||||
<input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" placeholder="Start Value"/>
|
||||
<input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" placeholder="End Value"/>
|
||||
<input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" [placeholder]="t('placeholders.startValue')"/>
|
||||
<input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" [placeholder]="t('placeholders.endValue')"/>
|
||||
}
|
||||
} @else {
|
||||
@if (ruleCtrl.get('field')?.value === 'publishedDate') {
|
||||
@@ -142,37 +143,37 @@
|
||||
} @else if (ruleCtrl.get('field')?.value === 'dateFinished') {
|
||||
<p-datepicker formControlName="value" dateFormat="dd-M-yy" appendTo="body" fluid class="value-input"></p-datepicker>
|
||||
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'number') {
|
||||
<p-inputNumber formControlName="value" class="value-input" mode="decimal" placeholder="Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber formControlName="value" class="value-input" mode="decimal" [placeholder]="t('placeholders.value')" [showButtons]="true"></p-inputNumber>
|
||||
} @else if (numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.type === 'decimal') {
|
||||
<p-inputNumber formControlName="value" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" placeholder="Value" [showButtons]="true"></p-inputNumber>
|
||||
<p-inputNumber formControlName="value" mode="decimal" [minFractionDigits]="1" [maxFractionDigits]="1" [min]="0" [max]="numericFieldConfigMap.get(ruleCtrl.get('field')?.value)?.max || 10" class="value-input" [placeholder]="t('placeholders.value')"></p-inputNumber>
|
||||
} @else if (['includes_any', 'includes_all', 'excludes_all'].includes(ruleCtrl.get('operator')?.value)) {
|
||||
@if (ruleCtrl.get('field')?.value === 'readStatus') {
|
||||
<p-multiSelect [options]="readStatusOptions" formControlName="value" display="chip" class="value-input" appendTo="body" placeholder="Select Statuses"></p-multiSelect>
|
||||
<p-multiSelect [options]="readStatusOptions" formControlName="value" display="chip" class="value-input" appendTo="body" [placeholder]="t('placeholders.selectStatuses')"></p-multiSelect>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'fileType') {
|
||||
<p-multiSelect [options]="fileType" formControlName="value" display="chip" class="value-input" appendTo="body" placeholder="Select File Types"></p-multiSelect>
|
||||
<p-multiSelect [options]="fileType" formControlName="value" display="chip" class="value-input" appendTo="body" [placeholder]="t('placeholders.selectFileTypes')"></p-multiSelect>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'library') {
|
||||
<p-multiSelect [options]="libraryOptions" formControlName="value" display="chip" class="value-input" appendTo="body" placeholder="Select Libraries"></p-multiSelect>
|
||||
<p-multiSelect [options]="libraryOptions" formControlName="value" display="chip" class="value-input" appendTo="body" [placeholder]="t('placeholders.selectLibraries')"></p-multiSelect>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'shelf') {
|
||||
<p-multiSelect [options]="shelfOptions" formControlName="value" display="chip" class="value-input" appendTo="body" placeholder="Select Shelves"></p-multiSelect>
|
||||
<p-multiSelect [options]="shelfOptions" formControlName="value" display="chip" class="value-input" appendTo="body" [placeholder]="t('placeholders.selectShelves')"></p-multiSelect>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'categories') {
|
||||
<p-multiSelect [options]="categoryOptions" formControlName="value" display="chip" class="value-input" appendTo="body" placeholder="Select Genres"></p-multiSelect>
|
||||
<p-multiSelect [options]="categoryOptions" formControlName="value" display="chip" class="value-input" appendTo="body" [placeholder]="t('placeholders.selectGenres')"></p-multiSelect>
|
||||
} @else {
|
||||
<div class="autocomplete-wrapper">
|
||||
<p-autoComplete [formControl]="ruleCtrl.get('value')" [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" placeholder="Enter values (press Enter)" (onBlur)="onAutoCompleteBlur(ruleCtrl.get('value'), $event)"></p-autoComplete>
|
||||
<p-autoComplete [formControl]="ruleCtrl.get('value')" [multiple]="true" [typeahead]="false" [dropdown]="false" [forceSelection]="false" [placeholder]="t('placeholders.enterValues')" (onBlur)="onAutoCompleteBlur(ruleCtrl.get('value'), $event)"></p-autoComplete>
|
||||
</div>
|
||||
}
|
||||
} @else if (ruleCtrl.get('field')?.value === 'readStatus') {
|
||||
<p-select [options]="readStatusOptions" formControlName="value" placeholder="Select Status" appendTo="body" class="value-input"></p-select>
|
||||
<p-select [options]="readStatusOptions" formControlName="value" [placeholder]="t('placeholders.selectStatus')" appendTo="body" class="value-input"></p-select>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'fileType') {
|
||||
<p-select [options]="fileType" formControlName="value" placeholder="Select File Type" appendTo="body" class="value-input"></p-select>
|
||||
<p-select [options]="fileType" formControlName="value" [placeholder]="t('placeholders.selectFileType')" appendTo="body" class="value-input"></p-select>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'library') {
|
||||
<p-select [options]="libraryOptions" formControlName="value" placeholder="Select Library" appendTo="body" class="value-input"></p-select>
|
||||
<p-select [options]="libraryOptions" formControlName="value" [placeholder]="t('placeholders.selectLibrary')" appendTo="body" class="value-input"></p-select>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'shelf') {
|
||||
<p-select [options]="shelfOptions" formControlName="value" placeholder="Select Shelf" appendTo="body" class="value-input"></p-select>
|
||||
<p-select [options]="shelfOptions" formControlName="value" [placeholder]="t('placeholders.selectShelf')" appendTo="body" class="value-input"></p-select>
|
||||
} @else if (ruleCtrl.get('field')?.value === 'categories') {
|
||||
<p-select [options]="categoryOptions" formControlName="value" placeholder="Select Genre" appendTo="body" class="value-input"></p-select>
|
||||
<p-select [options]="categoryOptions" formControlName="value" [placeholder]="t('placeholders.selectGenre')" appendTo="body" class="value-input"></p-select>
|
||||
} @else {
|
||||
<input pInputText formControlName="value" class="value-input" placeholder="Value"/>
|
||||
<input pInputText formControlName="value" class="value-input" [placeholder]="t('placeholders.value')"/>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,3 +185,4 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -23,6 +23,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {BookService} from '../../book/service/book.service';
|
||||
import {ShelfService} from '../../book/service/shelf.service';
|
||||
import {Shelf} from '../../book/model/shelf.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
export type RuleOperator =
|
||||
| 'equals'
|
||||
@@ -119,37 +120,49 @@ export type GroupFormGroup = FormGroup<{
|
||||
}>;
|
||||
|
||||
const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
||||
library: {label: 'Library'},
|
||||
shelf: {label: 'Shelf'},
|
||||
readStatus: {label: 'Read Status'},
|
||||
dateFinished: {label: 'Date Finished', type: 'date'},
|
||||
lastReadTime: {label: 'Last Read Time', type: 'date'},
|
||||
metadataScore: {label: 'Metadata Score', type: 'decimal', max: 100},
|
||||
title: {label: 'Title'},
|
||||
authors: {label: 'Authors'},
|
||||
categories: {label: 'Categories'},
|
||||
moods: {label: 'Moods'},
|
||||
tags: {label: 'Tags'},
|
||||
publisher: {label: 'Publisher'},
|
||||
publishedDate: {label: 'Published Date', type: 'date'},
|
||||
personalRating: {label: 'Personal Rating', type: 'decimal', max: 10},
|
||||
pageCount: {label: 'Page Count', type: 'number'},
|
||||
language: {label: 'Language'},
|
||||
isbn13: {label: 'ISBN-13'},
|
||||
isbn10: {label: 'ISBN-10'},
|
||||
seriesName: {label: 'Series Name'},
|
||||
seriesNumber: {label: 'Series Number', type: 'number'},
|
||||
seriesTotal: {label: 'Books in Series', type: 'number'},
|
||||
fileSize: {label: 'File Size (Kb)', type: 'number'},
|
||||
fileType: {label: 'File Type'},
|
||||
subtitle: {label: 'Subtitle'},
|
||||
amazonRating: {label: 'Amazon Rating', type: 'decimal', max: 5},
|
||||
amazonReviewCount: {label: 'Amazon Review Count', type: 'number'},
|
||||
goodreadsRating: {label: 'Goodreads Rating', type: 'decimal', max: 5},
|
||||
goodreadsReviewCount: {label: 'Goodreads Review Count', type: 'number'},
|
||||
hardcoverRating: {label: 'Hardcover Rating', type: 'decimal', max: 5},
|
||||
hardcoverReviewCount: {label: 'Hardcover Review Count', type: 'number'},
|
||||
ranobedbRating: {label: 'Ranobedb Rating', type: 'decimal', max: 5}
|
||||
library: {label: 'library'},
|
||||
shelf: {label: 'shelf'},
|
||||
readStatus: {label: 'readStatus'},
|
||||
dateFinished: {label: 'dateFinished', type: 'date'},
|
||||
lastReadTime: {label: 'lastReadTime', type: 'date'},
|
||||
metadataScore: {label: 'metadataScore', type: 'decimal', max: 100},
|
||||
title: {label: 'title'},
|
||||
authors: {label: 'authors'},
|
||||
categories: {label: 'categories'},
|
||||
moods: {label: 'moods'},
|
||||
tags: {label: 'tags'},
|
||||
publisher: {label: 'publisher'},
|
||||
publishedDate: {label: 'publishedDate', type: 'date'},
|
||||
personalRating: {label: 'personalRating', type: 'decimal', max: 10},
|
||||
pageCount: {label: 'pageCount', type: 'number'},
|
||||
language: {label: 'language'},
|
||||
isbn13: {label: 'isbn13'},
|
||||
isbn10: {label: 'isbn10'},
|
||||
seriesName: {label: 'seriesName'},
|
||||
seriesNumber: {label: 'seriesNumber', type: 'number'},
|
||||
seriesTotal: {label: 'seriesTotal', type: 'number'},
|
||||
fileSize: {label: 'fileSize', type: 'number'},
|
||||
fileType: {label: 'fileType'},
|
||||
subtitle: {label: 'subtitle'},
|
||||
amazonRating: {label: 'amazonRating', type: 'decimal', max: 5},
|
||||
amazonReviewCount: {label: 'amazonReviewCount', type: 'number'},
|
||||
goodreadsRating: {label: 'goodreadsRating', type: 'decimal', max: 5},
|
||||
goodreadsReviewCount: {label: 'goodreadsReviewCount', type: 'number'},
|
||||
hardcoverRating: {label: 'hardcoverRating', type: 'decimal', max: 5},
|
||||
hardcoverReviewCount: {label: 'hardcoverReviewCount', type: 'number'},
|
||||
ranobedbRating: {label: 'ranobedbRating', type: 'decimal', max: 5}
|
||||
};
|
||||
|
||||
const READ_STATUS_KEYS: Record<string, string> = {
|
||||
UNREAD: 'unread',
|
||||
READING: 'reading',
|
||||
RE_READING: 'reReading',
|
||||
READ: 'read',
|
||||
PARTIALLY_READ: 'partiallyRead',
|
||||
PAUSED: 'paused',
|
||||
WONT_READ: 'wontRead',
|
||||
ABANDONED: 'abandoned',
|
||||
UNSET: 'unset'
|
||||
};
|
||||
|
||||
@Component({
|
||||
@@ -169,30 +182,36 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
||||
AutoComplete,
|
||||
CheckboxModule,
|
||||
IconDisplayComponent,
|
||||
Tooltip
|
||||
Tooltip,
|
||||
TranslocoDirective
|
||||
]
|
||||
})
|
||||
export class MagicShelfComponent implements OnInit {
|
||||
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
numericFieldConfigMap = new Map<RuleField, FieldConfig>(
|
||||
Object.entries(FIELD_CONFIGS)
|
||||
.filter(([_, config]) => config.type)
|
||||
.map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}])
|
||||
);
|
||||
|
||||
conditionOptions: { label: string; value: 'and' | 'or' }[] = [
|
||||
{label: 'AND', value: 'and'},
|
||||
{label: 'OR', value: 'or'},
|
||||
];
|
||||
get conditionOptions(): { label: string; value: 'and' | 'or' }[] {
|
||||
return [
|
||||
{label: this.t.translate('magicShelf.conditions.and'), value: 'and'},
|
||||
{label: this.t.translate('magicShelf.conditions.or'), value: 'or'},
|
||||
];
|
||||
}
|
||||
|
||||
fieldOptions = Object.entries(FIELD_CONFIGS).map(([key, config]) => {
|
||||
// Use "Genre" instead of "Categories" for user-facing label
|
||||
const label = key === 'categories' ? 'Genre' : config.label;
|
||||
return {
|
||||
label: label,
|
||||
value: key as RuleField
|
||||
};
|
||||
});
|
||||
get fieldOptions() {
|
||||
return Object.entries(FIELD_CONFIGS).map(([key, config]) => {
|
||||
const translationKey = key === 'categories' ? 'genre' : config.label;
|
||||
return {
|
||||
label: this.t.translate(`magicShelf.fields.${translationKey}`),
|
||||
value: key as RuleField
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
fileType: { label: string; value: string }[] = [
|
||||
{label: 'PDF', value: 'pdf'},
|
||||
@@ -205,10 +224,12 @@ export class MagicShelfComponent implements OnInit {
|
||||
{label: 'AZW3', value: 'azw3'}
|
||||
];
|
||||
|
||||
readStatusOptions = Object.entries(ReadStatus).map(([key, value]) => ({
|
||||
label: key.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, l => l.toUpperCase()),
|
||||
value
|
||||
}));
|
||||
get readStatusOptions() {
|
||||
return Object.entries(ReadStatus).map(([key, value]) => ({
|
||||
label: this.t.translate(`magicShelf.readStatuses.${READ_STATUS_KEYS[key]}`),
|
||||
value
|
||||
}));
|
||||
}
|
||||
|
||||
libraries: Library[] = [];
|
||||
libraryOptions: { label: string; value: number }[] = [];
|
||||
@@ -343,31 +364,31 @@ export class MagicShelfComponent implements OnInit {
|
||||
|
||||
getOperatorOptionsForField(field: RuleField | null | undefined) {
|
||||
const baseOperators = [
|
||||
{label: 'Equals', value: 'equals'},
|
||||
{label: '≠ Not Equal', value: 'not_equals'},
|
||||
{label: 'Empty', value: 'is_empty'},
|
||||
{label: 'Not Empty', value: 'is_not_empty'},
|
||||
{label: this.t.translate('magicShelf.operators.equals'), value: 'equals'},
|
||||
{label: this.t.translate('magicShelf.operators.notEqual'), value: 'not_equals'},
|
||||
{label: this.t.translate('magicShelf.operators.empty'), value: 'is_empty'},
|
||||
{label: this.t.translate('magicShelf.operators.notEmpty'), value: 'is_not_empty'},
|
||||
];
|
||||
|
||||
const multiValueOperators = [
|
||||
{label: 'Includes Any', value: 'includes_any'},
|
||||
{label: 'Excludes All', value: 'excludes_all'},
|
||||
{label: 'Includes All', value: 'includes_all'},
|
||||
{label: this.t.translate('magicShelf.operators.includesAny'), value: 'includes_any'},
|
||||
{label: this.t.translate('magicShelf.operators.excludesAll'), value: 'excludes_all'},
|
||||
{label: this.t.translate('magicShelf.operators.includesAll'), value: 'includes_all'},
|
||||
];
|
||||
|
||||
const textOperators = [
|
||||
{label: 'Contains', value: 'contains'},
|
||||
{label: 'Doesn\'t Contain', value: 'does_not_contain'},
|
||||
{label: 'Starts With', value: 'starts_with'},
|
||||
{label: 'Ends With', value: 'ends_with'},
|
||||
{label: this.t.translate('magicShelf.operators.contains'), value: 'contains'},
|
||||
{label: this.t.translate('magicShelf.operators.doesNotContain'), value: 'does_not_contain'},
|
||||
{label: this.t.translate('magicShelf.operators.startsWith'), value: 'starts_with'},
|
||||
{label: this.t.translate('magicShelf.operators.endsWith'), value: 'ends_with'},
|
||||
];
|
||||
|
||||
const comparisonOperators = [
|
||||
{label: '> Greater Than', value: 'greater_than'},
|
||||
{label: '≥ Greater or Equal', value: 'greater_than_equal_to'},
|
||||
{label: '< Less Than', value: 'less_than'},
|
||||
{label: '≤ Less or Equal', value: 'less_than_equal_to'},
|
||||
{label: 'Between', value: 'in_between'},
|
||||
{label: this.t.translate('magicShelf.operators.greaterThan'), value: 'greater_than'},
|
||||
{label: this.t.translate('magicShelf.operators.greaterOrEqual'), value: 'greater_than_equal_to'},
|
||||
{label: this.t.translate('magicShelf.operators.lessThan'), value: 'less_than'},
|
||||
{label: this.t.translate('magicShelf.operators.lessOrEqual'), value: 'less_than_equal_to'},
|
||||
{label: this.t.translate('magicShelf.operators.between'), value: 'in_between'},
|
||||
];
|
||||
|
||||
if (!field) return [...baseOperators, ...multiValueOperators];
|
||||
@@ -525,7 +546,7 @@ export class MagicShelfComponent implements OnInit {
|
||||
|
||||
submit() {
|
||||
if (!this.hasAtLeastOneValidRule(this.group)) {
|
||||
this.messageService.add({severity: 'warn', summary: 'Validation Error', detail: 'You must add at least one valid rule before saving.'});
|
||||
this.messageService.add({severity: 'warn', summary: this.t.translate('magicShelf.toast.validationErrorSummary'), detail: this.t.translate('magicShelf.toast.validationErrorDetail')});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -541,7 +562,7 @@ export class MagicShelfComponent implements OnInit {
|
||||
group: cleanedGroup
|
||||
}).subscribe({
|
||||
next: (savedShelf) => {
|
||||
this.messageService.add({severity: 'success', summary: 'Success', detail: 'Magic shelf saved successfully.'});
|
||||
this.messageService.add({severity: 'success', summary: this.t.translate('magicShelf.toast.successSummary'), detail: this.t.translate('magicShelf.toast.successDetail')});
|
||||
if (savedShelf?.id) {
|
||||
this.shelfId = savedShelf.id;
|
||||
this.form.patchValue({
|
||||
@@ -554,8 +575,8 @@ export class MagicShelfComponent implements OnInit {
|
||||
error: (err) => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: err?.error?.message || 'Failed to save magic shelf.'
|
||||
summary: this.t.translate('magicShelf.toast.errorSummary'),
|
||||
detail: err?.error?.message || this.t.translate('magicShelf.toast.errorDetailDefault')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
+2
-2
@@ -452,7 +452,7 @@
|
||||
[options]="ageRatingOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select"
|
||||
[placeholder]="t('selectPlaceholder')"
|
||||
[showClear]="true"
|
||||
appendTo="body">
|
||||
</p-select>
|
||||
@@ -473,7 +473,7 @@
|
||||
[options]="contentRatingOptions"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select"
|
||||
[placeholder]="t('selectPlaceholder')"
|
||||
[showClear]="true"
|
||||
appendTo="body">
|
||||
</p-select>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<pdf-text-editor></pdf-text-editor>
|
||||
<pdf-draw-editor></pdf-draw-editor>
|
||||
<div class="verticalToolbarSeparator"></div>
|
||||
<button class="toolbar-btn" [title]="isDarkTheme ? 'Switch to Light Mode' : 'Switch to Dark Mode'" (click)="isDarkTheme = !isDarkTheme">
|
||||
<button class="toolbar-btn" [title]="isDarkTheme ? ('readerPdf.toolbar.switchToLightMode' | transloco) : ('readerPdf.toolbar.switchToDarkMode' | transloco)" (click)="isDarkTheme = !isDarkTheme">
|
||||
@if (isDarkTheme) {
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>
|
||||
@@ -67,7 +67,7 @@
|
||||
</svg>
|
||||
}
|
||||
</button>
|
||||
<button id="closePdfReaderButton" class="close-reader-btn" title="Close PDF Reader" (click)="closeReader()">
|
||||
<button id="closePdfReaderButton" class="close-reader-btn" [title]="'readerPdf.toolbar.closePdfReader' | transloco" (click)="closeReader()">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
||||
</svg>
|
||||
|
||||
@@ -13,13 +13,14 @@ import {PdfAnnotationService} from '../../../shared/service/pdf-annotation.servi
|
||||
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||
import {ReadingSessionService} from '../../../shared/service/reading-session.service';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pdf-reader',
|
||||
standalone: true,
|
||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner],
|
||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner, TranslocoPipe],
|
||||
templateUrl: './pdf-reader.component.html',
|
||||
styleUrl: './pdf-reader.component.scss',
|
||||
})
|
||||
@@ -59,6 +60,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
private location = inject(Location);
|
||||
private pdfViewerService = inject(NgxExtendedPdfViewerService);
|
||||
private pdfAnnotationService = inject(PdfAnnotationService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.annotationSaveSubscription = this.annotationSaveSubject
|
||||
@@ -101,7 +103,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
||||
this.isLoading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to load the book'});
|
||||
this.messageService.add({severity: 'error', summary: this.t.translate('common.error'), detail: this.t.translate('readerPdf.toast.failedToLoadBook')});
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ export class CustomFontsComponent implements OnInit {
|
||||
this.customFonts = this.customFonts.filter(f => f.id !== font.id);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Success',
|
||||
summary: this.t.translate('common.success'),
|
||||
detail: this.t.translate('settingsReader.fonts.deleteSuccess', {name: font.fontName})
|
||||
});
|
||||
},
|
||||
|
||||
@@ -203,6 +203,16 @@ export const DEFAULT_VISIBLE_FILTERS: VisibleFilterType[] = [
|
||||
'matchScore', 'publisher', 'publishedDate', 'fileSize'
|
||||
];
|
||||
|
||||
// Translation key for each filter option — use book.filter.labels.<value>
|
||||
export const ALL_FILTER_OPTION_VALUES: VisibleFilterType[] = [
|
||||
'author', 'category', 'series', 'bookType', 'readStatus',
|
||||
'personalRating', 'library', 'tag', 'ageRating', 'contentRating',
|
||||
'matchScore', 'publisher', 'publishedDate', 'fileSize', 'shelf',
|
||||
'shelfStatus', 'language', 'pageCount', 'mood', 'amazonRating',
|
||||
'goodreadsRating', 'hardcoverRating', 'narrator',
|
||||
'comicCharacter', 'comicTeam', 'comicLocation', 'comicCreator'
|
||||
];
|
||||
|
||||
export const ALL_FILTER_OPTIONS: { label: string; value: VisibleFilterType }[] = [
|
||||
{label: 'Author', value: 'author'},
|
||||
{label: 'Genre', value: 'category'},
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ export class UserProfileDialogComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
if (this.editUserData.name === this.currentUser.name && this.editUserData.email === this.currentUser.email) {
|
||||
this.messageService.add({severity: 'info', summary: 'Info', detail: this.t.translate('settingsProfile.toast.noChanges')});
|
||||
this.messageService.add({severity: 'info', summary: this.t.translate('common.info'), detail: this.t.translate('settingsProfile.toast.noChanges')});
|
||||
this.isEditing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
+7
-3
@@ -1,6 +1,7 @@
|
||||
import {Component, ElementRef, inject, OnDestroy, OnInit, viewChild} from '@angular/core';
|
||||
import {Select} from 'primeng/select';
|
||||
import {ALL_FILTER_OPTIONS, BookFilterMode, DEFAULT_VISIBLE_FILTERS, User, UserService, UserSettings, UserState, VisibleFilterType} from '../../user-management/user.service';
|
||||
import {ALL_FILTER_OPTION_VALUES, ALL_FILTER_OPTIONS, BookFilterMode, DEFAULT_VISIBLE_FILTERS, User, UserService, UserSettings, UserState, VisibleFilterType} from '../../user-management/user.service';
|
||||
import {FILTER_LABEL_KEYS} from '../../../book/components/book-browser/book-filter/book-filter.config';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {Observable, Subject} from 'rxjs';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
@@ -100,11 +101,14 @@ export class FilterPreferencesComponent implements OnInit, OnDestroy {
|
||||
|
||||
get availableFilters(): {label: string; value: string}[] {
|
||||
const used = new Set(this.selectedVisibleFilters);
|
||||
return this.allFilterOptions.filter(opt => !used.has(opt.value));
|
||||
return ALL_FILTER_OPTION_VALUES
|
||||
.filter(v => !used.has(v))
|
||||
.map(v => ({label: this.getFilterLabel(v), value: v}));
|
||||
}
|
||||
|
||||
getFilterLabel(value: string): string {
|
||||
return this.allFilterOptions.find(opt => opt.value === value)?.label ?? value;
|
||||
const key = FILTER_LABEL_KEYS[value as keyof typeof FILTER_LABEL_KEYS];
|
||||
return key ? this.t.translate(key) : value;
|
||||
}
|
||||
|
||||
onDrop(event: CdkDragDrop<VisibleFilterType[]>): void {
|
||||
|
||||
+7
-5
@@ -1,15 +1,16 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.authorUniverse'">
|
||||
<div class="author-universe-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-globe author-title-icon"></i>
|
||||
Author Universe
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Explore your authors by books, ratings, and reading progress</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (totalAuthors > 0) {
|
||||
<div class="author-count-badge">
|
||||
{{ totalAuthors }} authors
|
||||
{{ t('authorsBadge', { count: totalAuthors }) }}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -18,7 +19,7 @@
|
||||
<div class="chart-legend-info">
|
||||
<span class="legend-note">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Bubble size = total pages • Position = books vs rating • Color = completion %
|
||||
{{ t('legendNote') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +48,8 @@
|
||||
@if (totalAuthors === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No author data available. Authors need at least 2 books to appear.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+33
-26
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface AuthorStats {
|
||||
name: string;
|
||||
@@ -41,13 +42,14 @@ const COMPLETION_COLORS = {
|
||||
@Component({
|
||||
selector: 'app-author-universe-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './author-universe-chart.component.html',
|
||||
styleUrls: ['./author-universe-chart.component.scss']
|
||||
})
|
||||
export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'bubble' as const;
|
||||
@@ -104,7 +106,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Books in Library',
|
||||
text: this.t.translate('statsLibrary.authorUniverse.axisBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -130,7 +132,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Average Rating',
|
||||
text: this.t.translate('statsLibrary.authorUniverse.axisRating'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -349,7 +351,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (highCompletion.length > 0) {
|
||||
datasets.push({
|
||||
label: '75-100% Read',
|
||||
label: this.t.translate('statsLibrary.authorUniverse.legend75to100'),
|
||||
data: highCompletion,
|
||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.high, 0.6),
|
||||
borderColor: COMPLETION_COLORS.high,
|
||||
@@ -361,7 +363,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (mediumCompletion.length > 0) {
|
||||
datasets.push({
|
||||
label: '50-74% Read',
|
||||
label: this.t.translate('statsLibrary.authorUniverse.legend50to74'),
|
||||
data: mediumCompletion,
|
||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.medium, 0.6),
|
||||
borderColor: COMPLETION_COLORS.medium,
|
||||
@@ -373,7 +375,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (lowCompletion.length > 0) {
|
||||
datasets.push({
|
||||
label: '25-49% Read',
|
||||
label: this.t.translate('statsLibrary.authorUniverse.legend25to49'),
|
||||
data: lowCompletion,
|
||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.low, 0.6),
|
||||
borderColor: COMPLETION_COLORS.low,
|
||||
@@ -385,7 +387,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (minimalCompletion.length > 0) {
|
||||
datasets.push({
|
||||
label: '1-24% Read',
|
||||
label: this.t.translate('statsLibrary.authorUniverse.legend1to24'),
|
||||
data: minimalCompletion,
|
||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.minimal, 0.6),
|
||||
borderColor: COMPLETION_COLORS.minimal,
|
||||
@@ -397,7 +399,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (unread.length > 0) {
|
||||
datasets.push({
|
||||
label: 'Unread',
|
||||
label: this.t.translate('statsLibrary.authorUniverse.legendUnread'),
|
||||
data: unread,
|
||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.unread, 0.6),
|
||||
borderColor: COMPLETION_COLORS.unread,
|
||||
@@ -421,20 +423,20 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
// Most prolific author
|
||||
const mostProlific = authorStats[0];
|
||||
if (mostProlific) {
|
||||
insights.push(`Most collected: ${mostProlific.name} with ${mostProlific.bookCount} books`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightMostCollected', {name: mostProlific.name, count: mostProlific.bookCount}));
|
||||
}
|
||||
|
||||
// Highest rated author (with at least 2 books)
|
||||
const ratedAuthors = authorStats.filter(a => a.avgRating > 0);
|
||||
if (ratedAuthors.length > 0) {
|
||||
const highestRated = ratedAuthors.reduce((a, b) => a.avgRating > b.avgRating ? a : b);
|
||||
insights.push(`Highest rated: ${highestRated.name} (${highestRated.avgRating.toFixed(1)}★)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightHighestRated', {name: highestRated.name, rating: `${highestRated.avgRating.toFixed(1)}\u2605`}));
|
||||
}
|
||||
|
||||
// Most pages by author
|
||||
const mostPages = authorStats.reduce((a, b) => a.totalPages > b.totalPages ? a : b);
|
||||
if (mostPages.totalPages > 0) {
|
||||
insights.push(`Most pages: ${mostPages.name} (${mostPages.totalPages.toLocaleString()} pages)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightMostPages', {name: mostPages.name, count: mostPages.totalPages.toLocaleString()}));
|
||||
}
|
||||
|
||||
// Best completion rate (with at least 3 books)
|
||||
@@ -444,7 +446,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
a.completionRate > b.completionRate ? a : b
|
||||
);
|
||||
if (bestCompletion.completionRate > 0) {
|
||||
insights.push(`Most read: ${bestCompletion.name} (${Math.round(bestCompletion.completionRate)}% complete)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightMostRead', {name: bestCompletion.name, percent: Math.round(bestCompletion.completionRate)}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,7 +454,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
const hiddenGems = ratedAuthors.filter(a => a.bookCount <= 3 && a.avgRating >= 4.0);
|
||||
if (hiddenGems.length > 0) {
|
||||
const gem = hiddenGems.reduce((a, b) => a.avgRating > b.avgRating ? a : b);
|
||||
insights.push(`Hidden gem: ${gem.name} (${gem.avgRating.toFixed(1)}★ across ${gem.bookCount} books)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightHiddenGem', {name: gem.name, rating: `${gem.avgRating.toFixed(1)}\u2605`, count: gem.bookCount}));
|
||||
}
|
||||
|
||||
// Biggest backlog - author with most unread books
|
||||
@@ -463,7 +465,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
const unreadCount = biggestBacklog.bookCount - biggestBacklog.readCount;
|
||||
if (unreadCount >= 2) {
|
||||
insights.push(`Biggest backlog: ${biggestBacklog.name} (${unreadCount} unread books)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightBiggestBacklog', {name: biggestBacklog.name, count: unreadCount}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,7 +475,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
const top3Books = authorStats.slice(0, 3).reduce((sum, a) => sum + a.bookCount, 0);
|
||||
const concentration = Math.round((top3Books / totalBooks) * 100);
|
||||
if (concentration >= 25) {
|
||||
insights.push(`Top 3 concentration: ${concentration}% of your collection`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightTop3Concentration', {percent: concentration}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +487,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
const avgPages = Math.round(longestReads.totalPages / longestReads.bookCount);
|
||||
if (avgPages >= 300) {
|
||||
insights.push(`Longest reads: ${longestReads.name} (avg ${avgPages} pages/book)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightLongestReads', {name: longestReads.name, pages: avgPages}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,14 +497,14 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
const mostVersatile = versatileAuthors.reduce((a, b) =>
|
||||
a.categories.length > b.categories.length ? a : b
|
||||
);
|
||||
insights.push(`Most versatile: ${mostVersatile.name} (${mostVersatile.categories.length} genres)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightMostVersatile', {name: mostVersatile.name, count: mostVersatile.categories.length}));
|
||||
}
|
||||
|
||||
// Completely unread - authors with 0% completion but multiple books
|
||||
const completelyUnread = authorStats.filter(a => a.completionRate === 0 && a.bookCount >= 2);
|
||||
if (completelyUnread.length > 0) {
|
||||
const topUnread = completelyUnread.reduce((a, b) => a.bookCount > b.bookCount ? a : b);
|
||||
insights.push(`Untouched author: ${topUnread.name} (${topUnread.bookCount} unread books)`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightUntouchedAuthor', {name: topUnread.name, count: topUnread.bookCount}));
|
||||
}
|
||||
|
||||
// Total reading commitment
|
||||
@@ -510,7 +512,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
const totalRead = authorStats.reduce((sum, a) => sum + (a.totalPages * a.completionRate / 100), 0);
|
||||
if (totalPages > 0) {
|
||||
const overallProgress = Math.round((totalRead / totalPages) * 100);
|
||||
insights.push(`Overall progress: ${overallProgress}% pages read across all authors`);
|
||||
insights.push(this.t.translate('statsLibrary.authorUniverse.insightOverallProgress', {percent: overallProgress}));
|
||||
}
|
||||
|
||||
return insights;
|
||||
@@ -557,19 +559,24 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||
const stats = raw.authorStats;
|
||||
|
||||
const ratingText = stats.avgRating > 0
|
||||
? `${stats.avgRating.toFixed(2)} ★`
|
||||
: 'No ratings';
|
||||
? `${stats.avgRating.toFixed(2)} \u2605`
|
||||
: this.t.translate('statsLibrary.authorUniverse.tooltipNoRatings');
|
||||
|
||||
const categoriesHtml = stats.categories.length > 0
|
||||
? `<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">Genres: ${stats.categories.slice(0, 3).join(', ')}</div>`
|
||||
? `<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">${this.t.translate('statsLibrary.authorUniverse.tooltipGenres', {genres: stats.categories.slice(0, 3).join(', ')})}</div>`
|
||||
: '';
|
||||
|
||||
const booksLine = this.t.translate('statsLibrary.authorUniverse.tooltipBooks', {count: stats.bookCount});
|
||||
const pagesLine = this.t.translate('statsLibrary.authorUniverse.tooltipTotalPages', {count: stats.totalPages.toLocaleString()});
|
||||
const ratingLine = this.t.translate('statsLibrary.authorUniverse.tooltipAvgRating', {rating: ratingText});
|
||||
const readLine = this.t.translate('statsLibrary.authorUniverse.tooltipRead', {read: stats.readCount, total: stats.bookCount, percent: Math.round(stats.completionRate)});
|
||||
|
||||
tooltipEl.innerHTML = `
|
||||
<div style="color:#fff;font-size:14px;font-weight:700;margin-bottom:6px">${stats.name}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">Books: ${stats.bookCount}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">Total Pages: ${stats.totalPages.toLocaleString()}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">Avg Rating: ${ratingText}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">Read: ${stats.readCount}/${stats.bookCount} (${Math.round(stats.completionRate)}%)</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">${booksLine}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">${pagesLine}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">${ratingLine}</div>
|
||||
<div style="color:rgba(255,255,255,0.9);font-size:12px;line-height:1.6">${readLine}</div>
|
||||
${categoriesHtml}
|
||||
`;
|
||||
|
||||
|
||||
+5
-3
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.bookFormats'">
|
||||
<div class="book-formats-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-file formats-title-icon"></i>
|
||||
Book Formats
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Distribution of file types in your library</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +23,8 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No books available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+4
-2
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface FormatStats {
|
||||
format: string;
|
||||
@@ -29,13 +30,14 @@ const FORMAT_COLORS: Record<string, string> = {
|
||||
@Component({
|
||||
selector: 'app-book-formats-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './book-formats-chart.component.html',
|
||||
styleUrls: ['./book-formats-chart.component.scss']
|
||||
})
|
||||
export class BookFormatsChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'pie' as const;
|
||||
@@ -79,7 +81,7 @@ export class BookFormatsChartComponent implements OnInit, OnDestroy {
|
||||
const value = context.parsed;
|
||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
return `${context.label}: ${value} books (${percentage}%)`;
|
||||
return this.t.translate('statsLibrary.bookFormats.tooltipLabel', {label: context.label, value, percentage});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+5
-3
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.language'">
|
||||
<div class="language-chart-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-globe language-title-icon"></i>
|
||||
Languages
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Languages represented in your collection</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +23,8 @@
|
||||
@if (booksWithLanguage === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No language data available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+4
-2
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface LanguageStats {
|
||||
language: string;
|
||||
@@ -131,13 +132,14 @@ const LANGUAGE_NAMES: Record<string, string> = {
|
||||
@Component({
|
||||
selector: 'app-language-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './language-chart.component.html',
|
||||
styleUrls: ['./language-chart.component.scss']
|
||||
})
|
||||
export class LanguageChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'pie' as const;
|
||||
@@ -182,7 +184,7 @@ export class LanguageChartComponent implements OnInit, OnDestroy {
|
||||
const value = context.parsed;
|
||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
return `${context.label}: ${value} books (${percentage}%)`;
|
||||
return this.t.translate('statsLibrary.language.tooltipLabel', {label: context.label, value, percentage});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+5
-3
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.metadataScore'">
|
||||
<div class="metadata-score-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-check-circle score-title-icon"></i>
|
||||
Metadata Score
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Quality of book metadata in your library</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +23,8 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No metadata score data available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+19
-15
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ScoreRange {
|
||||
label: string;
|
||||
@@ -25,24 +26,27 @@ interface ScoreStats {
|
||||
|
||||
type ScoreChartData = ChartData<'doughnut', number[], string>;
|
||||
|
||||
const SCORE_RANGES: ScoreRange[] = [
|
||||
{label: 'Excellent (90-100%)', min: 90, max: 100, color: '#16A34A'},
|
||||
{label: 'Good (70-89%)', min: 70, max: 89, color: '#22C55E'},
|
||||
{label: 'Fair (50-69%)', min: 50, max: 69, color: '#F59E0B'},
|
||||
{label: 'Poor (25-49%)', min: 25, max: 49, color: '#F97316'},
|
||||
{label: 'Very Poor (0-24%)', min: 0, max: 24, color: '#DC2626'}
|
||||
const SCORE_RANGE_KEYS = ['excellent', 'good', 'fair', 'poor', 'veryPoor'] as const;
|
||||
|
||||
const SCORE_RANGE_DEFS: { key: typeof SCORE_RANGE_KEYS[number]; min: number; max: number; color: string }[] = [
|
||||
{key: 'excellent', min: 90, max: 100, color: '#16A34A'},
|
||||
{key: 'good', min: 70, max: 89, color: '#22C55E'},
|
||||
{key: 'fair', min: 50, max: 69, color: '#F59E0B'},
|
||||
{key: 'poor', min: 25, max: 49, color: '#F97316'},
|
||||
{key: 'veryPoor', min: 0, max: 24, color: '#DC2626'}
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'app-metadata-score-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './metadata-score-chart.component.html',
|
||||
styleUrls: ['./metadata-score-chart.component.scss']
|
||||
})
|
||||
export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'doughnut' as const;
|
||||
@@ -89,7 +93,7 @@ export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
||||
const value = context.parsed;
|
||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
return `${value} books (${percentage}%)`;
|
||||
return this.t.translate('statsLibrary.metadataScore.tooltipLabel', {value, percentage});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -182,15 +186,15 @@ export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
||||
private calculateScoreStats(books: Book[]): ScoreStats[] {
|
||||
const rangeCounts = new Map<string, { count: number, color: string }>();
|
||||
|
||||
SCORE_RANGES.forEach(range => {
|
||||
rangeCounts.set(range.label, {count: 0, color: range.color});
|
||||
SCORE_RANGE_DEFS.forEach(range => {
|
||||
rangeCounts.set(range.key, {count: 0, color: range.color});
|
||||
});
|
||||
|
||||
books.forEach(book => {
|
||||
const score = book.metadataMatchScore!;
|
||||
for (const range of SCORE_RANGES) {
|
||||
for (const range of SCORE_RANGE_DEFS) {
|
||||
if (score >= range.min && score <= range.max) {
|
||||
const data = rangeCounts.get(range.label)!;
|
||||
const data = rangeCounts.get(range.key)!;
|
||||
data.count++;
|
||||
break;
|
||||
}
|
||||
@@ -198,11 +202,11 @@ export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
|
||||
const total = books.length;
|
||||
return SCORE_RANGES
|
||||
return SCORE_RANGE_DEFS
|
||||
.map(range => {
|
||||
const data = rangeCounts.get(range.label)!;
|
||||
const data = rangeCounts.get(range.key)!;
|
||||
return {
|
||||
range: range.label,
|
||||
range: this.t.translate(`statsLibrary.metadataScore.${range.key}`),
|
||||
count: data.count,
|
||||
percentage: (data.count / total) * 100,
|
||||
color: data.color
|
||||
|
||||
+5
-3
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.pageCount'">
|
||||
<div class="page-count-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-book page-title-icon"></i>
|
||||
Page Count Distribution
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Distribution of book lengths in your library</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,7 +23,8 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No page count data available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+9
-5
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface PageRange {
|
||||
label: string;
|
||||
@@ -37,13 +38,14 @@ const PAGE_RANGES: PageRange[] = [
|
||||
@Component({
|
||||
selector: 'app-page-count-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './page-count-chart.component.html',
|
||||
styleUrls: ['./page-count-chart.component.scss']
|
||||
})
|
||||
export class PageCountChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'bar' as const;
|
||||
@@ -69,10 +71,12 @@ export class PageCountChartComponent implements OnInit, OnDestroy {
|
||||
titleFont: {size: 13, weight: 'bold'},
|
||||
bodyFont: {size: 11},
|
||||
callbacks: {
|
||||
title: (context) => `${context[0].label} pages`,
|
||||
title: (context) => this.t.translate('statsLibrary.pageCount.tooltipTitle', {label: context[0].label}),
|
||||
label: (context) => {
|
||||
const value = context.parsed.y;
|
||||
return `${value} book${value === 1 ? '' : 's'}`;
|
||||
return value === 1
|
||||
? this.t.translate('statsLibrary.pageCount.tooltipLabel', {value})
|
||||
: this.t.translate('statsLibrary.pageCount.tooltipLabelPlural', {value});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -82,7 +86,7 @@ export class PageCountChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Page Count',
|
||||
text: this.t.translate('statsLibrary.pageCount.axisPageCount'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -102,7 +106,7 @@ export class PageCountChartComponent implements OnInit, OnDestroy {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Books',
|
||||
text: this.t.translate('statsLibrary.pageCount.axisBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
|
||||
+16
-14
@@ -1,15 +1,16 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.publicationTimeline'">
|
||||
<div class="publication-timeline-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-calendar timeline-title-icon"></i>
|
||||
Publication Timeline
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">When were your books originally published?</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (totalBooks > 0) {
|
||||
<div class="books-count-badge">
|
||||
{{ totalBooks }} books with dates
|
||||
{{ t('booksWithDates', { count: totalBooks }) }}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -28,21 +29,21 @@
|
||||
<div class="insights-row">
|
||||
@if (insights.oldestBook) {
|
||||
<div class="insight-item oldest">
|
||||
<span class="insight-label">Oldest</span>
|
||||
<span class="insight-label">{{ t('insightOldest') }}</span>
|
||||
<span class="insight-value">{{ insights.oldestBook.year }}</span>
|
||||
<span class="insight-detail" [title]="insights.oldestBook.title">{{ insights.oldestBook.title }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="insight-item average">
|
||||
<span class="insight-label">Average Year</span>
|
||||
<span class="insight-label">{{ t('insightAverageYear') }}</span>
|
||||
<span class="insight-value">{{ insights.averageYear }}</span>
|
||||
<span class="insight-detail">Median: {{ insights.medianYear }}</span>
|
||||
<span class="insight-detail">{{ t('insightMedian', { year: insights.medianYear }) }}</span>
|
||||
</div>
|
||||
|
||||
@if (insights.newestBook) {
|
||||
<div class="insight-item newest">
|
||||
<span class="insight-label">Newest</span>
|
||||
<span class="insight-label">{{ t('insightNewest') }}</span>
|
||||
<span class="insight-value">{{ insights.newestBook.year }}</span>
|
||||
<span class="insight-detail" [title]="insights.newestBook.title">{{ insights.newestBook.title }}</span>
|
||||
</div>
|
||||
@@ -51,21 +52,21 @@
|
||||
|
||||
<div class="insights-row secondary">
|
||||
<div class="insight-item timespan">
|
||||
<span class="insight-label">Time Span</span>
|
||||
<span class="insight-label">{{ t('insightTimeSpan') }}</span>
|
||||
<span class="insight-value">{{ insights.timeSpan }}</span>
|
||||
<span class="insight-detail">years of literature</span>
|
||||
<span class="insight-detail">{{ t('insightYearsOfLiterature') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item peak">
|
||||
<span class="insight-label">Peak Decade</span>
|
||||
<span class="insight-label">{{ t('insightPeakDecade') }}</span>
|
||||
<span class="insight-value">{{ insights.peakDecade }}</span>
|
||||
<span class="insight-detail">{{ insights.peakDecadeCount }} books</span>
|
||||
<span class="insight-detail">{{ t('insightPeakDecadeBooks', { count: insights.peakDecadeCount }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item decades">
|
||||
<span class="insight-label">Decades Covered</span>
|
||||
<span class="insight-label">{{ t('insightDecadesCovered') }}</span>
|
||||
<span class="insight-value">{{ insights.decadesCovered }}</span>
|
||||
<span class="insight-detail">different eras</span>
|
||||
<span class="insight-detail">{{ t('insightDifferentEras') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,7 +76,8 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No publication date data available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+7
-4
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface DecadeStats {
|
||||
decade: string;
|
||||
@@ -52,13 +53,14 @@ const DECADE_COLORS: Record<string, string> = {
|
||||
@Component({
|
||||
selector: 'app-publication-timeline-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './publication-timeline-chart.component.html',
|
||||
styleUrls: ['./publication-timeline-chart.component.scss']
|
||||
})
|
||||
export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'bar' as const;
|
||||
@@ -128,7 +130,7 @@ export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Books',
|
||||
text: this.t.translate('statsLibrary.publicationTimeline.axisNumberOfBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -169,8 +171,9 @@ export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
||||
callbacks: {
|
||||
label: (context) => {
|
||||
const value = context.parsed.x;
|
||||
const bookText = value === 1 ? 'book' : 'books';
|
||||
return `${value} ${bookText}`;
|
||||
return value === 1
|
||||
? this.t.translate('statsLibrary.publicationTimeline.tooltipBook', {value})
|
||||
: this.t.translate('statsLibrary.publicationTimeline.tooltipBooks', {value});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+20
-18
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.publicationTrend'">
|
||||
<div class="publication-trend-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-line trend-title-icon"></i>
|
||||
Publication Trend
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Books by publication year showing collection trends</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (totalBooks > 0 && yearRange) {
|
||||
<div class="year-range-badge">
|
||||
@@ -27,49 +28,49 @@
|
||||
<div class="insights-section">
|
||||
<div class="insights-row">
|
||||
<div class="insight-item peak">
|
||||
<span class="insight-label">Peak Year</span>
|
||||
<span class="insight-label">{{ t('insightPeakYear') }}</span>
|
||||
<span class="insight-value">{{ insights.peakYear }}</span>
|
||||
<span class="insight-detail">{{ insights.peakYearCount }} books</span>
|
||||
<span class="insight-detail">{{ t('insightPeakYearBooks', { count: insights.peakYearCount }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item recent">
|
||||
<span class="insight-label">Last 10 Years</span>
|
||||
<span class="insight-label">{{ t('insightLast10Years') }}</span>
|
||||
<span class="insight-value">{{ insights.booksLast10YearsPercent }}%</span>
|
||||
<span class="insight-detail">{{ insights.booksLast10Years }} books</span>
|
||||
<span class="insight-detail">{{ t('insightLast10YearsBooks', { count: insights.booksLast10Years }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item average">
|
||||
<span class="insight-label">Avg per Year</span>
|
||||
<span class="insight-label">{{ t('insightAvgPerYear') }}</span>
|
||||
<span class="insight-value">{{ insights.averageBooksPerYear }}</span>
|
||||
<span class="insight-detail">books/year</span>
|
||||
<span class="insight-detail">{{ t('insightBooksPerYear') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item productive">
|
||||
<span class="insight-label">Best 5-Year Span</span>
|
||||
<span class="insight-label">{{ t('insightBest5YearSpan') }}</span>
|
||||
<span class="insight-value">{{ insights.mostProductiveSpan }}</span>
|
||||
<span class="insight-detail">most books published</span>
|
||||
<span class="insight-detail">{{ t('insightMostBooksPublished') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item timespan">
|
||||
<span class="insight-label">Time Span</span>
|
||||
<span class="insight-label">{{ t('insightTimeSpan') }}</span>
|
||||
<span class="insight-value">{{ insights.timeSpan }}</span>
|
||||
<span class="insight-detail">years covered</span>
|
||||
<span class="insight-detail">{{ t('insightYearsCovered') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item century21">
|
||||
<span class="insight-label">21st Century</span>
|
||||
<span class="insight-label">{{ t('insightCentury21') }}</span>
|
||||
<span class="insight-value">{{ insights.century21Percent }}%</span>
|
||||
<span class="insight-detail">{{ insights.century21Books }} books</span>
|
||||
<span class="insight-detail">{{ t('insightCentury21Books', { count: insights.century21Books }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item classics">
|
||||
<span class="insight-label">Classics</span>
|
||||
<span class="insight-label">{{ t('insightClassics') }}</span>
|
||||
<span class="insight-value">{{ insights.classicBooksPercent }}%</span>
|
||||
<span class="insight-detail">{{ insights.classicBooks }} pre-1970</span>
|
||||
<span class="insight-detail">{{ t('insightClassicsPre1970', { count: insights.classicBooks }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item unique">
|
||||
<span class="insight-label">Unique Years</span>
|
||||
<span class="insight-label">{{ t('insightUniqueYears') }}</span>
|
||||
<span class="insight-value">{{ insights.uniqueYears }}</span>
|
||||
<span class="insight-detail">{{ insights.oldestDecade }} - {{ insights.newestDecade }}</span>
|
||||
</div>
|
||||
@@ -81,7 +82,8 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No publication date data available.</p>
|
||||
<p>{{ t('noData') }}</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+9
-6
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface TrendInsights {
|
||||
peakYear: number;
|
||||
@@ -32,13 +33,14 @@ type TrendChartData = ChartData<'line', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-publication-trend-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './publication-trend-chart.component.html',
|
||||
styleUrls: ['./publication-trend-chart.component.scss']
|
||||
})
|
||||
export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'line' as const;
|
||||
@@ -109,7 +111,7 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Publication Year',
|
||||
text: this.t.translate('statsLibrary.publicationTrend.axisPublicationYear'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -135,7 +137,7 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Books',
|
||||
text: this.t.translate('statsLibrary.publicationTrend.axisBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -161,11 +163,12 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
||||
titleFont: {size: 13, weight: 'bold'},
|
||||
bodyFont: {size: 11},
|
||||
callbacks: {
|
||||
title: (context) => `Year ${context[0].label}`,
|
||||
title: (context) => this.t.translate('statsLibrary.publicationTrend.tooltipTitle', {year: context[0].label}),
|
||||
label: (context) => {
|
||||
const value = context.parsed.y;
|
||||
const bookText = value === 1 ? 'book' : 'books';
|
||||
return `${value} ${bookText} published`;
|
||||
return value === 1
|
||||
? this.t.translate('statsLibrary.publicationTrend.tooltipBook', {value})
|
||||
: this.t.translate('statsLibrary.publicationTrend.tooltipBooks', {value});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+20
-18
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.readingJourney'">
|
||||
<div class="reading-journey-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-directions journey-title-icon"></i>
|
||||
Reading Journey
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Books added vs finished over time - the gap is your backlog</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (dateRange) {
|
||||
<div class="date-range-badge">
|
||||
@@ -26,51 +27,51 @@
|
||||
<div class="insights-section">
|
||||
<div class="insights-row">
|
||||
<div class="insight-item backlog">
|
||||
<span class="insight-label">Current Backlog</span>
|
||||
<span class="insight-label">{{ t('insightCurrentBacklog') }}</span>
|
||||
<span class="insight-value">{{ insights.currentBacklog }}</span>
|
||||
<span class="insight-detail">{{ insights.backlogPercent }}% unread</span>
|
||||
<span class="insight-detail">{{ t('insightBacklogPercent', { percent: insights.backlogPercent }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item time-to-read">
|
||||
<span class="insight-label">Avg Time to Finish</span>
|
||||
<span class="insight-label">{{ t('insightAvgTimeToFinish') }}</span>
|
||||
<span class="insight-value">{{ insights.avgTimeToFinishDays }}</span>
|
||||
<span class="insight-detail">days after adding</span>
|
||||
<span class="insight-detail">{{ t('insightDaysAfterAdding') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item productive">
|
||||
<span class="insight-label">Best Reading Month</span>
|
||||
<span class="insight-label">{{ t('insightBestReadingMonth') }}</span>
|
||||
<span class="insight-value">{{ insights.mostProductiveCount }}</span>
|
||||
<span class="insight-detail">{{ insights.mostProductiveMonth }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item acquisition">
|
||||
<span class="insight-label">Peak Acquisition</span>
|
||||
<span class="insight-label">{{ t('insightPeakAcquisition') }}</span>
|
||||
<span class="insight-value">{{ insights.busiestAcquisitionCount }}</span>
|
||||
<span class="insight-detail">{{ insights.busiestAcquisitionMonth }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item finish-rate">
|
||||
<span class="insight-label">Finish Rate</span>
|
||||
<span class="insight-label">{{ t('insightFinishRate') }}</span>
|
||||
<span class="insight-value">{{ insights.finishRate }}</span>
|
||||
<span class="insight-detail">books/month avg</span>
|
||||
<span class="insight-detail">{{ t('insightBooksPerMonthAvg') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item streak">
|
||||
<span class="insight-label">Longest Streak</span>
|
||||
<span class="insight-label">{{ t('insightLongestStreak') }}</span>
|
||||
<span class="insight-value">{{ insights.longestStreak }}</span>
|
||||
<span class="insight-detail">consecutive months</span>
|
||||
<span class="insight-detail">{{ t('insightConsecutiveMonths') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item recent">
|
||||
<span class="insight-label">Last 3 Months</span>
|
||||
<span class="insight-label">{{ t('insightLast3Months') }}</span>
|
||||
<span class="insight-value">{{ insights.recentActivity }}</span>
|
||||
<span class="insight-detail">recently finished</span>
|
||||
<span class="insight-detail">{{ t('insightRecentlyFinished') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="insight-item total">
|
||||
<span class="insight-label">Completion</span>
|
||||
<span class="insight-label">{{ t('insightCompletion') }}</span>
|
||||
<span class="insight-value">{{ insights.totalFinished }}/{{ insights.totalAdded }}</span>
|
||||
<span class="insight-detail">books finished</span>
|
||||
<span class="insight-detail">{{ t('insightBooksFinished') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -79,8 +80,9 @@
|
||||
@if (totalBooks === 0 || !insights) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No reading journey data available.</p>
|
||||
<small>Books need addedOn or dateFinished dates to appear here.</small>
|
||||
<p>{{ t('noData') }}</p>
|
||||
<small>{{ t('noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+11
-7
@@ -8,6 +8,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface MonthlyData {
|
||||
month: string;
|
||||
@@ -38,13 +39,14 @@ type JourneyChartData = ChartData<'line', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-journey-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './reading-journey-chart.component.html',
|
||||
styleUrls: ['./reading-journey-chart.component.scss']
|
||||
})
|
||||
export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'line' as const;
|
||||
@@ -115,7 +117,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Month',
|
||||
text: this.t.translate('statsLibrary.readingJourney.axisMonth'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -140,7 +142,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Cumulative Books',
|
||||
text: this.t.translate('statsLibrary.readingJourney.axisCumulativeBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -183,7 +185,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
const addedValue = context[0].chart.data.datasets[0].data[dataIndex] as number;
|
||||
const finishedValue = context[0].chart.data.datasets[1].data[dataIndex] as number;
|
||||
const backlog = addedValue - finishedValue;
|
||||
return [`\nBacklog: ${backlog} books`];
|
||||
return [`\n${this.t.translate('statsLibrary.readingJourney.tooltipBacklog', {count: backlog})}`];
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -415,7 +417,9 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
}
|
||||
const recentActivity = recentFinished > 0 ? `${recentFinished} books` : 'No activity';
|
||||
const recentActivity = recentFinished > 0
|
||||
? this.t.translate('statsLibrary.readingJourney.recentActivityBooks', {count: recentFinished})
|
||||
: this.t.translate('statsLibrary.readingJourney.recentActivityNone');
|
||||
|
||||
// Longest reading streak (consecutive months with finished books)
|
||||
let longestStreak = 0;
|
||||
@@ -459,7 +463,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Books Added',
|
||||
label: this.t.translate('statsLibrary.readingJourney.legendBooksAdded'),
|
||||
data: addedData,
|
||||
borderColor: '#3b82f6',
|
||||
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
||||
@@ -469,7 +473,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||
order: 2
|
||||
},
|
||||
{
|
||||
label: 'Books Finished',
|
||||
label: this.t.translate('statsLibrary.readingJourney.legendBooksFinished'),
|
||||
data: finishedData,
|
||||
borderColor: '#10b981',
|
||||
backgroundColor: 'rgba(16, 185, 129, 0.2)',
|
||||
|
||||
+7
-5
@@ -1,11 +1,12 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary.topItems'">
|
||||
<div class="top-items-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi" [ngClass]="selectedDataType.icon" [style.color]="selectedDataType.color"></i>
|
||||
Top 15 {{ selectedDataType.label }}
|
||||
{{ t('titlePrefix') }} {{ selectedDataType.label }}
|
||||
</h3>
|
||||
<p class="chart-description">Most represented {{ selectedDataType.label.toLowerCase() }} in your library</p>
|
||||
<p class="chart-description">{{ t('descriptionPrefix') }} {{ selectedDataType.label.toLowerCase() }} {{ t('descriptionSuffix') }}</p>
|
||||
</div>
|
||||
<div class="header-controls">
|
||||
<p-select
|
||||
@@ -34,7 +35,7 @@
|
||||
@if (totalItems > 0) {
|
||||
<div class="stats-badge">
|
||||
<span class="badge-value">{{ totalItems }}</span>
|
||||
<span class="badge-label">shown</span>
|
||||
<span class="badge-label">{{ t('shown') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -67,8 +68,9 @@
|
||||
@if (totalItems === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No {{ selectedDataType.label.toLowerCase() }} data available.</p>
|
||||
<small>Make sure your books have {{ selectedDataType.label.toLowerCase() }} metadata.</small>
|
||||
<p>{{ t('noDataPrefix') }} {{ selectedDataType.label.toLowerCase() }} {{ t('noDataSuffix') }}</p>
|
||||
<small>{{ t('noDataHintPrefix') }} {{ selectedDataType.label.toLowerCase() }} {{ t('noDataHintSuffix') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+60
-39
@@ -10,6 +10,7 @@ import {LibraryFilterService} from '../../service/library-filter.service';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ItemStats {
|
||||
name: string;
|
||||
@@ -27,25 +28,37 @@ interface DataTypeOption {
|
||||
type DataType = 'authors' | 'categories' | 'publishers' | 'tags' | 'moods' | 'series';
|
||||
type ItemChartData = ChartData<'bar', number[], string>;
|
||||
|
||||
const DATA_TYPE_OPTIONS: DataTypeOption[] = [
|
||||
{label: 'Authors', value: 'authors', icon: 'pi-th-large', color: '#2563EB'},
|
||||
{label: 'Categories', value: 'categories', icon: 'pi-user', color: '#0D9488'},
|
||||
{label: 'Series', value: 'series', icon: 'pi-tag', color: '#DB2777'},
|
||||
{label: 'Publishers', value: 'publishers', icon: 'pi-building', color: '#7C3AED'},
|
||||
{label: 'Tags', value: 'tags', icon: 'pi-bookmark', color: '#EAB308'},
|
||||
{label: 'Moods', value: 'moods', icon: 'pi-heart', color: '#EA580C'}
|
||||
const DATA_TYPE_DEFS: { key: string; value: DataType; icon: string; color: string }[] = [
|
||||
{key: 'authors', value: 'authors', icon: 'pi-th-large', color: '#2563EB'},
|
||||
{key: 'categories', value: 'categories', icon: 'pi-user', color: '#0D9488'},
|
||||
{key: 'series', value: 'series', icon: 'pi-tag', color: '#DB2777'},
|
||||
{key: 'publishers', value: 'publishers', icon: 'pi-building', color: '#7C3AED'},
|
||||
{key: 'tags', value: 'tags', icon: 'pi-bookmark', color: '#EAB308'},
|
||||
{key: 'moods', value: 'moods', icon: 'pi-heart', color: '#EA580C'}
|
||||
];
|
||||
|
||||
const READ_STATUS_CONFIG: Record<ReadStatus, { label: string; color: string }> = {
|
||||
[ReadStatus.READ]: {label: 'Read', color: '#22c55e'},
|
||||
[ReadStatus.READING]: {label: 'Reading', color: '#3b82f6'},
|
||||
[ReadStatus.RE_READING]: {label: 'Re-reading', color: '#8b5cf6'},
|
||||
[ReadStatus.UNREAD]: {label: 'Unread', color: '#6b7280'},
|
||||
[ReadStatus.PARTIALLY_READ]: {label: 'Partially Read', color: '#f59e0b'},
|
||||
[ReadStatus.PAUSED]: {label: 'Paused', color: '#eab308'},
|
||||
[ReadStatus.WONT_READ]: {label: "Won't Read", color: '#ef4444'},
|
||||
[ReadStatus.ABANDONED]: {label: 'Abandoned', color: '#dc2626'},
|
||||
[ReadStatus.UNSET]: {label: 'Not Set', color: '#9ca3af'}
|
||||
const READ_STATUS_KEYS: Record<ReadStatus, string> = {
|
||||
[ReadStatus.READ]: 'read',
|
||||
[ReadStatus.READING]: 'reading',
|
||||
[ReadStatus.RE_READING]: 'reReading',
|
||||
[ReadStatus.UNREAD]: 'unread',
|
||||
[ReadStatus.PARTIALLY_READ]: 'partiallyRead',
|
||||
[ReadStatus.PAUSED]: 'paused',
|
||||
[ReadStatus.WONT_READ]: 'wontRead',
|
||||
[ReadStatus.ABANDONED]: 'abandoned',
|
||||
[ReadStatus.UNSET]: 'notSet'
|
||||
};
|
||||
|
||||
const READ_STATUS_COLORS: Record<ReadStatus, string> = {
|
||||
[ReadStatus.READ]: '#22c55e',
|
||||
[ReadStatus.READING]: '#3b82f6',
|
||||
[ReadStatus.RE_READING]: '#8b5cf6',
|
||||
[ReadStatus.UNREAD]: '#6b7280',
|
||||
[ReadStatus.PARTIALLY_READ]: '#f59e0b',
|
||||
[ReadStatus.PAUSED]: '#eab308',
|
||||
[ReadStatus.WONT_READ]: '#ef4444',
|
||||
[ReadStatus.ABANDONED]: '#dc2626',
|
||||
[ReadStatus.UNSET]: '#9ca3af'
|
||||
};
|
||||
|
||||
const READ_STATUS_ORDER: ReadStatus[] = [
|
||||
@@ -63,7 +76,7 @@ const READ_STATUS_ORDER: ReadStatus[] = [
|
||||
@Component({
|
||||
selector: 'app-top-items-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, BaseChartDirective, Select],
|
||||
imports: [CommonModule, FormsModule, BaseChartDirective, Select, TranslocoDirective],
|
||||
templateUrl: './top-items-chart.component.html',
|
||||
styleUrls: ['./top-items-chart.component.scss']
|
||||
})
|
||||
@@ -73,8 +86,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
public readonly chartType = 'bar' as const;
|
||||
public readonly chartData$: Observable<ItemChartData>;
|
||||
public chartOptions: ChartConfiguration<'bar'>['options'];
|
||||
public dataTypeOptions = DATA_TYPE_OPTIONS;
|
||||
public selectedDataType: DataTypeOption = DATA_TYPE_OPTIONS[0];
|
||||
public dataTypeOptions: DataTypeOption[];
|
||||
public selectedDataType: DataTypeOption;
|
||||
|
||||
public totalItems = 0;
|
||||
public totalBooks = 0;
|
||||
@@ -82,12 +95,20 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<ItemChartData>;
|
||||
private lastCalculatedStats: ItemStats[] = [];
|
||||
private allBooks: Book[] = [];
|
||||
|
||||
constructor() {
|
||||
this.dataTypeOptions = DATA_TYPE_DEFS.map(def => ({
|
||||
label: this.t.translate(`statsLibrary.topItems.dataTypes.${def.key}`),
|
||||
value: def.value,
|
||||
icon: def.icon,
|
||||
color: def.color
|
||||
}));
|
||||
this.selectedDataType = this.dataTypeOptions[0];
|
||||
this.chartDataSubject = new BehaviorSubject<ItemChartData>({
|
||||
labels: [],
|
||||
datasets: []
|
||||
@@ -98,7 +119,7 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.initialDataType) {
|
||||
const initialOption = DATA_TYPE_OPTIONS.find(opt => opt.value === this.initialDataType);
|
||||
const initialOption = this.dataTypeOptions.find(opt => opt.value === this.initialDataType);
|
||||
if (initialOption) {
|
||||
this.selectedDataType = initialOption;
|
||||
this.initChartOptions();
|
||||
@@ -162,7 +183,7 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
border: {display: false},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Books',
|
||||
text: this.t.translate('statsLibrary.topItems.axisNumberOfBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -264,12 +285,13 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
const datasets = READ_STATUS_ORDER
|
||||
.filter(status => stats.some(s => s.statusBreakdown[status] > 0))
|
||||
.map(status => {
|
||||
const config = READ_STATUS_CONFIG[status];
|
||||
const statusKey = READ_STATUS_KEYS[status];
|
||||
const color = READ_STATUS_COLORS[status];
|
||||
return {
|
||||
label: config.label,
|
||||
label: this.t.translate(`statsLibrary.topItems.readStatus.${statusKey}`),
|
||||
data: stats.map(s => s.statusBreakdown[status]),
|
||||
backgroundColor: config.color,
|
||||
borderColor: config.color,
|
||||
backgroundColor: color,
|
||||
borderColor: color,
|
||||
borderWidth: 1,
|
||||
borderRadius: 4,
|
||||
barPercentage: 0.85,
|
||||
@@ -295,14 +317,13 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
if (stats.length === 0) return;
|
||||
|
||||
const typeName = this.selectedDataType.label.toLowerCase().slice(0, -1); // Remove 's' for singular
|
||||
const typeNamePlural = this.selectedDataType.label.toLowerCase();
|
||||
|
||||
// 1. Top item
|
||||
const top = stats[0];
|
||||
this.insights.push({
|
||||
icon: 'pi-trophy',
|
||||
label: `Top ${typeName}`,
|
||||
value: `${top.name} (${top.count} books)`
|
||||
label: this.t.translate('statsLibrary.topItems.insightTop', {type: typeName}),
|
||||
value: this.t.translate('statsLibrary.topItems.insightTopValue', {name: top.name, count: top.count})
|
||||
});
|
||||
|
||||
// 2. Most completed - highest read percentage
|
||||
@@ -317,8 +338,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
if (readPct > 0) {
|
||||
this.insights.push({
|
||||
icon: 'pi-check-circle',
|
||||
label: 'Most completed',
|
||||
value: `${mostRead.name} (${readPct}% read)`
|
||||
label: this.t.translate('statsLibrary.topItems.insightMostCompleted'),
|
||||
value: this.t.translate('statsLibrary.topItems.insightMostCompletedValue', {name: mostRead.name, percent: readPct})
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -331,8 +352,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
const concentration = Math.round((top5Books / totalAllBooks) * 100);
|
||||
this.insights.push({
|
||||
icon: 'pi-chart-pie',
|
||||
label: 'Top 5 coverage',
|
||||
value: `${concentration}% of library`
|
||||
label: this.t.translate('statsLibrary.topItems.insightTop5Coverage'),
|
||||
value: this.t.translate('statsLibrary.topItems.insightTop5CoverageValue', {percent: concentration})
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -342,8 +363,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
const avgBooks = (this.totalBooks / stats.length).toFixed(1);
|
||||
this.insights.push({
|
||||
icon: 'pi-book',
|
||||
label: `Avg per ${typeName}`,
|
||||
value: `${avgBooks} books`
|
||||
label: this.t.translate('statsLibrary.topItems.insightAvgPer', {type: typeName}),
|
||||
value: this.t.translate('statsLibrary.topItems.insightAvgPerValue', {avg: avgBooks})
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -445,10 +466,10 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
||||
return '';
|
||||
}
|
||||
|
||||
const statusLabel = context.dataset.label || 'Books';
|
||||
const bookText = value === 1 ? 'book' : 'books';
|
||||
|
||||
return `${statusLabel}: ${value} ${bookText}`;
|
||||
const statusLabel = context.dataset.label || this.t.translate('statsLibrary.pageCount.axisBooks');
|
||||
return value === 1
|
||||
? this.t.translate('statsLibrary.topItems.tooltipBook', {status: statusLabel, value})
|
||||
: this.t.translate('statsLibrary.topItems.tooltipBooks', {status: statusLabel, value});
|
||||
}
|
||||
|
||||
private truncateTitle(title: string, maxLength: number): string {
|
||||
|
||||
+26
-24
@@ -1,9 +1,10 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsLibrary'">
|
||||
<div class="library-stats-container">
|
||||
<div class="header-card">
|
||||
<div class="filter-section">
|
||||
<div class="library-filter">
|
||||
<div class="select-row">
|
||||
<label for="library-dropdown">Library Statistics</label>
|
||||
<label for="library-dropdown">{{ t('main.title') }}</label>
|
||||
<div class="dropdown-row">
|
||||
<p-select
|
||||
fluid
|
||||
@@ -12,7 +13,7 @@
|
||||
[(ngModel)]="selectedLibrary"
|
||||
optionLabel="name"
|
||||
size="small"
|
||||
placeholder="Select a library"
|
||||
[placeholder]="t('main.selectLibrary')"
|
||||
(onChange)="onLibraryChange()"
|
||||
appendTo="body"
|
||||
[style]="{'min-width': '200px'}"
|
||||
@@ -29,33 +30,33 @@
|
||||
</div>
|
||||
|
||||
<div class="library-totals" role="status" aria-live="polite">
|
||||
<div class="total-item total-books" title="Total books">
|
||||
<div class="total-item total-books" [title]="t('main.totalBooks')">
|
||||
<i class="pi pi-book"></i>
|
||||
<span class="total-label">Books</span>
|
||||
<span class="total-label">{{ t('main.books') }}</span>
|
||||
<span class="total-value">{{ totalBooks$ | async }}</span>
|
||||
</div>
|
||||
|
||||
<div class="total-item total-authors" title="Total authors">
|
||||
<div class="total-item total-authors" [title]="t('main.totalAuthors')">
|
||||
<i class="pi pi-users"></i>
|
||||
<span class="total-label">Authors</span>
|
||||
<span class="total-label">{{ t('main.authors') }}</span>
|
||||
<span class="total-value">{{ totalAuthors$ | async }}</span>
|
||||
</div>
|
||||
|
||||
<div class="total-item total-series" title="Total series">
|
||||
<div class="total-item total-series" [title]="t('main.totalSeries')">
|
||||
<i class="pi pi-bookmark"></i>
|
||||
<span class="total-label">Series</span>
|
||||
<span class="total-label">{{ t('main.series') }}</span>
|
||||
<span class="total-value">{{ totalSeries$ | async }}</span>
|
||||
</div>
|
||||
|
||||
<div class="total-item total-publishers" title="Total publishers">
|
||||
<div class="total-item total-publishers" [title]="t('main.totalPublishers')">
|
||||
<i class="pi pi-building"></i>
|
||||
<span class="total-label">Publishers</span>
|
||||
<span class="total-label">{{ t('main.publishers') }}</span>
|
||||
<span class="total-value">{{ totalPublishers$ | async }}</span>
|
||||
</div>
|
||||
|
||||
<div class="total-item total-size" title="Total size">
|
||||
<div class="total-item total-size" [title]="t('main.totalSize')">
|
||||
<i class="pi pi-file"></i>
|
||||
<span class="total-label">Library Size</span>
|
||||
<span class="total-label">{{ t('main.librarySize') }}</span>
|
||||
<span class="total-value">{{ totalSize$ | async }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,28 +68,28 @@
|
||||
<div class="config-modal-overlay" (click)="closeConfigPanel()">
|
||||
<div class="config-modal" (click)="$event.stopPropagation()">
|
||||
<div class="config-modal-header">
|
||||
<h3><i class="pi pi-cog"></i> Chart Configuration</h3>
|
||||
<button type="button" class="close-btn" (click)="closeConfigPanel()" title="Close">
|
||||
<h3><i class="pi pi-cog"></i> {{ t('config.title') }}</h3>
|
||||
<button type="button" class="close-btn" (click)="closeConfigPanel()" [title]="t('config.close')">
|
||||
<i class="pi pi-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="config-modal-actions">
|
||||
<button type="button" class="config-action-btn enable-all" (click)="enableAllCharts()">
|
||||
<i class="pi pi-check"></i> Enable All
|
||||
<i class="pi pi-check"></i> {{ t('config.enableAll') }}
|
||||
</button>
|
||||
<button type="button" class="config-action-btn disable-all" (click)="disableAllCharts()">
|
||||
<i class="pi pi-times"></i> Disable All
|
||||
<i class="pi pi-times"></i> {{ t('config.disableAll') }}
|
||||
</button>
|
||||
<button type="button" class="config-action-btn reset-order" (click)="resetChartOrder()">
|
||||
<i class="pi pi-refresh"></i> Reset Order
|
||||
<i class="pi pi-refresh"></i> {{ t('config.resetOrder') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="config-modal-content">
|
||||
<div class="config-categories">
|
||||
<div class="config-category">
|
||||
<h4>Small Charts</h4>
|
||||
<h4>{{ t('config.smallCharts') }}</h4>
|
||||
<div class="chart-toggles">
|
||||
@for (chart of getChartsByCategory('small'); track chart.id) {
|
||||
<div class="chart-toggle">
|
||||
@@ -104,7 +105,7 @@
|
||||
</div>
|
||||
|
||||
<div class="config-category">
|
||||
<h4>Large Charts</h4>
|
||||
<h4>{{ t('config.largeCharts') }}</h4>
|
||||
<div class="chart-toggles">
|
||||
@for (chart of getChartsByCategory('large'); track chart.id) {
|
||||
<div class="chart-toggle">
|
||||
@@ -120,7 +121,7 @@
|
||||
</div>
|
||||
|
||||
<div class="config-category">
|
||||
<h4>Extra Large Charts</h4>
|
||||
<h4>{{ t('config.xlargeCharts') }}</h4>
|
||||
<div class="chart-toggles">
|
||||
@for (chart of getChartsByCategory('xlarge'); track chart.id) {
|
||||
<div class="chart-toggle">
|
||||
@@ -152,7 +153,7 @@
|
||||
[cdkDragData]="chartConfig"
|
||||
[class]="'chart-section ' + chartConfig.category">
|
||||
|
||||
<div class="drag-handle" cdkDragHandle title="Drag to reorder">
|
||||
<div class="drag-handle" cdkDragHandle [title]="t('main.dragToReorder')">
|
||||
<i class="pi pi-bars"></i>
|
||||
</div>
|
||||
|
||||
@@ -192,14 +193,15 @@
|
||||
|
||||
@if (isLoading) {
|
||||
<div class="loading-message">
|
||||
Loading statistics...
|
||||
{{ t('main.loading') }}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!isLoading && !hasData) {
|
||||
<div class="no-data-message">
|
||||
No data available.
|
||||
<small>Make sure your library contains books with metadata.</small>
|
||||
{{ t('main.noData') }}
|
||||
<small>{{ t('main.noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+19
-22
@@ -17,6 +17,7 @@ import {PublicationTrendChartComponent} from './charts/publication-trend-chart/p
|
||||
import {ReadingJourneyChartComponent} from './charts/reading-journey-chart/reading-journey-chart.component';
|
||||
import {LibrariesSummaryService} from './service/libraries-summary.service';
|
||||
import {LibraryFilterService, LibraryOption} from './service/library-filter.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ChartConfig {
|
||||
id: string;
|
||||
@@ -42,7 +43,8 @@ interface ChartConfig {
|
||||
AuthorUniverseChartComponent,
|
||||
PublicationTimelineChartComponent,
|
||||
PublicationTrendChartComponent,
|
||||
ReadingJourneyChartComponent
|
||||
ReadingJourneyChartComponent,
|
||||
TranslocoDirective
|
||||
],
|
||||
templateUrl: './library-stats.component.html',
|
||||
styleUrls: ['./library-stats.component.scss']
|
||||
@@ -50,6 +52,7 @@ interface ChartConfig {
|
||||
export class LibraryStatsComponent implements OnInit, OnDestroy {
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly librariesSummaryService = inject(LibrariesSummaryService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public isLoading = true;
|
||||
@@ -59,17 +62,7 @@ export class LibraryStatsComponent implements OnInit, OnDestroy {
|
||||
public selectedLibrary: LibraryOption | null = null;
|
||||
public showConfigPanel = false;
|
||||
|
||||
public chartsConfig: ChartConfig[] = [
|
||||
{id: 'bookFormats', name: 'Book Formats', enabled: true, category: 'small'},
|
||||
{id: 'languageDistribution', name: 'Languages', enabled: true, category: 'small'},
|
||||
{id: 'metadataScore', name: 'Metadata Score', enabled: true, category: 'small'},
|
||||
{id: 'pageCountDistribution', name: 'Page Count', enabled: true, category: 'small'},
|
||||
{id: 'publicationTimeline', name: 'Publication Timeline', enabled: true, category: 'large'},
|
||||
{id: 'readingJourney', name: 'Reading Journey', enabled: true, category: 'large'},
|
||||
{id: 'topItems', name: 'Top Items (Authors/Categories/etc.)', enabled: true, category: 'large'},
|
||||
{id: 'authorUniverse', name: 'Author Universe', enabled: true, category: 'large'},
|
||||
{id: 'publicationTrend', name: 'Publication Trend', enabled: true, category: 'xlarge'}
|
||||
];
|
||||
public chartsConfig: ChartConfig[] = this.buildChartsConfig();
|
||||
|
||||
booksSummary$ = this.librariesSummaryService.getBooksSummary().pipe(
|
||||
catchError(error => {
|
||||
@@ -184,16 +177,20 @@ export class LibraryStatsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public resetChartOrder(): void {
|
||||
this.chartsConfig = [
|
||||
{id: 'bookFormats', name: 'Book Formats', enabled: true, category: 'small'},
|
||||
{id: 'languageDistribution', name: 'Languages', enabled: true, category: 'small'},
|
||||
{id: 'metadataScore', name: 'Metadata Score', enabled: true, category: 'small'},
|
||||
{id: 'pageCountDistribution', name: 'Page Count', enabled: true, category: 'small'},
|
||||
{id: 'publicationTimeline', name: 'Publication Timeline', enabled: true, category: 'large'},
|
||||
{id: 'readingJourney', name: 'Reading Journey', enabled: true, category: 'large'},
|
||||
{id: 'topItems', name: 'Top Items (Authors/Categories/etc.)', enabled: true, category: 'large'},
|
||||
{id: 'authorUniverse', name: 'Author Universe', enabled: true, category: 'large'},
|
||||
{id: 'publicationTrend', name: 'Publication Trend', enabled: true, category: 'xlarge'}
|
||||
this.chartsConfig = this.buildChartsConfig();
|
||||
}
|
||||
|
||||
private buildChartsConfig(): ChartConfig[] {
|
||||
return [
|
||||
{id: 'bookFormats', name: this.t.translate('statsLibrary.chartNames.bookFormats'), enabled: true, category: 'small'},
|
||||
{id: 'languageDistribution', name: this.t.translate('statsLibrary.chartNames.languages'), enabled: true, category: 'small'},
|
||||
{id: 'metadataScore', name: this.t.translate('statsLibrary.chartNames.metadataScore'), enabled: true, category: 'small'},
|
||||
{id: 'pageCountDistribution', name: this.t.translate('statsLibrary.chartNames.pageCount'), enabled: true, category: 'small'},
|
||||
{id: 'publicationTimeline', name: this.t.translate('statsLibrary.chartNames.publicationTimeline'), enabled: true, category: 'large'},
|
||||
{id: 'readingJourney', name: this.t.translate('statsLibrary.chartNames.readingJourney'), enabled: true, category: 'large'},
|
||||
{id: 'topItems', name: this.t.translate('statsLibrary.chartNames.topItems'), enabled: true, category: 'large'},
|
||||
{id: 'authorUniverse', name: this.t.translate('statsLibrary.chartNames.authorUniverse'), enabled: true, category: 'large'},
|
||||
{id: 'publicationTrend', name: this.t.translate('statsLibrary.chartNames.publicationTrend'), enabled: true, category: 'xlarge'}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -2,6 +2,7 @@ import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, combineLatest, map, Observable} from 'rxjs';
|
||||
import {BookService} from '../../../../book/service/book.service';
|
||||
import {LibraryService} from '../../../../book/service/library.service';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
export interface LibraryOption {
|
||||
id: number | null;
|
||||
@@ -26,6 +27,7 @@ export class LibraryFilterService {
|
||||
|
||||
private bookService = inject(BookService);
|
||||
private libraryService = inject(LibraryService);
|
||||
private t = inject(TranslocoService);
|
||||
|
||||
getLibraryOptions(): Observable<LibraryOption[]> {
|
||||
return combineLatest([
|
||||
@@ -34,24 +36,24 @@ export class LibraryFilterService {
|
||||
]).pipe(
|
||||
map(([bookState, libraryState]) => {
|
||||
if (!bookState.loaded || !bookState.books || bookState.books.length === 0) {
|
||||
return [{id: null, name: 'All Libraries'}];
|
||||
return [{id: null, name: this.t.translate('statsLibrary.libraryFilter.allLibraries')}];
|
||||
}
|
||||
|
||||
if (!libraryState.loaded || !libraryState.libraries) {
|
||||
return [{id: null, name: 'All Libraries'}];
|
||||
return [{id: null, name: this.t.translate('statsLibrary.libraryFilter.allLibraries')}];
|
||||
}
|
||||
|
||||
const libraryMap = new Map<number, string>();
|
||||
bookState.books.forEach(book => {
|
||||
if (!libraryMap.has(book.libraryId)) {
|
||||
const library = libraryState.libraries?.find(lib => lib.id === book.libraryId);
|
||||
const libraryName = library?.name || `Library ${book.libraryId}`;
|
||||
const libraryName: string = library?.name || this.t.translate('statsLibrary.libraryFilter.libraryFallback', {id: book.libraryId}) as string;
|
||||
libraryMap.set(book.libraryId, libraryName);
|
||||
}
|
||||
});
|
||||
|
||||
const options: LibraryOption[] = [
|
||||
{id: null, name: 'All Libraries'},
|
||||
{id: null, name: this.t.translate('statsLibrary.libraryFilter.allLibraries')},
|
||||
...Array.from(libraryMap.entries()).map(([id, name]) => ({id, name}))
|
||||
];
|
||||
|
||||
|
||||
+8
-6
@@ -1,21 +1,22 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.bookLength'">
|
||||
<div class="book-length-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-book book-length-icon"></i>
|
||||
Book Length Sweet Spot
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Each dot is a book you've rated, plotted by its page count (X-axis) and your personal rating (Y-axis). Colors indicate read status: green = read, blue = reading, red = abandoned. The trend line shows whether you tend to rate longer or shorter books higher. The 'sweet spot' is the page-count range where your average rating is highest."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">How book length relates to your personal ratings</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (totalRatedBooks > 0) {
|
||||
<div class="stats-badge">
|
||||
<span class="badge-value">{{ totalRatedBooks }}</span>
|
||||
<span class="badge-label">books analyzed</span>
|
||||
<span class="badge-label">{{ t('booksAnalyzed') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -24,11 +25,11 @@
|
||||
<div class="stats-row">
|
||||
<div class="stat-card">
|
||||
<span class="stat-value-sm">{{ sweetSpot }}</span>
|
||||
<span class="stat-label">Sweet Spot</span>
|
||||
<span class="stat-label">{{ t('sweetSpot') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value-sm">{{ highestRatedLength }}</span>
|
||||
<span class="stat-label">Highest Rated</span>
|
||||
<span class="stat-label">{{ t('highestRated') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -41,3 +42,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+44
-24
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData, ScatterDataPoint} from 'chart.js';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface BookScatterPoint extends ScatterDataPoint {
|
||||
bookTitle: string;
|
||||
@@ -17,10 +18,10 @@ interface BookScatterPoint extends ScatterDataPoint {
|
||||
type LengthChartData = ChartData<'scatter', BookScatterPoint[], string>;
|
||||
|
||||
const STATUS_COLORS: Record<string, { bg: string; border: string }> = {
|
||||
'Read': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||
'Reading': {bg: 'rgba(33, 150, 243, 0.7)', border: '#2196f3'},
|
||||
'Abandoned': {bg: 'rgba(244, 67, 54, 0.7)', border: '#f44336'},
|
||||
'Other': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||
'read': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||
'reading': {bg: 'rgba(33, 150, 243, 0.7)', border: '#2196f3'},
|
||||
'abandoned': {bg: 'rgba(244, 67, 54, 0.7)', border: '#f44336'},
|
||||
'other': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||
};
|
||||
|
||||
const PAGE_RANGES = [
|
||||
@@ -35,12 +36,13 @@ const PAGE_RANGES = [
|
||||
@Component({
|
||||
selector: 'app-book-length-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './book-length-chart.component.html',
|
||||
styleUrls: ['./book-length-chart.component.scss']
|
||||
})
|
||||
export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'scatter' as const;
|
||||
@@ -58,7 +60,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Page Count',
|
||||
text: this.t.translate('statsUser.bookLength.axisPageCount'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
@@ -73,7 +75,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
max: 10,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Personal Rating',
|
||||
text: this.t.translate('statsUser.bookLength.axisPersonalRating'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
@@ -111,14 +113,14 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
callbacks: {
|
||||
title: (context) => {
|
||||
const point = context[0].raw as BookScatterPoint;
|
||||
return point.bookTitle || 'Unknown Book';
|
||||
return point.bookTitle || this.t.translate('statsUser.bookLength.tooltipUnknownBook');
|
||||
},
|
||||
label: (context) => {
|
||||
const point = context.raw as BookScatterPoint;
|
||||
return [
|
||||
`Pages: ${point.x}`,
|
||||
`Rating: ${point.y}/10`,
|
||||
`Status: ${point.readStatus}`
|
||||
this.t.translate('statsUser.bookLength.tooltipPages', {count: point.x}),
|
||||
this.t.translate('statsUser.bookLength.tooltipRating', {rating: point.y}),
|
||||
this.t.translate('statsUser.bookLength.tooltipStatus', {status: point.readStatus})
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -169,12 +171,13 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
this.totalRatedBooks = ratedBooks.length;
|
||||
if (this.totalRatedBooks === 0) return;
|
||||
|
||||
// Group by status
|
||||
const grouped = new Map<string, BookScatterPoint[]>();
|
||||
// Group by status key (for colors) and translated label (for display)
|
||||
const grouped = new Map<string, { label: string; points: BookScatterPoint[] }>();
|
||||
for (const book of ratedBooks) {
|
||||
const statusKey = this.getStatusKey(book.readStatus);
|
||||
const statusLabel = this.getStatusLabel(book.readStatus);
|
||||
if (!grouped.has(statusLabel)) grouped.set(statusLabel, []);
|
||||
grouped.get(statusLabel)!.push({
|
||||
if (!grouped.has(statusKey)) grouped.set(statusKey, {label: statusLabel, points: []});
|
||||
grouped.get(statusKey)!.points.push({
|
||||
x: book.metadata!.pageCount!,
|
||||
y: book.personalRating!,
|
||||
bookTitle: book.metadata?.title || book.fileName || 'Unknown',
|
||||
@@ -182,8 +185,8 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
const datasets = Array.from(grouped.entries()).map(([label, points]) => {
|
||||
const colors = STATUS_COLORS[label] || STATUS_COLORS['Other'];
|
||||
const datasets = Array.from(grouped.entries()).map(([key, {label, points}]) => {
|
||||
const colors = STATUS_COLORS[key] || STATUS_COLORS['other'];
|
||||
return {
|
||||
label: `${label} (${points.length})`,
|
||||
data: points,
|
||||
@@ -200,7 +203,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
const trend = this.computeTrendLine(allPoints);
|
||||
if (trend) {
|
||||
datasets.push({
|
||||
label: 'Trend',
|
||||
label: this.t.translate('statsUser.bookLength.trend'),
|
||||
data: trend as BookScatterPoint[],
|
||||
backgroundColor: 'transparent',
|
||||
borderColor: 'rgba(255, 255, 255, 0.4)',
|
||||
@@ -216,20 +219,37 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||
this.computeStats(ratedBooks);
|
||||
}
|
||||
|
||||
private getStatusLabel(status?: ReadStatus): string {
|
||||
if (!status) return 'Other';
|
||||
private getStatusKey(status?: ReadStatus): string {
|
||||
if (!status) return 'other';
|
||||
switch (status) {
|
||||
case ReadStatus.READ:
|
||||
case ReadStatus.PARTIALLY_READ:
|
||||
return 'Read';
|
||||
return 'read';
|
||||
case ReadStatus.READING:
|
||||
case ReadStatus.RE_READING:
|
||||
return 'Reading';
|
||||
return 'reading';
|
||||
case ReadStatus.ABANDONED:
|
||||
case ReadStatus.WONT_READ:
|
||||
return 'Abandoned';
|
||||
return 'abandoned';
|
||||
default:
|
||||
return 'Other';
|
||||
return 'other';
|
||||
}
|
||||
}
|
||||
|
||||
private getStatusLabel(status?: ReadStatus): string {
|
||||
if (!status) return this.t.translate('statsUser.bookLength.statusOther');
|
||||
switch (status) {
|
||||
case ReadStatus.READ:
|
||||
case ReadStatus.PARTIALLY_READ:
|
||||
return this.t.translate('statsUser.bookLength.statusRead');
|
||||
case ReadStatus.READING:
|
||||
case ReadStatus.RE_READING:
|
||||
return this.t.translate('statsUser.bookLength.statusReading');
|
||||
case ReadStatus.ABANDONED:
|
||||
case ReadStatus.WONT_READ:
|
||||
return this.t.translate('statsUser.bookLength.statusAbandoned');
|
||||
default:
|
||||
return this.t.translate('statsUser.bookLength.statusOther');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-13
@@ -1,29 +1,30 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.completionRace'">
|
||||
<div class="completion-race-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-flag completion-race-icon"></i>
|
||||
Reading Completion Race
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Each line represents a completed book's reading journey. The X-axis shows days since you started that book, and the Y-axis shows your progress from 0% to 100%. Steeper lines mean faster reads. Only books marked as 'Read' with tracked sessions are included."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Compare how quickly you finished different books</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="year-selector">
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(-1)"
|
||||
title="Previous year">
|
||||
[title]="t('previousYear')">
|
||||
<i class="pi pi-chevron-left"></i>
|
||||
</button>
|
||||
<span class="current-year">{{ currentYear }}</span>
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(1)"
|
||||
title="Next year">
|
||||
[title]="t('nextYear')">
|
||||
<i class="pi pi-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -33,29 +34,29 @@
|
||||
<div class="stats-row">
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ totalBooks }}</span>
|
||||
<span class="stat-label">Books</span>
|
||||
<span class="stat-label">{{ t('books') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ totalSessions }}</span>
|
||||
<span class="stat-label">Sessions</span>
|
||||
<span class="stat-label">{{ t('sessions') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ avgDaysToFinish }}d</span>
|
||||
<span class="stat-label">Avg Days</span>
|
||||
<span class="stat-label">{{ t('avgDays') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ medianDaysToFinish }}d</span>
|
||||
<span class="stat-label">Median Days</span>
|
||||
<span class="stat-label">{{ t('medianDays') }}</span>
|
||||
</div>
|
||||
<div class="stat-card fastest">
|
||||
<span class="stat-value">{{ fastestDays }}</span>
|
||||
<span class="stat-subtitle">{{ fastestTitle }}</span>
|
||||
<span class="stat-label">Fastest</span>
|
||||
<span class="stat-label">{{ t('fastest') }}</span>
|
||||
</div>
|
||||
<div class="stat-card slowest">
|
||||
<span class="stat-value">{{ slowestDays }}</span>
|
||||
<span class="stat-subtitle">{{ slowestTitle }}</span>
|
||||
<span class="stat-label">Slowest</span>
|
||||
<span class="stat-label">{{ t('slowest') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -71,8 +72,9 @@
|
||||
@if (totalBooks === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No completed books with reading sessions found for {{ currentYear }}.</p>
|
||||
<small>Complete some books with tracked reading sessions to see your completion races.</small>
|
||||
<p>{{ t('noData', { year: currentYear }) }}</p>
|
||||
<small>{{ t('noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+6
-4
@@ -6,6 +6,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {CompletionRaceResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface BookRace {
|
||||
bookId: number;
|
||||
@@ -25,7 +26,7 @@ const LINE_COLORS = [
|
||||
@Component({
|
||||
selector: 'app-completion-race-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './completion-race-chart.component.html',
|
||||
styleUrls: ['./completion-race-chart.component.scss']
|
||||
})
|
||||
@@ -47,6 +48,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
||||
public slowestTitle = '';
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<RaceChartData>;
|
||||
|
||||
@@ -89,7 +91,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
||||
label: (context) => {
|
||||
const progress = (context.parsed.y ?? 0).toFixed(1);
|
||||
const day = context.parsed.x;
|
||||
return `Day ${day}: ${progress}% progress`;
|
||||
return this.t.translate('statsUser.completionRace.tooltipDayProgress', {day, progress});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -100,7 +102,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
||||
type: 'linear',
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Days Since First Session',
|
||||
text: this.t.translate('statsUser.completionRace.axisDaysSinceFirstSession'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
@@ -117,7 +119,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
||||
max: 100,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Progress (%)',
|
||||
text: this.t.translate('statsUser.completionRace.axisProgress'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
|
||||
+6
-5
@@ -1,24 +1,25 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.completionTimeline'">
|
||||
<div class="completion-timeline-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-calendar completion-title-icon"></i>
|
||||
Reading Progress
|
||||
{{ t('title') }}
|
||||
</h3>
|
||||
<p class="chart-description">Monthly book completion statistics</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="year-selector">
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(-1)"
|
||||
title="Previous year">
|
||||
[title]="t('previousYear')">
|
||||
<i class="pi pi-chevron-left"></i>
|
||||
</button>
|
||||
<span class="current-year">{{ currentYear }}</span>
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(1)"
|
||||
title="Next year">
|
||||
[title]="t('nextYear')">
|
||||
<i class="pi pi-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -31,4 +32,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
+11
-8
@@ -5,13 +5,14 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {CompletionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type CompletionChartData = ChartData<'bar', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-completion-timeline-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective],
|
||||
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||
templateUrl: './completion-timeline-chart.component.html',
|
||||
styleUrls: ['./completion-timeline-chart.component.scss']
|
||||
})
|
||||
@@ -24,6 +25,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
public readonly chartOptions: ChartConfiguration['options'];
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<CompletionChartData>;
|
||||
|
||||
@@ -69,7 +71,8 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
label: (context) => {
|
||||
const label = context.dataset.label || '';
|
||||
const value = context.parsed.y;
|
||||
return `${label}: ${value} book${value !== 1 ? 's' : ''}`;
|
||||
const key = value !== 1 ? 'statsUser.completionTimeline.tooltipBooks' : 'statsUser.completionTimeline.tooltipBook';
|
||||
return this.t.translate(key, {label, value});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -79,7 +82,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Month',
|
||||
text: this.t.translate('statsUser.completionTimeline.axisMonth'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -97,7 +100,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Books',
|
||||
text: this.t.translate('statsUser.completionTimeline.axisNumberOfBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -190,7 +193,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Completed',
|
||||
label: this.t.translate('statsUser.completionTimeline.completed'),
|
||||
data: completedBooks,
|
||||
backgroundColor: 'rgba(106, 176, 76, 0.8)',
|
||||
borderColor: 'rgba(106, 176, 76, 1)',
|
||||
@@ -200,7 +203,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
categoryPercentage: 0.6
|
||||
},
|
||||
{
|
||||
label: 'Active Reading',
|
||||
label: this.t.translate('statsUser.completionTimeline.activeReading'),
|
||||
data: activeReading,
|
||||
backgroundColor: 'rgba(59, 130, 246, 0.8)',
|
||||
borderColor: 'rgba(59, 130, 246, 1)',
|
||||
@@ -210,7 +213,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
categoryPercentage: 0.6
|
||||
},
|
||||
{
|
||||
label: 'Paused',
|
||||
label: this.t.translate('statsUser.completionTimeline.paused'),
|
||||
data: pausedBooks,
|
||||
backgroundColor: 'rgba(255, 193, 7, 0.8)',
|
||||
borderColor: 'rgba(255, 193, 7, 1)',
|
||||
@@ -220,7 +223,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
||||
categoryPercentage: 0.6
|
||||
},
|
||||
{
|
||||
label: 'Discontinued',
|
||||
label: this.t.translate('statsUser.completionTimeline.discontinued'),
|
||||
data: discontinuedBooks,
|
||||
backgroundColor: 'rgba(239, 68, 68, 0.8)',
|
||||
borderColor: 'rgba(239, 68, 68, 1)',
|
||||
|
||||
+7
-5
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.favoriteDays'">
|
||||
<div class="favorite-days-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-calendar-plus favorite-days-icon"></i>
|
||||
Favorite Reading Days
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Bars show how many reading sessions and total reading time you logged on each day of the week. Filter by year and month to spot seasonal patterns. Helps you find your most productive reading days."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Reading sessions and duration by day of the week</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="filter-controls">
|
||||
<p-select
|
||||
@@ -19,7 +20,7 @@
|
||||
(onChange)="onFilterChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Year"
|
||||
[placeholder]="t('selectYear')"
|
||||
[style]="{'min-width': '90px'}">
|
||||
</p-select>
|
||||
<p-select
|
||||
@@ -28,7 +29,7 @@
|
||||
(onChange)="onFilterChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Month"
|
||||
[placeholder]="t('selectMonth')"
|
||||
[style]="{'min-width': '120px'}">
|
||||
</p-select>
|
||||
</div>
|
||||
@@ -41,3 +42,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+19
-24
@@ -8,13 +8,14 @@ import {Select} from 'primeng/select';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {FavoriteDaysResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type FavoriteDaysChartData = ChartData<'bar', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-favorite-days-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||
templateUrl: './favorite-days-chart.component.html',
|
||||
styleUrls: ['./favorite-days-chart.component.scss']
|
||||
})
|
||||
@@ -24,6 +25,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
public readonly chartOptions: ChartConfiguration['options'];
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<FavoriteDaysChartData>;
|
||||
|
||||
@@ -32,21 +34,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
public selectedYear: number | null = null;
|
||||
public selectedMonth: number | null = null;
|
||||
public yearOptions: { label: string; value: number | null }[] = [];
|
||||
public monthOptions: { label: string; value: number | null }[] = [
|
||||
{label: 'All Months', value: null},
|
||||
{label: 'January', value: 1},
|
||||
{label: 'February', value: 2},
|
||||
{label: 'March', value: 3},
|
||||
{label: 'April', value: 4},
|
||||
{label: 'May', value: 5},
|
||||
{label: 'June', value: 6},
|
||||
{label: 'July', value: 7},
|
||||
{label: 'August', value: 8},
|
||||
{label: 'September', value: 9},
|
||||
{label: 'October', value: 10},
|
||||
{label: 'November', value: 11},
|
||||
{label: 'December', value: 12}
|
||||
];
|
||||
public monthOptions: { label: string; value: number | null }[] = [];
|
||||
|
||||
constructor() {
|
||||
this.chartDataSubject = new BehaviorSubject<FavoriteDaysChartData>({
|
||||
@@ -88,8 +76,10 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
label: (context) => {
|
||||
const label = context.dataset.label || '';
|
||||
const value = context.parsed.y;
|
||||
if (label === 'Sessions') {
|
||||
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
|
||||
const sessionsLabel = this.t.translate('statsUser.favoriteDays.sessions');
|
||||
if (label === sessionsLabel) {
|
||||
const key = value !== 1 ? 'statsUser.favoriteDays.tooltipSessionsPlural' : 'statsUser.favoriteDays.tooltipSessions';
|
||||
return this.t.translate(key, {label, value});
|
||||
} else {
|
||||
const hours = Math.floor(value);
|
||||
const minutes = Math.floor((value % 1) * 60);
|
||||
@@ -104,7 +94,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Day of Week',
|
||||
text: this.t.translate('statsUser.favoriteDays.axisDayOfWeek'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -125,7 +115,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
position: 'left',
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Sessions',
|
||||
text: this.t.translate('statsUser.favoriteDays.axisNumberOfSessions'),
|
||||
color: 'rgba(139, 92, 246, 1)',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -150,7 +140,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
position: 'right',
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Duration (hours)',
|
||||
text: this.t.translate('statsUser.favoriteDays.axisDurationHours'),
|
||||
color: 'rgba(236, 72, 153, 1)',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -187,10 +177,15 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
private initializeYearOptions(): void {
|
||||
const currentYear = new Date().getFullYear();
|
||||
this.yearOptions = [{label: 'All Years', value: null}];
|
||||
this.yearOptions = [{label: this.t.translate('statsUser.favoriteDays.allYears'), value: null}];
|
||||
for (let year = currentYear; year >= currentYear - 10; year--) {
|
||||
this.yearOptions.push({label: year.toString(), value: year});
|
||||
}
|
||||
const monthKeys = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
this.monthOptions = [
|
||||
{label: this.t.translate('statsUser.favoriteDays.allMonths'), value: null},
|
||||
...monthKeys.map((key, i) => ({label: this.t.translate(`statsUser.favoriteDays.${key}`), value: i + 1}))
|
||||
];
|
||||
}
|
||||
|
||||
public onFilterChange(): void {
|
||||
@@ -235,7 +230,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Sessions',
|
||||
label: this.t.translate('statsUser.favoriteDays.sessions'),
|
||||
data: sessionCounts,
|
||||
backgroundColor: 'rgba(139, 92, 246, 0.8)',
|
||||
borderColor: 'rgba(139, 92, 246, 1)',
|
||||
@@ -246,7 +241,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
||||
yAxisID: 'y'
|
||||
},
|
||||
{
|
||||
label: 'Duration (hours)',
|
||||
label: this.t.translate('statsUser.favoriteDays.durationHours'),
|
||||
data: durations,
|
||||
backgroundColor: 'rgba(236, 72, 153, 0.8)',
|
||||
borderColor: 'rgba(236, 72, 153, 1)',
|
||||
|
||||
+5
-3
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.genreStats'">
|
||||
<div class="genre-stats-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-bar genre-title-icon"></i>
|
||||
Reading by Genre
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Ranks your top genres by total reading time. Each bar shows how many hours you've spent reading books in that genre, so you can see where most of your reading time actually goes."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Top genres by total reading time</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -21,3 +22,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+17
-10
@@ -6,13 +6,14 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {GenreStatsResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type GenreChartData = ChartData<'bar', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-genre-stats-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './genre-stats-chart.component.html',
|
||||
styleUrls: ['./genre-stats-chart.component.scss']
|
||||
})
|
||||
@@ -24,6 +25,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
||||
public readonly chartOptions: ChartConfiguration['options'];
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<GenreChartData>;
|
||||
|
||||
@@ -77,7 +79,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Genres',
|
||||
text: this.t.translate('statsUser.genreStats.axisGenres'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -104,7 +106,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Time Read',
|
||||
text: this.t.translate('statsUser.genreStats.axisTimeRead'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -121,22 +123,27 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
||||
const hours = Math.floor(minutes / 60);
|
||||
const days = Math.floor(hours / 24);
|
||||
|
||||
const dayLabel = days === 1 ? this.t.translate('statsUser.genreStats.day') : this.t.translate('statsUser.genreStats.days');
|
||||
const hrLabel = (h: number) => h === 1 ? this.t.translate('statsUser.genreStats.hr') : this.t.translate('statsUser.genreStats.hrs');
|
||||
const minLabel = this.t.translate('statsUser.genreStats.min');
|
||||
const secLabel = this.t.translate('statsUser.genreStats.sec');
|
||||
|
||||
if (days > 0) {
|
||||
const remainingHours = hours % 24;
|
||||
if (remainingHours > 0) {
|
||||
return `${days} ${days === 1 ? 'day' : 'days'} ${remainingHours} ${remainingHours === 1 ? 'hr' : 'hrs'}`;
|
||||
return `${days} ${dayLabel} ${remainingHours} ${hrLabel(remainingHours)}`;
|
||||
}
|
||||
return `${days} ${days === 1 ? 'day' : 'days'}`;
|
||||
return `${days} ${dayLabel}`;
|
||||
} else if (hours > 0) {
|
||||
const remainingMinutes = minutes % 60;
|
||||
if (remainingMinutes > 0) {
|
||||
return `${hours} ${hours === 1 ? 'hr' : 'hrs'} ${remainingMinutes} min`;
|
||||
return `${hours} ${hrLabel(hours)} ${remainingMinutes} ${minLabel}`;
|
||||
}
|
||||
return `${hours} ${hours === 1 ? 'hr' : 'hrs'}`;
|
||||
return `${hours} ${hrLabel(hours)}`;
|
||||
} else if (minutes > 0) {
|
||||
return `${minutes} min`;
|
||||
return `${minutes} ${minLabel}`;
|
||||
}
|
||||
return `${seconds} sec`;
|
||||
return `${seconds} ${secLabel}`;
|
||||
},
|
||||
stepSize: undefined,
|
||||
maxTicksLimit: 8
|
||||
@@ -185,7 +192,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Reading Time',
|
||||
label: this.t.translate('statsUser.genreStats.readingTime'),
|
||||
data: durations,
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.8)',
|
||||
borderColor: 'rgba(34, 197, 94, 1)',
|
||||
|
||||
+11
-9
@@ -1,31 +1,32 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.pageTurner'">
|
||||
<div class="page-turner-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-bolt page-turner-icon"></i>
|
||||
Page Turner Score
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Each book gets a 'grip score' (0-100) based on how your reading behavior changed over time. It measures whether your sessions got longer, whether gaps between sessions shrank, and whether you had a burst of reading near the end. Higher scores mean the book pulled you in more as you read."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">How gripping each book was based on your reading patterns</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="stats-row">
|
||||
<div class="stat-item">
|
||||
<span class="stat-value" [title]="stats.mostGripping">{{ stats.mostGripping | slice:0:18 }}</span>
|
||||
<span class="stat-label">Most Gripping</span>
|
||||
<span class="stat-label">{{ t('mostGripping') }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-value">{{ stats.avgGripScore }}</span>
|
||||
<span class="stat-label">Avg Grip Score</span>
|
||||
<span class="stat-label">{{ t('avgGripScore') }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<span class="stat-value" [title]="stats.guiltyPleasure">{{ stats.guiltyPleasure | slice:0:18 }}</span>
|
||||
<span class="stat-label">Guilty Pleasure</span>
|
||||
<span class="stat-label">{{ t('guiltyPleasure') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,15 +38,15 @@
|
||||
<div class="book-info">
|
||||
<span class="book-name">{{ book.bookTitle | slice:0:30 }}</span>
|
||||
<div class="book-indicators">
|
||||
<span class="indicator" [title]="'Session duration trend'">
|
||||
<span class="indicator" [title]="t('sessionDurationTrend')">
|
||||
<i class="pi pi-clock"></i> {{ getAccelerationLabel(book.sessionAcceleration) }}
|
||||
</span>
|
||||
<span class="indicator" [title]="'Gap between sessions trend'">
|
||||
<span class="indicator" [title]="t('gapBetweenSessionsTrend')">
|
||||
<i class="pi pi-calendar"></i> {{ getGapLabel(book.gapReduction) }}
|
||||
</span>
|
||||
@if (book.finishBurst) {
|
||||
<span class="indicator burst">
|
||||
<i class="pi pi-forward"></i> Finish Burst
|
||||
<i class="pi pi-forward"></i> {{ t('finishBurst') }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
@@ -64,3 +65,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+15
-13
@@ -6,13 +6,14 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {PageTurnerScoreResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type PageTurnerChartData = ChartData<'bar', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-turner-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './page-turner-chart.component.html',
|
||||
styleUrls: ['./page-turner-chart.component.scss']
|
||||
})
|
||||
@@ -25,6 +26,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
||||
public topBooks: PageTurnerScoreResponse[] = [];
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<PageTurnerChartData>;
|
||||
|
||||
@@ -61,7 +63,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Grip Score (0-100)',
|
||||
text: this.t.translate('statsUser.pageTurner.axisGripScore'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 13, weight: 'bold'}
|
||||
},
|
||||
@@ -145,12 +147,12 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
||||
const item = top15[idx];
|
||||
if (!item) return '';
|
||||
const lines = [
|
||||
`Grip Score: ${item.gripScore}/100`,
|
||||
`Sessions: ${item.totalSessions}`,
|
||||
`Avg Session: ${Math.round(item.avgSessionDurationSeconds / 60)}min`,
|
||||
this.t.translate('statsUser.pageTurner.tooltipGripScore', {score: item.gripScore}),
|
||||
this.t.translate('statsUser.pageTurner.tooltipSessions', {count: item.totalSessions}),
|
||||
this.t.translate('statsUser.pageTurner.tooltipAvgSession', {minutes: Math.round(item.avgSessionDurationSeconds / 60)}),
|
||||
];
|
||||
if (item.personalRating) {
|
||||
lines.push(`Rating: ${item.personalRating}/10`);
|
||||
lines.push(this.t.translate('statsUser.pageTurner.tooltipRating', {rating: item.personalRating}));
|
||||
}
|
||||
return lines;
|
||||
};
|
||||
@@ -159,7 +161,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
||||
this.chartDataSubject.next({
|
||||
labels,
|
||||
datasets: [{
|
||||
label: 'Grip Score',
|
||||
label: this.t.translate('statsUser.pageTurner.gripScore'),
|
||||
data: values,
|
||||
backgroundColor: bgColors,
|
||||
borderColor: bgColors.map(c => c.replace('0.85', '1')),
|
||||
@@ -172,14 +174,14 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
getAccelerationLabel(value: number): string {
|
||||
if (value > 5) return 'Increasing';
|
||||
if (value < -5) return 'Decreasing';
|
||||
return 'Steady';
|
||||
if (value > 5) return this.t.translate('statsUser.pageTurner.increasing');
|
||||
if (value < -5) return this.t.translate('statsUser.pageTurner.decreasing');
|
||||
return this.t.translate('statsUser.pageTurner.steady');
|
||||
}
|
||||
|
||||
getGapLabel(value: number): string {
|
||||
if (value < -2) return 'Shrinking';
|
||||
if (value > 2) return 'Growing';
|
||||
return 'Steady';
|
||||
if (value < -2) return this.t.translate('statsUser.pageTurner.shrinking');
|
||||
if (value > 2) return this.t.translate('statsUser.pageTurner.growing');
|
||||
return this.t.translate('statsUser.pageTurner.steady');
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.peakHours'">
|
||||
<div class="peak-hours-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-clock peak-hours-icon"></i>
|
||||
Peak Reading Hours
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Shows the number of reading sessions and total reading time for each hour of the day (midnight to 11pm). Filter by year and month to see how your habits shift over time. The peak hour highlights when you read the most."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Reading activity by hour of the day</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="filter-controls">
|
||||
<p-select
|
||||
@@ -19,7 +20,7 @@
|
||||
(onChange)="onFilterChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Year"
|
||||
[placeholder]="t('selectYear')"
|
||||
[style]="{'min-width': '100px'}">
|
||||
</p-select>
|
||||
<p-select
|
||||
@@ -28,7 +29,7 @@
|
||||
(onChange)="onFilterChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Month"
|
||||
[placeholder]="t('selectMonth')"
|
||||
[style]="{'min-width': '130px'}">
|
||||
</p-select>
|
||||
</div>
|
||||
@@ -41,3 +42,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+20
-25
@@ -8,13 +8,14 @@ import {Select} from 'primeng/select';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type PeakHoursChartData = ChartData<'line', number[], string>;
|
||||
|
||||
@Component({
|
||||
selector: 'app-peak-hours-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||
templateUrl: './peak-hours-chart.component.html',
|
||||
styleUrls: ['./peak-hours-chart.component.scss']
|
||||
})
|
||||
@@ -24,27 +25,14 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
public readonly chartOptions: ChartConfiguration['options'];
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<PeakHoursChartData>;
|
||||
|
||||
public selectedYear: number | null = null;
|
||||
public selectedMonth: number | null = null;
|
||||
public yearOptions: { label: string; value: number | null }[] = [];
|
||||
public monthOptions: { label: string; value: number | null }[] = [
|
||||
{label: 'All Months', value: null},
|
||||
{label: 'January', value: 1},
|
||||
{label: 'February', value: 2},
|
||||
{label: 'March', value: 3},
|
||||
{label: 'April', value: 4},
|
||||
{label: 'May', value: 5},
|
||||
{label: 'June', value: 6},
|
||||
{label: 'July', value: 7},
|
||||
{label: 'August', value: 8},
|
||||
{label: 'September', value: 9},
|
||||
{label: 'October', value: 10},
|
||||
{label: 'November', value: 11},
|
||||
{label: 'December', value: 12}
|
||||
];
|
||||
public monthOptions: { label: string; value: number | null }[] = [];
|
||||
|
||||
constructor() {
|
||||
this.chartDataSubject = new BehaviorSubject<PeakHoursChartData>({
|
||||
@@ -86,10 +74,12 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
label: (context) => {
|
||||
const label = context.dataset.label || '';
|
||||
const value = context.parsed.y;
|
||||
if (label === 'Sessions') {
|
||||
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
|
||||
const sessionsLabel = this.t.translate('statsUser.peakHours.sessions');
|
||||
if (label === sessionsLabel) {
|
||||
const key = value !== 1 ? 'statsUser.peakHours.tooltipSessionsPlural' : 'statsUser.peakHours.tooltipSessions';
|
||||
return this.t.translate(key, {label, value});
|
||||
} else {
|
||||
return `${label}: ${value} min`;
|
||||
return this.t.translate('statsUser.peakHours.tooltipMin', {label, value});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +90,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Hour of Day',
|
||||
text: this.t.translate('statsUser.peakHours.axisHourOfDay'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -123,7 +113,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
position: 'left',
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Sessions',
|
||||
text: this.t.translate('statsUser.peakHours.axisNumberOfSessions'),
|
||||
color: 'rgba(34, 197, 94, 0.9)',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -148,7 +138,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
position: 'right',
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Avg Duration (min)',
|
||||
text: this.t.translate('statsUser.peakHours.axisAvgDuration'),
|
||||
color: 'rgba(251, 191, 36, 0.9)',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -185,10 +175,15 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
private initializeYearOptions(): void {
|
||||
const currentYear = new Date().getFullYear();
|
||||
this.yearOptions = [{label: 'All Years', value: null}];
|
||||
this.yearOptions = [{label: this.t.translate('statsUser.peakHours.allYears'), value: null}];
|
||||
for (let year = currentYear; year >= currentYear - 10; year--) {
|
||||
this.yearOptions.push({label: year.toString(), value: year});
|
||||
}
|
||||
const monthKeys = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
|
||||
this.monthOptions = [
|
||||
{label: this.t.translate('statsUser.peakHours.allMonths'), value: null},
|
||||
...monthKeys.map((key, i) => ({label: this.t.translate(`statsUser.peakHours.${key}`), value: i + 1}))
|
||||
];
|
||||
}
|
||||
|
||||
public onFilterChange(): void {
|
||||
@@ -239,7 +234,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Sessions',
|
||||
label: this.t.translate('statsUser.peakHours.sessions'),
|
||||
data: sessionCounts,
|
||||
borderColor: 'rgba(34, 197, 94, 0.9)',
|
||||
backgroundColor: 'rgba(34, 197, 94, 0.1)',
|
||||
@@ -254,7 +249,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
||||
yAxisID: 'y'
|
||||
},
|
||||
{
|
||||
label: 'Avg Duration (min)',
|
||||
label: this.t.translate('statsUser.peakHours.avgDurationMin'),
|
||||
data: avgDurations,
|
||||
borderColor: 'rgba(251, 191, 36, 0.9)',
|
||||
backgroundColor: 'rgba(251, 191, 36, 0.1)',
|
||||
|
||||
+5
-4
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.personalRating'">
|
||||
<div class="personal-rating-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-star-fill personal-rating-icon"></i>
|
||||
Personal Rating Distribution
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Shows how many books you've given each rating from 1 to 10. Helps you see whether you tend to rate generously, harshly, or cluster around a particular score. Only books with a personal rating are included."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Books by your rating (1–10)</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -21,4 +22,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
+10
-7
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface RatingStats {
|
||||
ratingRange: string;
|
||||
@@ -53,12 +54,13 @@ type RatingChartData = ChartData<'bar', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-personal-rating-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './personal-rating-chart.component.html',
|
||||
styleUrls: ['./personal-rating-chart.component.scss']
|
||||
})
|
||||
export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'bar' as const;
|
||||
@@ -84,10 +86,11 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
titleFont: {size: 14, weight: 'bold'},
|
||||
bodyFont: {size: 13},
|
||||
callbacks: {
|
||||
title: (context) => `Personal Rating: ${context[0].label}`,
|
||||
title: (context) => this.t.translate('statsUser.personalRating.tooltipTitle', {label: context[0].label}),
|
||||
label: (context) => {
|
||||
const value = context.parsed.y;
|
||||
return `${value} book${value === 1 ? '' : 's'}`;
|
||||
const key = value === 1 ? 'statsUser.personalRating.tooltipBook' : 'statsUser.personalRating.tooltipBooks';
|
||||
return this.t.translate(key, {value});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -97,7 +100,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Personal Rating',
|
||||
text: this.t.translate('statsUser.personalRating.axisPersonalRating'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -117,7 +120,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
y: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Number of Books',
|
||||
text: this.t.translate('statsUser.personalRating.axisNumberOfBooks'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -145,7 +148,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
private readonly chartDataSubject = new BehaviorSubject<RatingChartData>({
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Books by Personal Rating',
|
||||
label: this.t.translate('statsUser.personalRating.booksByPersonalRating'),
|
||||
data: [],
|
||||
backgroundColor: [...CHART_COLORS],
|
||||
...CHART_DEFAULTS
|
||||
@@ -189,7 +192,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||
this.chartDataSubject.next({
|
||||
labels: allLabels,
|
||||
datasets: [{
|
||||
label: 'Books by Personal Rating',
|
||||
label: this.t.translate('statsUser.personalRating.booksByPersonalRating'),
|
||||
data: dataValues,
|
||||
backgroundColor: colors,
|
||||
borderColor: colors.map(color => color),
|
||||
|
||||
+15
-13
@@ -1,21 +1,22 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.ratingTaste'">
|
||||
<div class="rating-taste-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-scatter rating-taste-icon"></i>
|
||||
Rating Taste Comparison
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Each dot is a book plotted by its external rating (X-axis, e.g. Goodreads/Amazon) versus your personal rating (Y-axis). Books on the diagonal mean you agree with the crowd. Above the line means you rated higher; below means you rated lower. Quadrants show your taste patterns."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Compare your personal ratings against external ratings (Goodreads, Amazon, etc.)</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (totalRatedBooks > 0) {
|
||||
<div class="stats-badge">
|
||||
<span class="badge-value">{{ totalRatedBooks }}</span>
|
||||
<span class="badge-label">books analyzed</span>
|
||||
<span class="badge-label">{{ t('booksAnalyzed') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -27,28 +28,28 @@
|
||||
[type]="chartType">
|
||||
</canvas>
|
||||
<div class="quadrant-labels">
|
||||
<div class="quadrant-label top-left">Hidden Gems 💎</div>
|
||||
<div class="quadrant-label top-right">Popular Favorites ⭐</div>
|
||||
<div class="quadrant-label bottom-left">Agreed Misses 👎</div>
|
||||
<div class="quadrant-label bottom-right">Overrated 📉</div>
|
||||
<div class="quadrant-label top-left">{{ t('quadrantHiddenGems') }} 💎</div>
|
||||
<div class="quadrant-label top-right">{{ t('quadrantPopularFavorites') }} ⭐</div>
|
||||
<div class="quadrant-label bottom-left">{{ t('quadrantAgreedMisses') }} 👎</div>
|
||||
<div class="quadrant-label bottom-right">{{ t('quadrantOverrated') }} 📉</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (quadrants.length > 0) {
|
||||
<div class="taste-insights">
|
||||
<div class="insights-header">
|
||||
<h4>Your Taste Profile</h4>
|
||||
<h4>{{ t('tasteProfile') }}</h4>
|
||||
@if (averageDeviation > 0) {
|
||||
<div class="deviation-badge" [class.unique]="averageDeviation > 1" [class.mainstream]="averageDeviation <= 0.5">
|
||||
<span class="deviation-label">Avg. deviation:</span>
|
||||
<span class="deviation-label">{{ t('avgDeviation') }}</span>
|
||||
<span class="deviation-value">{{ averageDeviation.toFixed(2) }} ★</span>
|
||||
<span class="deviation-desc">
|
||||
@if (averageDeviation > 1) {
|
||||
(Unique taste)
|
||||
({{ t('uniqueTaste') }})
|
||||
} @else if (averageDeviation <= 0.5) {
|
||||
(Mainstream)
|
||||
({{ t('mainstream') }})
|
||||
} @else {
|
||||
(Balanced)
|
||||
({{ t('balanced') }})
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -76,3 +77,4 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+38
-28
@@ -9,6 +9,7 @@ import {BookService} from '../../../../../book/service/book.service';
|
||||
import {LibraryFilterService} from '../../../library-stats/service/library-filter.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface TasteQuadrant {
|
||||
name: string;
|
||||
@@ -31,13 +32,14 @@ type RatingTasteChartData = ChartData<'scatter', BookDataPoint[], string>;
|
||||
@Component({
|
||||
selector: 'app-rating-taste-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './rating-taste-chart.component.html',
|
||||
styleUrls: ['./rating-taste-chart.component.scss']
|
||||
})
|
||||
export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'scatter' as const;
|
||||
@@ -57,7 +59,7 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
max: 5,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'External Rating (1-5 scale)',
|
||||
text: this.t.translate('statsUser.ratingTaste.axisExternalRating'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -83,7 +85,7 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
max: 5,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Your Personal Rating (normalized from 1-10)',
|
||||
text: this.t.translate('statsUser.ratingTaste.axisPersonalRating'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -134,17 +136,17 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
callbacks: {
|
||||
title: (context) => {
|
||||
const point = context[0].raw as BookDataPoint;
|
||||
return point.bookTitle || 'Unknown Book';
|
||||
return point.bookTitle || this.t.translate('statsUser.ratingTaste.tooltipUnknownBook');
|
||||
},
|
||||
label: (context) => {
|
||||
const point = context.raw as BookDataPoint;
|
||||
const diff = point.personalRatingNormalized - point.externalRating;
|
||||
const diffText = diff > 0 ? `+${diff.toFixed(1)}` : diff.toFixed(1);
|
||||
return [
|
||||
`Your Rating: ${point.personalRating}/10 (${point.personalRatingNormalized.toFixed(1)}/5)`,
|
||||
`External Rating: ${point.externalRating.toFixed(1)}/5`,
|
||||
`Difference: ${diffText} (on 5-point scale)`,
|
||||
`Category: ${point.quadrant}`
|
||||
this.t.translate('statsUser.ratingTaste.tooltipYourRating', {rating: point.personalRating, normalized: point.personalRatingNormalized.toFixed(1)}),
|
||||
this.t.translate('statsUser.ratingTaste.tooltipExternalRating', {rating: point.externalRating.toFixed(1)}),
|
||||
this.t.translate('statsUser.ratingTaste.tooltipDifference', {diff: diffText}),
|
||||
this.t.translate('statsUser.ratingTaste.tooltipCategory', {category: point.quadrant})
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -261,10 +263,10 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
private categorizeBooks(books: Book[]): Map<string, BookDataPoint[]> {
|
||||
const categories = new Map<string, BookDataPoint[]>([
|
||||
['Hidden Gems', []],
|
||||
['Popular Favorites', []],
|
||||
['Overrated', []],
|
||||
['Agreed Misses', []]
|
||||
[this.t.translate('statsUser.ratingTaste.quadrantHiddenGems'), []],
|
||||
[this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites'), []],
|
||||
[this.t.translate('statsUser.ratingTaste.quadrantOverrated'), []],
|
||||
[this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses'), []]
|
||||
]);
|
||||
|
||||
books.forEach(book => {
|
||||
@@ -277,13 +279,13 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
// Use normalized rating (3 is midpoint on 1-5 scale) for quadrant calculation
|
||||
let quadrant: string;
|
||||
if (personalRatingNormalized >= 3 && externalRating >= 3) {
|
||||
quadrant = 'Popular Favorites';
|
||||
quadrant = this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites');
|
||||
} else if (personalRatingNormalized >= 3 && externalRating < 3) {
|
||||
quadrant = 'Hidden Gems';
|
||||
quadrant = this.t.translate('statsUser.ratingTaste.quadrantHiddenGems');
|
||||
} else if (personalRatingNormalized < 3 && externalRating >= 3) {
|
||||
quadrant = 'Overrated';
|
||||
quadrant = this.t.translate('statsUser.ratingTaste.quadrantOverrated');
|
||||
} else {
|
||||
quadrant = 'Agreed Misses';
|
||||
quadrant = this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses');
|
||||
}
|
||||
|
||||
const dataPoint: BookDataPoint = {
|
||||
@@ -303,11 +305,15 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private updateChartData(dataPoints: Map<string, BookDataPoint[]>): void {
|
||||
const pf = this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites');
|
||||
const hg = this.t.translate('statsUser.ratingTaste.quadrantHiddenGems');
|
||||
const or = this.t.translate('statsUser.ratingTaste.quadrantOverrated');
|
||||
const am = this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses');
|
||||
const quadrantColors: Record<string, { bg: string, border: string }> = {
|
||||
'Popular Favorites': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||
'Hidden Gems': {bg: 'rgba(156, 39, 176, 0.7)', border: '#9c27b0'},
|
||||
'Overrated': {bg: 'rgba(255, 152, 0, 0.7)', border: '#ff9800'},
|
||||
'Agreed Misses': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||
[pf]: {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||
[hg]: {bg: 'rgba(156, 39, 176, 0.7)', border: '#9c27b0'},
|
||||
[or]: {bg: 'rgba(255, 152, 0, 0.7)', border: '#ff9800'},
|
||||
[am]: {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||
};
|
||||
|
||||
const datasets = Array.from(dataPoints.entries())
|
||||
@@ -326,24 +332,28 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private calculateStatistics(dataPoints: Map<string, BookDataPoint[]>): void {
|
||||
const pfKey = this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites');
|
||||
const hgKey = this.t.translate('statsUser.ratingTaste.quadrantHiddenGems');
|
||||
const orKey = this.t.translate('statsUser.ratingTaste.quadrantOverrated');
|
||||
const amKey = this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses');
|
||||
const quadrantInfo: Record<string, { description: string, icon: string, color: string }> = {
|
||||
'Popular Favorites': {
|
||||
description: 'Books you and the public both love',
|
||||
[pfKey]: {
|
||||
description: this.t.translate('statsUser.ratingTaste.quadrantDescPopularFavorites'),
|
||||
icon: '⭐',
|
||||
color: '#4caf50'
|
||||
},
|
||||
'Hidden Gems': {
|
||||
description: 'Books you rate higher than the public',
|
||||
[hgKey]: {
|
||||
description: this.t.translate('statsUser.ratingTaste.quadrantDescHiddenGems'),
|
||||
icon: '💎',
|
||||
color: '#9c27b0'
|
||||
},
|
||||
'Overrated': {
|
||||
description: 'Popular books that disappointed you',
|
||||
[orKey]: {
|
||||
description: this.t.translate('statsUser.ratingTaste.quadrantDescOverrated'),
|
||||
icon: '📉',
|
||||
color: '#ff9800'
|
||||
},
|
||||
'Agreed Misses': {
|
||||
description: 'Books neither you nor public enjoyed',
|
||||
[amKey]: {
|
||||
description: this.t.translate('statsUser.ratingTaste.quadrantDescAgreedMisses'),
|
||||
icon: '👎',
|
||||
color: '#9e9e9e'
|
||||
}
|
||||
|
||||
+5
-3
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readStatus'">
|
||||
<div class="read-status-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-book read-status-icon"></i>
|
||||
Reading Status Distribution
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Breaks down your entire library by reading status: read, reading, partially read, paused, abandoned, won't read, and unread. Gives you a quick snapshot of how much of your collection you've worked through."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Books by their reading status</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -21,3 +22,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+36
-34
@@ -3,28 +3,30 @@ import {CommonModule} from '@angular/common';
|
||||
import {BaseChartDirective} from 'ng2-charts';
|
||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, filter, first, takeUntil} from 'rxjs/operators';
|
||||
import {ChartConfiguration, ChartData, Chart, TooltipItem} from 'chart.js';
|
||||
import {ChartConfiguration, ChartData, Chart} from 'chart.js';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ReadingStatusStats {
|
||||
status: string;
|
||||
rawStatus: ReadStatus;
|
||||
count: number;
|
||||
percentage: number;
|
||||
}
|
||||
|
||||
const STATUS_COLOR_MAP: Record<string, string> = {
|
||||
'Unread': '#6c757d', // Gray
|
||||
'Currently Reading': '#17a2b8', // Cyan
|
||||
'Re-reading': '#6f42c1', // Purple
|
||||
'Read': '#28a745', // Green
|
||||
'Partially Read': '#ffc107', // Yellow
|
||||
'Paused': '#fd7e14', // Orange
|
||||
"Won't Read": '#dc3545', // Red
|
||||
'Abandoned': '#e74c3c', // Light Red
|
||||
'No Status': '#343a40' // Dark Gray
|
||||
[ReadStatus.UNREAD]: '#6c757d',
|
||||
[ReadStatus.READING]: '#17a2b8',
|
||||
[ReadStatus.RE_READING]: '#6f42c1',
|
||||
[ReadStatus.READ]: '#28a745',
|
||||
[ReadStatus.PARTIALLY_READ]: '#ffc107',
|
||||
[ReadStatus.PAUSED]: '#fd7e14',
|
||||
[ReadStatus.WONT_READ]: '#dc3545',
|
||||
[ReadStatus.ABANDONED]: '#e74c3c',
|
||||
[ReadStatus.UNSET]: '#343a40'
|
||||
} as const;
|
||||
|
||||
const CHART_DEFAULTS = {
|
||||
@@ -39,12 +41,13 @@ type StatusChartData = ChartData<'doughnut', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-read-status-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './read-status-chart.component.html',
|
||||
styleUrls: ['./read-status-chart.component.scss']
|
||||
})
|
||||
export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'doughnut' as const;
|
||||
@@ -84,7 +87,15 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
bodyFont: {size: 13},
|
||||
callbacks: {
|
||||
title: (context) => context[0]?.label || '',
|
||||
label: this.formatTooltipLabel
|
||||
label: (context) => {
|
||||
const dataIndex = context.dataIndex;
|
||||
const dataset = context.dataset;
|
||||
const value = dataset.data[dataIndex] as number;
|
||||
const label = context.chart.data.labels?.[dataIndex] || '';
|
||||
const total = (dataset.data as number[]).reduce((a: number, b: number) => a + b, 0);
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
return this.t.translate('statsUser.readStatus.tooltipLabel', {label, value, percentage});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -131,7 +142,7 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
try {
|
||||
const labels = stats.map(s => s.status);
|
||||
const dataValues = stats.map(s => s.count);
|
||||
const colors = stats.map(s => STATUS_COLOR_MAP[s.status] || '#6c757d');
|
||||
const colors = stats.map(s => STATUS_COLOR_MAP[s.rawStatus] || '#6c757d');
|
||||
|
||||
this.chartDataSubject.next({
|
||||
labels,
|
||||
@@ -196,6 +207,7 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
return Array.from(statusMap.entries())
|
||||
.map(([status, count]) => ({
|
||||
status: this.formatReadStatus(status),
|
||||
rawStatus: status,
|
||||
count,
|
||||
percentage: Number(((count / totalBooks) * 100).toFixed(1))
|
||||
}))
|
||||
@@ -204,19 +216,19 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
|
||||
private formatReadStatus(status: ReadStatus | null | undefined): string {
|
||||
const STATUS_MAPPING: Record<string, string> = {
|
||||
[ReadStatus.UNREAD]: 'Unread',
|
||||
[ReadStatus.READING]: 'Currently Reading',
|
||||
[ReadStatus.RE_READING]: 'Re-reading',
|
||||
[ReadStatus.READ]: 'Read',
|
||||
[ReadStatus.PARTIALLY_READ]: 'Partially Read',
|
||||
[ReadStatus.PAUSED]: 'Paused',
|
||||
[ReadStatus.WONT_READ]: "Won't Read",
|
||||
[ReadStatus.ABANDONED]: 'Abandoned',
|
||||
[ReadStatus.UNSET]: 'No Status'
|
||||
[ReadStatus.UNREAD]: this.t.translate('statsUser.readStatus.unread'),
|
||||
[ReadStatus.READING]: this.t.translate('statsUser.readStatus.currentlyReading'),
|
||||
[ReadStatus.RE_READING]: this.t.translate('statsUser.readStatus.reReading'),
|
||||
[ReadStatus.READ]: this.t.translate('statsUser.readStatus.read'),
|
||||
[ReadStatus.PARTIALLY_READ]: this.t.translate('statsUser.readStatus.partiallyRead'),
|
||||
[ReadStatus.PAUSED]: this.t.translate('statsUser.readStatus.paused'),
|
||||
[ReadStatus.WONT_READ]: this.t.translate('statsUser.readStatus.wontRead'),
|
||||
[ReadStatus.ABANDONED]: this.t.translate('statsUser.readStatus.abandoned'),
|
||||
[ReadStatus.UNSET]: this.t.translate('statsUser.readStatus.noStatus')
|
||||
};
|
||||
|
||||
if (!status) return 'No Status';
|
||||
return STATUS_MAPPING[status] ?? 'No Status';
|
||||
if (!status) return this.t.translate('statsUser.readStatus.noStatus');
|
||||
return STATUS_MAPPING[status] ?? this.t.translate('statsUser.readStatus.noStatus');
|
||||
}
|
||||
|
||||
private generateLegendLabels(chart: Chart) {
|
||||
@@ -244,14 +256,4 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private formatTooltipLabel(context: TooltipItem<any>): string {
|
||||
const dataIndex = context.dataIndex;
|
||||
const dataset = context.dataset;
|
||||
const value = dataset.data[dataIndex] as number;
|
||||
const label = context.chart.data.labels?.[dataIndex] || 'Unknown';
|
||||
const total = (dataset.data as number[]).reduce((a: number, b: number) => a + b, 0);
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
return `${label}: ${value} books (${percentage}%)`;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-8
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingClock'">
|
||||
<div class="reading-clock-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-clock reading-clock-icon"></i>
|
||||
Reading Clock
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Each segment of the clock represents one hour of the day (12am-11pm). The size of each segment shows how many total minutes you've spent reading during that hour across all time. Warm colors indicate your busiest hours. You're classified as a Night Owl (most reading 8pm-2am), Early Bird (5am-11am), or Balanced."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">When do you read throughout the day</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,15 +19,15 @@
|
||||
<div class="stats-row">
|
||||
<div class="stat-card peak">
|
||||
<span class="stat-value">{{ peakHour }}</span>
|
||||
<span class="stat-label">Peak Hour</span>
|
||||
<span class="stat-label">{{ t('peakHour') }}</span>
|
||||
</div>
|
||||
<div class="stat-card total">
|
||||
<span class="stat-value">{{ totalHoursRead }}h</span>
|
||||
<span class="stat-label">Total Read</span>
|
||||
<span class="stat-label">{{ t('totalRead') }}</span>
|
||||
</div>
|
||||
<div class="stat-card type">
|
||||
<span class="stat-value">{{ readerType }}</span>
|
||||
<span class="stat-label">Reader Type</span>
|
||||
<span class="stat-label">{{ t('readerType') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -42,8 +43,9 @@
|
||||
@if (!hasData) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No reading session data found.</p>
|
||||
<small>Track your reading sessions to see your reading clock.</small>
|
||||
<p>{{ t('noData') }}</p>
|
||||
<small>{{ t('noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+8
-6
@@ -6,6 +6,7 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type ClockChartData = ChartData<'polarArea', number[], string>;
|
||||
|
||||
@@ -19,12 +20,13 @@ const HOUR_LABELS = [
|
||||
@Component({
|
||||
selector: 'app-reading-clock-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-clock-chart.component.html',
|
||||
styleUrls: ['./reading-clock-chart.component.scss']
|
||||
})
|
||||
export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'polarArea' as const;
|
||||
@@ -59,9 +61,9 @@ export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
||||
if (minutes >= 60) {
|
||||
const hrs = Math.floor(minutes / 60);
|
||||
const mins = Math.round(minutes % 60);
|
||||
return `${hrs}h ${mins}m of reading`;
|
||||
return this.t.translate('statsUser.readingClock.tooltipReading', {time: `${hrs}h ${mins}m`});
|
||||
}
|
||||
return `${Math.round(minutes)}m of reading`;
|
||||
return this.t.translate('statsUser.readingClock.tooltipReading', {time: `${Math.round(minutes)}m`});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -138,11 +140,11 @@ export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
||||
const morningTotal = morningHours.reduce((sum, h) => sum + hourMinutes[h], 0);
|
||||
|
||||
if (nightTotal > morningTotal * 1.2) {
|
||||
this.readerType = 'Night Owl';
|
||||
this.readerType = this.t.translate('statsUser.readingClock.nightOwl');
|
||||
} else if (morningTotal > nightTotal * 1.2) {
|
||||
this.readerType = 'Early Bird';
|
||||
this.readerType = this.t.translate('statsUser.readingClock.earlyBird');
|
||||
} else {
|
||||
this.readerType = 'Balanced';
|
||||
this.readerType = this.t.translate('statsUser.readingClock.balanced');
|
||||
}
|
||||
|
||||
// Generate colors: cool blues for low, warm oranges for peak
|
||||
|
||||
+6
-4
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingDna'">
|
||||
<div class="reading-dna-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-line reading-dna-icon"></i>
|
||||
Reading DNA Profile
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="A radar chart profiling your reading personality across 8 dimensions. Scores are computed from your library's genres, ratings, page counts, publication dates, and reading progress. Each trait uses non-overlapping criteria for accurate results."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Your unique reading personality across 8 dimensions</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -22,7 +23,7 @@
|
||||
</div>
|
||||
@if (personalityInsights.length > 0) {
|
||||
<div class="personality-insights">
|
||||
<h4>Your Reading Personality Traits</h4>
|
||||
<h4>{{ t('personalityTraits') }}</h4>
|
||||
<div class="insights-grid">
|
||||
@for (insight of personalityInsights; track insight.trait) {
|
||||
<div class="insight-card">
|
||||
@@ -40,3 +41,4 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+28
-90
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ReadingDNAProfile {
|
||||
adventurous: number;
|
||||
@@ -32,12 +33,13 @@ type ReadingDNAChartData = ChartData<'radar', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-dna-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-dna-chart.component.html',
|
||||
styleUrls: ['./reading-dna-chart.component.scss']
|
||||
})
|
||||
export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'radar' as const;
|
||||
@@ -77,18 +79,12 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
size: 12
|
||||
},
|
||||
padding: 25,
|
||||
callback: function (label: string) {
|
||||
const icons: Record<string, string> = {
|
||||
'Adventurous': '🌟',
|
||||
'Perfectionist': '💎',
|
||||
'Intellectual': '🧠',
|
||||
'Emotional': '💖',
|
||||
'Patient': '🕰️',
|
||||
'Social': '👥',
|
||||
'Nostalgic': '📚',
|
||||
'Ambitious': '🚀'
|
||||
};
|
||||
return [icons[label] || '', label];
|
||||
callback: (label: string) => {
|
||||
const traitKeys = ['adventurous', 'perfectionist', 'intellectual', 'emotional', 'patient', 'social', 'nostalgic', 'ambitious'];
|
||||
const icons = ['🌟', '💎', '🧠', '💖', '🕰️', '👥', '📚', '🚀'];
|
||||
const translatedLabels = traitKeys.map(k => this.t.translate(`statsUser.readingDna.traits.${k}`));
|
||||
const idx = translatedLabels.indexOf(label);
|
||||
return [idx >= 0 ? icons[idx] : '', label];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,16 +107,16 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
callbacks: {
|
||||
title: (context) => {
|
||||
const label = context[0]?.label || '';
|
||||
return `${label} Personality`;
|
||||
return this.t.translate('statsUser.readingDna.tooltipPersonality', {label});
|
||||
},
|
||||
label: (context) => {
|
||||
const score = context.parsed.r;
|
||||
const insight = this.personalityInsights.find(i => i.trait === context.label);
|
||||
|
||||
return [
|
||||
`Score: ${score}/100`,
|
||||
this.t.translate('statsUser.readingDna.tooltipScore', {score}),
|
||||
'',
|
||||
insight ? insight.description : 'Your reading personality trait'
|
||||
insight ? insight.description : this.t.translate('statsUser.readingDna.tooltipDefaultDescription')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -144,11 +140,10 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
};
|
||||
|
||||
private readonly traitKeys = ['adventurous', 'perfectionist', 'intellectual', 'emotional', 'patient', 'social', 'nostalgic', 'ambitious'];
|
||||
|
||||
private readonly chartDataSubject = new BehaviorSubject<ReadingDNAChartData>({
|
||||
labels: [
|
||||
'Adventurous', 'Perfectionist', 'Intellectual', 'Emotional',
|
||||
'Patient', 'Social', 'Nostalgic', 'Ambitious'
|
||||
],
|
||||
labels: [],
|
||||
datasets: []
|
||||
});
|
||||
|
||||
@@ -200,13 +195,12 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
'#9c27b0', '#3f51b5', '#673ab7', '#009688'
|
||||
];
|
||||
|
||||
const translatedLabels = this.traitKeys.map(k => this.t.translate(`statsUser.readingDna.traits.${k}`));
|
||||
|
||||
this.chartDataSubject.next({
|
||||
labels: [
|
||||
'Adventurous', 'Perfectionist', 'Intellectual', 'Emotional',
|
||||
'Patient', 'Social', 'Nostalgic', 'Ambitious'
|
||||
],
|
||||
labels: translatedLabels,
|
||||
datasets: [{
|
||||
label: 'Reading DNA Profile',
|
||||
label: this.t.translate('statsUser.readingDna.readingDnaProfile'),
|
||||
data,
|
||||
backgroundColor: 'rgba(233, 30, 99, 0.2)',
|
||||
borderColor: '#e91e63',
|
||||
@@ -441,75 +435,19 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
private getTraitDescription(trait: string, score: number): string {
|
||||
const descriptions: Record<string, [string, string, string]> = {
|
||||
'Adventurous': [
|
||||
'You tend to stick to familiar genres and formats',
|
||||
'You enjoy a healthy mix of genres and styles',
|
||||
'You explore a wide variety of genres, languages, and formats'
|
||||
],
|
||||
'Perfectionist': [
|
||||
'You keep many books in progress or unfinished',
|
||||
'You finish most books and favor quality reads',
|
||||
'You almost always finish what you start and seek top-rated books'
|
||||
],
|
||||
'Intellectual': [
|
||||
'Your reading leans toward lighter subjects',
|
||||
'You balance entertainment with educational reading',
|
||||
'You gravitate heavily toward non-fiction and scholarly material'
|
||||
],
|
||||
'Emotional': [
|
||||
'You tend toward plot-driven or factual reading',
|
||||
'You enjoy a mix of emotional and analytical reads',
|
||||
'You connect deeply with memoirs, poetry, and emotionally rich stories'
|
||||
],
|
||||
'Patient': [
|
||||
'You prefer shorter, quicker reads',
|
||||
'You occasionally tackle longer works and series',
|
||||
'You regularly take on epic novels and multi-book series'
|
||||
],
|
||||
'Social': [
|
||||
'You prefer niche or lesser-known titles',
|
||||
'You read a mix of popular and niche titles',
|
||||
'Your library is packed with bestsellers and widely-discussed books'
|
||||
],
|
||||
'Nostalgic': [
|
||||
'You mostly read contemporary publications',
|
||||
'You appreciate a mix of classic and modern works',
|
||||
'You have a deep love for classic literature and older works'
|
||||
],
|
||||
'Ambitious': [
|
||||
'You read at a casual pace with shorter books',
|
||||
'You maintain a solid reading volume with some challenging picks',
|
||||
'You push yourself with large volumes of challenging, lengthy books'
|
||||
]
|
||||
};
|
||||
|
||||
const levels = descriptions[trait];
|
||||
if (!levels) return '';
|
||||
|
||||
if (score < 33) return levels[0];
|
||||
if (score < 67) return levels[1];
|
||||
return levels[2];
|
||||
private getTraitDescription(traitKey: string, score: number): string {
|
||||
const level = score < 33 ? 'low' : score < 67 ? 'mid' : 'high';
|
||||
return this.t.translate(`statsUser.readingDna.descriptions.${traitKey}.${level}`);
|
||||
}
|
||||
|
||||
private buildPersonalityInsights(profile: ReadingDNAProfile): PersonalityInsight[] {
|
||||
const traits: { key: keyof ReadingDNAProfile; trait: string; color: string }[] = [
|
||||
{key: 'adventurous', trait: 'Adventurous', color: '#e91e63'},
|
||||
{key: 'perfectionist', trait: 'Perfectionist', color: '#2196f3'},
|
||||
{key: 'intellectual', trait: 'Intellectual', color: '#00bcd4'},
|
||||
{key: 'emotional', trait: 'Emotional', color: '#ff9800'},
|
||||
{key: 'patient', trait: 'Patient', color: '#9c27b0'},
|
||||
{key: 'social', trait: 'Social', color: '#3f51b5'},
|
||||
{key: 'nostalgic', trait: 'Nostalgic', color: '#673ab7'},
|
||||
{key: 'ambitious', trait: 'Ambitious', color: '#009688'}
|
||||
];
|
||||
const traitColors = ['#e91e63', '#2196f3', '#00bcd4', '#ff9800', '#9c27b0', '#3f51b5', '#673ab7', '#009688'];
|
||||
|
||||
return traits.map(({key, trait, color}) => ({
|
||||
trait,
|
||||
score: profile[key],
|
||||
description: this.getTraitDescription(trait, profile[key]),
|
||||
color
|
||||
return this.traitKeys.map((key, i) => ({
|
||||
trait: this.t.translate(`statsUser.readingDna.traits.${key}`),
|
||||
score: profile[key as keyof ReadingDNAProfile],
|
||||
description: this.getTraitDescription(key, profile[key as keyof ReadingDNAProfile]),
|
||||
color: traitColors[i]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingHabits'">
|
||||
<div class="reading-habits-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-line reading-habits-icon"></i>
|
||||
Reading Habits Analysis
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="A radar chart analyzing your reading behavior across 8 dimensions. Consistency measures regularity of completions over time. Completionism tracks finish vs. abandonment rate. Methodology checks if you read series in order. Scores are derived from your reading activity, dates, and progress data."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Your behavioral reading patterns across 8 dimensions</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -22,7 +23,7 @@
|
||||
</div>
|
||||
@if (habitInsights.length > 0) {
|
||||
<div class="habit-insights">
|
||||
<h4>Your Reading Habit Patterns</h4>
|
||||
<h4>{{ t('habitPatterns') }}</h4>
|
||||
<div class="insights-grid">
|
||||
@for (insight of habitInsights; track insight.habit) {
|
||||
<div class="insight-card">
|
||||
@@ -40,3 +41,4 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+27
-90
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ReadingHabitsProfile {
|
||||
consistency: number;
|
||||
@@ -32,14 +33,17 @@ type ReadingHabitsChartData = ChartData<'radar', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-habits-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-habits-chart.component.html',
|
||||
styleUrls: ['./reading-habits-chart.component.scss']
|
||||
})
|
||||
export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
private readonly habitKeys = ['consistency', 'multitasking', 'completionism', 'exploration', 'organization', 'intensity', 'methodology', 'momentum'];
|
||||
|
||||
public readonly chartType = 'radar' as const;
|
||||
|
||||
public readonly chartOptions: ChartConfiguration<'radar'>['options'] = {
|
||||
@@ -77,18 +81,11 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
size: 12
|
||||
},
|
||||
padding: 25,
|
||||
callback: function (label: string) {
|
||||
const icons: Record<string, string> = {
|
||||
'Consistency': '📅',
|
||||
'Multitasking': '📚',
|
||||
'Completionism': '✅',
|
||||
'Exploration': '🔍',
|
||||
'Organization': '📋',
|
||||
'Intensity': '⚡',
|
||||
'Methodology': '🎯',
|
||||
'Momentum': '🔥'
|
||||
};
|
||||
return [icons[label] || '', label];
|
||||
callback: (label: string) => {
|
||||
const icons = ['📅', '📚', '✅', '🔍', '📋', '⚡', '🎯', '🔥'];
|
||||
const translatedLabels = this.habitKeys.map(k => this.t.translate(`statsUser.readingHabits.habits.${k}`));
|
||||
const idx = translatedLabels.indexOf(label);
|
||||
return [idx >= 0 ? icons[idx] : '', label];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,16 +108,16 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
callbacks: {
|
||||
title: (context) => {
|
||||
const label = context[0]?.label || '';
|
||||
return `${label} Habit`;
|
||||
return this.t.translate('statsUser.readingHabits.tooltipHabit', {label});
|
||||
},
|
||||
label: (context) => {
|
||||
const score = context.parsed.r;
|
||||
const insight = this.habitInsights.find(i => i.habit === context.label);
|
||||
|
||||
return [
|
||||
`Score: ${score}/100`,
|
||||
this.t.translate('statsUser.readingHabits.tooltipScore', {score}),
|
||||
'',
|
||||
insight ? insight.description : 'Your reading habit pattern'
|
||||
insight ? insight.description : this.t.translate('statsUser.readingHabits.tooltipDefaultDescription')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -145,10 +142,7 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
};
|
||||
|
||||
private readonly chartDataSubject = new BehaviorSubject<ReadingHabitsChartData>({
|
||||
labels: [
|
||||
'Consistency', 'Multitasking', 'Completionism', 'Exploration',
|
||||
'Organization', 'Intensity', 'Methodology', 'Momentum'
|
||||
],
|
||||
labels: [],
|
||||
datasets: []
|
||||
});
|
||||
|
||||
@@ -200,13 +194,12 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
'#ffc107', '#4caf50', '#2196f3', '#673ab7'
|
||||
];
|
||||
|
||||
const translatedLabels = this.habitKeys.map(k => this.t.translate(`statsUser.readingHabits.habits.${k}`));
|
||||
|
||||
this.chartDataSubject.next({
|
||||
labels: [
|
||||
'Consistency', 'Multitasking', 'Completionism', 'Exploration',
|
||||
'Organization', 'Intensity', 'Methodology', 'Momentum'
|
||||
],
|
||||
labels: translatedLabels,
|
||||
datasets: [{
|
||||
label: 'Reading Habits Profile',
|
||||
label: this.t.translate('statsUser.readingHabits.readingHabitsProfile'),
|
||||
data,
|
||||
backgroundColor: 'rgba(156, 39, 176, 0.2)',
|
||||
borderColor: '#9c27b0',
|
||||
@@ -509,75 +502,19 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
private getHabitDescription(habit: string, score: number): string {
|
||||
const descriptions: Record<string, [string, string, string]> = {
|
||||
'Consistency': [
|
||||
'Your reading is sporadic with long gaps between books',
|
||||
'You read at a fairly regular pace throughout the year',
|
||||
'You maintain a very steady, disciplined reading rhythm'
|
||||
],
|
||||
'Multitasking': [
|
||||
'You prefer focusing on one book at a time',
|
||||
'You occasionally juggle a couple of books at once',
|
||||
'You regularly read multiple books simultaneously'
|
||||
],
|
||||
'Completionism': [
|
||||
'You often set books aside before finishing them',
|
||||
'You finish most books you start, with a few exceptions',
|
||||
'You almost never abandon a book once you start it'
|
||||
],
|
||||
'Exploration': [
|
||||
'You tend to revisit favorite authors and familiar territory',
|
||||
'You balance familiar authors with occasional new discoveries',
|
||||
'You actively seek out new authors, eras, and languages'
|
||||
],
|
||||
'Organization': [
|
||||
'Your library could use more rating and status tracking',
|
||||
'You keep your library reasonably well curated',
|
||||
'You diligently rate, categorize, and track every book'
|
||||
],
|
||||
'Intensity': [
|
||||
'You lean toward shorter, lighter reads',
|
||||
'You read a mix of short and longer books',
|
||||
'You consistently tackle lengthy, immersive books'
|
||||
],
|
||||
'Methodology': [
|
||||
'You pick books spontaneously without a system',
|
||||
'You show some methodical patterns in your reading choices',
|
||||
'You systematically work through series, authors, and genres'
|
||||
],
|
||||
'Momentum': [
|
||||
'Your reading activity has been quiet recently',
|
||||
'You have a steady reading pace going',
|
||||
'You are on a strong active reading streak right now'
|
||||
]
|
||||
};
|
||||
|
||||
const levels = descriptions[habit];
|
||||
if (!levels) return '';
|
||||
|
||||
if (score < 33) return levels[0];
|
||||
if (score < 67) return levels[1];
|
||||
return levels[2];
|
||||
private getHabitDescription(habitKey: string, score: number): string {
|
||||
const level = score < 33 ? 'low' : score < 67 ? 'mid' : 'high';
|
||||
return this.t.translate(`statsUser.readingHabits.descriptions.${habitKey}.${level}`);
|
||||
}
|
||||
|
||||
private buildHabitInsights(profile: ReadingHabitsProfile): HabitInsight[] {
|
||||
const habits: { key: keyof ReadingHabitsProfile; habit: string; color: string }[] = [
|
||||
{key: 'consistency', habit: 'Consistency', color: '#9c27b0'},
|
||||
{key: 'multitasking', habit: 'Multitasking', color: '#e91e63'},
|
||||
{key: 'completionism', habit: 'Completionism', color: '#ff5722'},
|
||||
{key: 'exploration', habit: 'Exploration', color: '#ff9800'},
|
||||
{key: 'organization', habit: 'Organization', color: '#ffc107'},
|
||||
{key: 'intensity', habit: 'Intensity', color: '#4caf50'},
|
||||
{key: 'methodology', habit: 'Methodology', color: '#2196f3'},
|
||||
{key: 'momentum', habit: 'Momentum', color: '#673ab7'}
|
||||
];
|
||||
const habitColors = ['#9c27b0', '#e91e63', '#ff5722', '#ff9800', '#ffc107', '#4caf50', '#2196f3', '#673ab7'];
|
||||
|
||||
return habits.map(({key, habit, color}) => ({
|
||||
habit,
|
||||
score: profile[key],
|
||||
description: this.getHabitDescription(habit, profile[key]),
|
||||
color
|
||||
return this.habitKeys.map((key, i) => ({
|
||||
habit: this.t.translate(`statsUser.readingHabits.habits.${key}`),
|
||||
score: profile[key as keyof ReadingHabitsProfile],
|
||||
description: this.getHabitDescription(key, profile[key as keyof ReadingHabitsProfile]),
|
||||
color: habitColors[i]
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingHeatmap'">
|
||||
<div class="reading-heatmap-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-calendar reading-heatmap-icon"></i>
|
||||
Reading Activity Heatmap
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="A 10-year grid showing how many books were added to your library each month. Darker cells mean more books. Helps you visualize long-term acquisition trends and seasonal reading bursts."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Monthly reading activity over the past 10 years</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -21,4 +22,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
+7
-4
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface MatrixDataPoint {
|
||||
x: number; // month (0-11)
|
||||
@@ -28,12 +29,13 @@ type HeatmapChartData = ChartData<'matrix', MatrixDataPoint[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-heatmap-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-heatmap-chart.component.html',
|
||||
styleUrls: ['./reading-heatmap-chart.component.scss']
|
||||
})
|
||||
export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'matrix' as const;
|
||||
@@ -72,7 +74,8 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
label: (context) => {
|
||||
const point = context.raw as MatrixDataPoint;
|
||||
return `${point.v} book${point.v === 1 ? '' : 's'} read`;
|
||||
const key = point.v === 1 ? 'statsUser.readingHeatmap.tooltipBook' : 'statsUser.readingHeatmap.tooltipBooks';
|
||||
return this.t.translate(key, {value: point.v});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -122,7 +125,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
||||
private readonly chartDataSubject = new BehaviorSubject<HeatmapChartData>({
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Books Read',
|
||||
label: this.t.translate('statsUser.readingHeatmap.booksRead'),
|
||||
data: []
|
||||
}]
|
||||
});
|
||||
@@ -178,7 +181,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
||||
this.chartDataSubject.next({
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Books Read',
|
||||
label: this.t.translate('statsUser.readingHeatmap.booksRead'),
|
||||
data: heatmapData,
|
||||
backgroundColor: (context) => {
|
||||
const point = context.raw as MatrixDataPoint;
|
||||
|
||||
+5
-3
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingProgress'">
|
||||
<div class="reading-progress-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-bar reading-progress-icon"></i>
|
||||
Reading Progress Distribution
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Shows how many books fall into each progress bracket: not started (0%), just started (1-25%), halfway (26-50%), mostly done (51-75%), nearly finished (76-99%), and completed (100%). Progress is based on the furthest point reached across all reading sessions."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Books by reading completion status</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-wrapper">
|
||||
@@ -21,3 +22,4 @@
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+13
-5
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ReadingProgressStats {
|
||||
progressRange: string;
|
||||
@@ -45,12 +46,13 @@ type ProgressChartData = ChartData<'doughnut', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-progress-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-progress-chart.component.html',
|
||||
styleUrls: ['./reading-progress-chart.component.scss']
|
||||
})
|
||||
export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'doughnut' as const;
|
||||
@@ -118,8 +120,14 @@ export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
||||
const percentage = ((value / total) * 100).toFixed(1);
|
||||
const label = context.label;
|
||||
const rangeInfo = PROGRESS_RANGES.find(r => r.range === label);
|
||||
const description = rangeInfo ? ` (${rangeInfo.desc})` : '';
|
||||
return `${value} book${value === 1 ? '' : 's'}${description} - ${percentage}%`;
|
||||
const descKeys: Record<string, string> = {
|
||||
'Not Started': 'notStarted', 'Just Started': 'justStarted',
|
||||
'Getting Into It': 'gettingIntoIt', 'Halfway Through': 'halfwayThrough',
|
||||
'Almost Finished': 'almostFinished', 'Completed': 'completed'
|
||||
};
|
||||
const description = rangeInfo ? this.t.translate(`statsUser.readingProgress.${descKeys[rangeInfo.desc] || 'notStarted'}`) : '';
|
||||
const plural = value === 1 ? '' : 's';
|
||||
return this.t.translate('statsUser.readingProgress.tooltipLabel', {value, plural, description, percentage});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -134,7 +142,7 @@ export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
||||
private readonly chartDataSubject = new BehaviorSubject<ProgressChartData>({
|
||||
labels: [],
|
||||
datasets: [{
|
||||
label: 'Books by Progress',
|
||||
label: this.t.translate('statsUser.readingProgress.booksByProgress'),
|
||||
data: [],
|
||||
backgroundColor: [...CHART_COLORS],
|
||||
...CHART_DEFAULTS
|
||||
@@ -173,7 +181,7 @@ export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
||||
this.chartDataSubject.next({
|
||||
labels,
|
||||
datasets: [{
|
||||
label: 'Books by Progress',
|
||||
label: this.t.translate('statsUser.readingProgress.booksByProgress'),
|
||||
data: dataValues,
|
||||
backgroundColor: [...CHART_COLORS],
|
||||
borderColor: '#ffffff',
|
||||
|
||||
+11
-9
@@ -1,29 +1,30 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.sessionHeatmap'">
|
||||
<div class="reading-session-heatmap-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-calendar heatmap-title-icon"></i>
|
||||
Reading Session Activity
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="A daily heatmap of your reading sessions for the selected year. Darker cells mean more sessions that day. Streak stats track consecutive reading days across all time. Milestones unlock as you hit streak or total-day thresholds."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Daily overview of your reading sessions across the year</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="year-selector">
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(-1)"
|
||||
title="Previous year">
|
||||
[title]="t('previousYear')">
|
||||
<i class="pi pi-chevron-left"></i>
|
||||
</button>
|
||||
<span class="current-year">{{ currentYear }}</span>
|
||||
<button type="button"
|
||||
class="year-nav-btn"
|
||||
(click)="changeYear(1)"
|
||||
title="Next year">
|
||||
[title]="t('nextYear')">
|
||||
<i class="pi pi-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -42,16 +43,16 @@
|
||||
<div class="chart-footer">
|
||||
<div class="footer-pills left">
|
||||
<span class="pill current">
|
||||
<span class="pill-value">{{ currentStreak }}</span> Current Streak
|
||||
<span class="pill-value">{{ currentStreak }}</span> {{ t('currentStreak') }}
|
||||
</span>
|
||||
<span class="pill longest">
|
||||
<span class="pill-value">{{ longestStreak }}</span> Longest Streak
|
||||
<span class="pill-value">{{ longestStreak }}</span> {{ t('longestStreak') }}
|
||||
</span>
|
||||
<span class="pill total">
|
||||
<span class="pill-value">{{ totalReadingDays }}</span> Total Days
|
||||
<span class="pill-value">{{ totalReadingDays }}</span> {{ t('totalDays') }}
|
||||
</span>
|
||||
<span class="pill consistency">
|
||||
<span class="pill-value">{{ consistencyPercent }}%</span> Consistency
|
||||
<span class="pill-value">{{ consistencyPercent }}%</span> {{ t('consistency') }}
|
||||
</span>
|
||||
</div>
|
||||
@if (milestones.length > 0) {
|
||||
@@ -66,3 +67,4 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+11
-7
@@ -7,6 +7,7 @@ import {MatrixController, MatrixElement} from 'chartjs-chart-matrix';
|
||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||
import {catchError, takeUntil} from 'rxjs/operators';
|
||||
import {ReadingSessionHeatmapResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
const DAY_NAMES = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
@@ -31,7 +32,7 @@ type SessionHeatmapChartData = ChartData<'matrix', MatrixDataPoint[], string>;
|
||||
@Component({
|
||||
selector: 'app-reading-session-heatmap',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-session-heatmap.component.html',
|
||||
styleUrls: ['./reading-session-heatmap.component.scss']
|
||||
})
|
||||
@@ -51,6 +52,7 @@ export class ReadingSessionHeatmapComponent implements OnInit, OnDestroy {
|
||||
public hasStreakData = false;
|
||||
|
||||
private readonly userStatsService = inject(UserStatsService);
|
||||
private readonly translocoService = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
private readonly chartDataSubject: BehaviorSubject<SessionHeatmapChartData>;
|
||||
private maxSessionCount = 1;
|
||||
@@ -95,7 +97,9 @@ export class ReadingSessionHeatmapComponent implements OnInit, OnDestroy {
|
||||
},
|
||||
label: (context) => {
|
||||
const point = context.raw as MatrixDataPoint;
|
||||
return `${point.v} reading session${point.v === 1 ? '' : 's'}`;
|
||||
return point.v === 1
|
||||
? this.translocoService.translate('statsUser.sessionHeatmap.readingSession', {count: point.v})
|
||||
: this.translocoService.translate('statsUser.sessionHeatmap.readingSessions_plural', {count: point.v});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -312,11 +316,11 @@ export class ReadingSessionHeatmapComponent implements OnInit, OnDestroy {
|
||||
|
||||
// Milestones
|
||||
this.milestones = [
|
||||
{label: '7-Day Streak', icon: '\uD83D\uDD25', requirement: 7, type: 'streak', unlocked: this.longestStreak >= 7},
|
||||
{label: '30-Day Streak', icon: '\u26A1', requirement: 30, type: 'streak', unlocked: this.longestStreak >= 30},
|
||||
{label: '100 Reading Days', icon: '\uD83D\uDCDA', requirement: 100, type: 'total', unlocked: this.totalReadingDays >= 100},
|
||||
{label: '365 Reading Days', icon: '\uD83C\uDFC6', requirement: 365, type: 'total', unlocked: this.totalReadingDays >= 365},
|
||||
{label: 'Year of Reading', icon: '\uD83D\uDC51', requirement: 365, type: 'streak', unlocked: this.longestStreak >= 365},
|
||||
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestone7DayStreak'), icon: '\uD83D\uDD25', requirement: 7, type: 'streak', unlocked: this.longestStreak >= 7},
|
||||
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestone30DayStreak'), icon: '\u26A1', requirement: 30, type: 'streak', unlocked: this.longestStreak >= 30},
|
||||
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestone100ReadingDays'), icon: '\uD83D\uDCDA', requirement: 100, type: 'total', unlocked: this.totalReadingDays >= 100},
|
||||
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestone365ReadingDays'), icon: '\uD83C\uDFC6', requirement: 365, type: 'total', unlocked: this.totalReadingDays >= 365},
|
||||
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestoneYearOfReading'), icon: '\uD83D\uDC51', requirement: 365, type: 'streak', unlocked: this.longestStreak >= 365},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+10
-8
@@ -1,32 +1,33 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.sessionTimeline'">
|
||||
<div class="timeline-container">
|
||||
<div class="timeline-header">
|
||||
<div class="header-title">
|
||||
<h3>
|
||||
<i class="pi pi-clock timeline-title-icon"></i>
|
||||
Reading Session Timeline
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Shows your reading sessions laid out across each day of the week. Each block represents a session, sized by duration. Hover to see book title, pages read, and time spent. Use the week navigator to browse your reading history week by week."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="timeline-subtitle">Weekly overview of your reading sessions and patterns</p>
|
||||
<p class="timeline-subtitle">{{ t('description') }}</p>
|
||||
</div>
|
||||
<div class="week-info">
|
||||
<button type="button"
|
||||
class="week-nav-btn"
|
||||
(click)="changeWeek(-1)"
|
||||
title="Previous week">
|
||||
[title]="t('previousWeek')">
|
||||
<i class="pi pi-chevron-left"></i>
|
||||
</button>
|
||||
<div class="week-display">
|
||||
<span class="week-label">Week {{ currentWeek }}</span>
|
||||
<span class="week-label">{{ t('week', { number: currentWeek }) }}</span>
|
||||
<span class="week-dates">{{ getWeekDateRange() }}</span>
|
||||
</div>
|
||||
<button type="button"
|
||||
class="week-nav-btn"
|
||||
(click)="changeWeek(1)"
|
||||
title="Next week">
|
||||
[title]="t('nextWeek')">
|
||||
<i class="pi pi-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -37,7 +38,7 @@
|
||||
(onChange)="onYearChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Year"
|
||||
[placeholder]="t('selectYear')"
|
||||
[style]="{'min-width': '120px'}">
|
||||
</p-select>
|
||||
<p-select
|
||||
@@ -46,7 +47,7 @@
|
||||
(onChange)="onWeekChange()"
|
||||
optionLabel="label"
|
||||
optionValue="value"
|
||||
placeholder="Select Week"
|
||||
[placeholder]="t('selectWeek')"
|
||||
[style]="{'min-width': '120px'}">
|
||||
</p-select>
|
||||
</div>
|
||||
@@ -107,3 +108,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+9
-7
@@ -18,6 +18,7 @@ import {
|
||||
import {BookType} from '../../../../../book/model/book.model';
|
||||
import {ReadingSessionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||
import {UrlHelperService} from '../../../../../../shared/service/url-helper.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface ReadingSession {
|
||||
startTime: Date;
|
||||
@@ -52,7 +53,7 @@ interface DayTimeline {
|
||||
@Component({
|
||||
selector: 'app-reading-session-timeline',
|
||||
standalone: true,
|
||||
imports: [CommonModule, Select, FormsModule, Tooltip],
|
||||
imports: [CommonModule, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-session-timeline.component.html',
|
||||
styleUrls: ['./reading-session-timeline.component.scss']
|
||||
})
|
||||
@@ -62,6 +63,7 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
||||
|
||||
private userStatsService = inject(UserStatsService);
|
||||
private urlHelperService = inject(UrlHelperService);
|
||||
private translocoService = inject(TranslocoService);
|
||||
|
||||
public daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||
public hourLabels: string[] = [];
|
||||
@@ -96,7 +98,7 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
||||
const weeksInYear = getISOWeeksInYear(this.currentDate);
|
||||
this.weekOptions = [];
|
||||
for (let week = 1; week <= weeksInYear; week++) {
|
||||
this.weekOptions.push({label: `Week ${week}`, value: week});
|
||||
this.weekOptions.push({label: this.translocoService.translate('statsUser.sessionTimeline.week', {number: week}), value: week});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -382,26 +384,26 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
||||
<div class="session-tooltip-details">
|
||||
<div class="session-tooltip-header">
|
||||
<i class="pi pi-book"></i>
|
||||
<span class="session-tooltip-title">${session.bookTitle || 'Reading Session'}</span>
|
||||
<span class="session-tooltip-title">${session.bookTitle || this.translocoService.translate('statsUser.sessionTimeline.readingSession')}</span>
|
||||
</div>
|
||||
<div class="session-tooltip-divider"></div>
|
||||
<div class="session-tooltip-body">
|
||||
<div class="session-tooltip-row">
|
||||
<i class="pi pi-clock"></i>
|
||||
<span class="session-tooltip-label">Time:</span>
|
||||
<span class="session-tooltip-label">${this.translocoService.translate('statsUser.sessionTimeline.tooltipTime')}</span>
|
||||
<span class="session-tooltip-value">
|
||||
${this.formatTime(session.startHour, session.startMinute)} - ${this.formatTime(session.endHour, session.endMinute)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="session-tooltip-row">
|
||||
<i class="pi pi-hourglass"></i>
|
||||
<span class="session-tooltip-label">Duration:</span>
|
||||
<span class="session-tooltip-label">${this.translocoService.translate('statsUser.sessionTimeline.tooltipDuration')}</span>
|
||||
<span class="session-tooltip-value">${this.formatDuration(session.duration)}</span>
|
||||
</div>
|
||||
<div class="session-tooltip-row">
|
||||
<i class="pi pi-file"></i>
|
||||
<span class="session-tooltip-label">Format:</span>
|
||||
<span class="session-tooltip-value">${session.bookType || 'Unknown'}</span>
|
||||
<span class="session-tooltip-label">${this.translocoService.translate('statsUser.sessionTimeline.tooltipFormat')}</span>
|
||||
<span class="session-tooltip-value">${session.bookType || this.translocoService.translate('statsUser.sessionTimeline.unknown')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+11
-9
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.readingSurvival'">
|
||||
<div class="reading-survival-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-chart-line reading-survival-icon"></i>
|
||||
Reading Survival Curve
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Inspired by survival analysis: starting from all books you've begun reading, this curve shows what fraction made it to each progress milestone. A steep drop at a threshold reveals where you tend to abandon books. The 'danger zone' highlights the steepest single drop-off point."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Of books started, what percentage reached each progress threshold</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -18,20 +19,20 @@
|
||||
<div class="stats-row">
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ totalStarted }}</span>
|
||||
<span class="stat-label">Started</span>
|
||||
<span class="stat-label">{{ t('started') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ completionRate }}%</span>
|
||||
<span class="stat-label">Completion Rate</span>
|
||||
<span class="stat-label">{{ t('completionRate') }}</span>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<span class="stat-value">{{ medianDropout }}</span>
|
||||
<span class="stat-label">Median Dropout</span>
|
||||
<span class="stat-label">{{ t('medianDropout') }}</span>
|
||||
</div>
|
||||
<div class="stat-card danger">
|
||||
<span class="stat-value">{{ dangerZoneRange }}</span>
|
||||
<span class="stat-subtitle">{{ dangerZoneDrop }}</span>
|
||||
<span class="stat-label">Danger Zone</span>
|
||||
<span class="stat-label">{{ t('dangerZone') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -47,8 +48,9 @@
|
||||
@if (totalStarted === 0) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No books with reading progress found.</p>
|
||||
<small>Start reading some books to see your survival curve.</small>
|
||||
<p>{{ t('noData') }}</p>
|
||||
<small>{{ t('noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+8
-6
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
||||
import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book} from '../../../../../book/model/book.model';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type SurvivalChartData = ChartData<'line', number[], string>;
|
||||
|
||||
@@ -16,12 +17,13 @@ const THRESHOLDS = [0, 10, 25, 50, 75, 90, 100];
|
||||
@Component({
|
||||
selector: 'app-reading-survival-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './reading-survival-chart.component.html',
|
||||
styleUrls: ['./reading-survival-chart.component.scss']
|
||||
})
|
||||
export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'line' as const;
|
||||
@@ -51,8 +53,8 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||
titleFont: {size: 13, weight: 'bold'},
|
||||
bodyFont: {size: 12},
|
||||
callbacks: {
|
||||
title: (context) => `${context[0].label} progress`,
|
||||
label: (context) => `${(context.parsed.y ?? 0).toFixed(1)}% of books reached this point`
|
||||
title: (context) => this.t.translate('statsUser.readingSurvival.tooltipProgress', {label: context[0].label}),
|
||||
label: (context) => this.t.translate('statsUser.readingSurvival.tooltipSurvival', {value: (context.parsed.y ?? 0).toFixed(1)})
|
||||
}
|
||||
},
|
||||
datalabels: {display: false}
|
||||
@@ -61,7 +63,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||
x: {
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Progress Threshold',
|
||||
text: this.t.translate('statsUser.readingSurvival.axisProgressThreshold'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
@@ -77,7 +79,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||
max: 100,
|
||||
title: {
|
||||
display: true,
|
||||
text: '% of Books Surviving',
|
||||
text: this.t.translate('statsUser.readingSurvival.axisBooksSurviving'),
|
||||
color: '#ffffff',
|
||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||
},
|
||||
@@ -164,7 +166,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||
this.chartDataSubject.next({
|
||||
labels,
|
||||
datasets: [{
|
||||
label: 'Survival Rate',
|
||||
label: this.t.translate('statsUser.readingSurvival.survivalRate'),
|
||||
data: survivalValues,
|
||||
borderColor: '#e91e63',
|
||||
backgroundColor: 'rgba(233, 30, 99, 0.15)',
|
||||
|
||||
+26
-24
@@ -1,16 +1,17 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser.seriesProgress'">
|
||||
<div class="series-progress-container">
|
||||
<div class="chart-header">
|
||||
<div class="chart-title">
|
||||
<h3>
|
||||
<i class="pi pi-list series-icon"></i>
|
||||
Series Progress Tracker
|
||||
{{ t('title') }}
|
||||
<i class="pi pi-question-circle chart-info-icon"
|
||||
pTooltip="Shows each book series in your library as a stacked bar: read, reading, and unread volumes. Series are sorted by completion percentage. Use this to spot which series you've fallen behind on or are close to finishing."
|
||||
[pTooltip]="t('tooltip')"
|
||||
tooltipPosition="bottom"
|
||||
tooltipStyleClass="chart-info-tooltip"
|
||||
[appendTo]="'body'"></i>
|
||||
</h3>
|
||||
<p class="chart-description">Track your reading progress across book series</p>
|
||||
<p class="chart-description">{{ t('description') }}</p>
|
||||
</div>
|
||||
@if (stats) {
|
||||
<div class="series-summary">
|
||||
@@ -34,16 +35,16 @@
|
||||
<div class="stats-row">
|
||||
<div class="stat-pill">
|
||||
<span class="pill-value">{{ stats.totalSeries }}</span>
|
||||
<span class="pill-label">Series</span>
|
||||
<span class="pill-label">{{ t('series') }}</span>
|
||||
</div>
|
||||
<div class="stat-pill">
|
||||
<span class="pill-value">{{ stats.avgSeriesCompletion }}%</span>
|
||||
<span class="pill-label">Avg. Completion</span>
|
||||
<span class="pill-label">{{ t('avgCompletion') }}</span>
|
||||
</div>
|
||||
@if (stats.highestRatedSeries) {
|
||||
<div class="stat-pill highlight">
|
||||
<span class="pill-value">{{ stats.highestRatedSeries.avgPersonalRating?.toFixed(1) }}</span>
|
||||
<span class="pill-label">Top Rated</span>
|
||||
<span class="pill-label">{{ t('topRated') }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -60,8 +61,8 @@
|
||||
@if (seriesList.length > 0) {
|
||||
<div class="series-details">
|
||||
<div class="details-header">
|
||||
<h4>Series Breakdown</h4>
|
||||
<span class="series-count">{{ filteredSeriesList.length }} of {{ seriesList.length }}</span>
|
||||
<h4>{{ t('seriesBreakdown') }}</h4>
|
||||
<span class="series-count">{{ t('ofTotal', { filtered: filteredSeriesList.length, total: seriesList.length }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="controls-row">
|
||||
@@ -69,7 +70,7 @@
|
||||
<i class="pi pi-search"></i>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search series..."
|
||||
[placeholder]="t('searchSeries')"
|
||||
[value]="searchTerm"
|
||||
(input)="onSearchChange($any($event.target).value)"
|
||||
/>
|
||||
@@ -77,17 +78,17 @@
|
||||
|
||||
<div class="filter-controls">
|
||||
<select class="filter-select" [value]="filterStatus" (change)="onFilterChange($any($event.target).value)">
|
||||
<option value="all">All Status</option>
|
||||
<option value="in-progress">In Progress</option>
|
||||
<option value="completed">Completed</option>
|
||||
<option value="not-started">Not Started</option>
|
||||
<option value="all">{{ t('allStatus') }}</option>
|
||||
<option value="in-progress">{{ t('inProgress') }}</option>
|
||||
<option value="completed">{{ t('completed') }}</option>
|
||||
<option value="not-started">{{ t('notStarted') }}</option>
|
||||
</select>
|
||||
|
||||
<select class="sort-select" [value]="sortBy" (change)="onSortChange($any($event.target).value)">
|
||||
<option value="progress">Sort by Progress</option>
|
||||
<option value="rating">Sort by Rating</option>
|
||||
<option value="books">Sort by Books</option>
|
||||
<option value="name">Sort by Name</option>
|
||||
<option value="progress">{{ t('sortByProgress') }}</option>
|
||||
<option value="rating">{{ t('sortByRating') }}</option>
|
||||
<option value="books">{{ t('sortByBooks') }}</option>
|
||||
<option value="name">{{ t('sortByName') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -103,9 +104,9 @@
|
||||
<span class="series-name">{{ series.name }}</span>
|
||||
<div class="series-meta">
|
||||
<span class="books-count">
|
||||
{{ series.booksRead }}/{{ series.booksOwned }} read
|
||||
{{ t('booksRead', { read: series.booksRead, owned: series.booksOwned }) }}
|
||||
@if (series.totalInSeries) {
|
||||
<span class="total-hint">({{ series.totalInSeries }} in series)</span>
|
||||
<span class="total-hint">{{ t('inSeriesHint', { total: series.totalInSeries }) }}</span>
|
||||
}
|
||||
</span>
|
||||
@if (series.avgPersonalRating) {
|
||||
@@ -131,7 +132,7 @@
|
||||
</div>
|
||||
@if (series.nextUnread && series.status !== 'completed') {
|
||||
<div class="next-up">
|
||||
<span class="next-label">Next:</span>
|
||||
<span class="next-label">{{ t('next') }}</span>
|
||||
<span class="next-title">{{ series.nextUnread }}</span>
|
||||
</div>
|
||||
}
|
||||
@@ -141,7 +142,7 @@
|
||||
@if (filteredSeriesList.length === 0 && searchTerm) {
|
||||
<div class="no-results">
|
||||
<i class="pi pi-search"></i>
|
||||
<span>No series matching "{{ searchTerm }}"</span>
|
||||
<span>{{ t('noMatchingSearch', { term: searchTerm }) }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -155,7 +156,7 @@
|
||||
<i class="pi pi-chevron-left"></i>
|
||||
</button>
|
||||
<span class="page-info">
|
||||
Page {{ currentPage + 1 }} of {{ getTotalPages() }}
|
||||
{{ t('pageInfo', { current: currentPage + 1, total: getTotalPages() }) }}
|
||||
</span>
|
||||
<button
|
||||
class="page-btn"
|
||||
@@ -171,8 +172,9 @@
|
||||
@if (!stats) {
|
||||
<div class="no-data-message">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
<p>No series found in your library.</p>
|
||||
<small>Books need series metadata to appear here.</small>
|
||||
<p>{{ t('noData') }}</p>
|
||||
<small>{{ t('noDataHint') }}</small>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+14
-12
@@ -9,6 +9,7 @@ import {BookService} from '../../../../../book/service/book.service';
|
||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||
import {LibraryFilterService} from '../../../library-stats/service/library-filter.service';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
interface SeriesInfo {
|
||||
name: string;
|
||||
@@ -43,13 +44,14 @@ type SeriesChartData = ChartData<'bar', number[], string>;
|
||||
@Component({
|
||||
selector: 'app-series-progress-chart',
|
||||
standalone: true,
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
||||
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||
templateUrl: './series-progress-chart.component.html',
|
||||
styleUrls: ['./series-progress-chart.component.scss']
|
||||
})
|
||||
export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
private readonly bookService = inject(BookService);
|
||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||
private readonly t = inject(TranslocoService);
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
public readonly chartType = 'bar' as const;
|
||||
@@ -80,7 +82,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
max: 100,
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Completion %',
|
||||
text: this.t.translate('statsUser.seriesProgress.axisCompletion'),
|
||||
color: '#ffffff',
|
||||
font: {
|
||||
family: "'Inter', sans-serif",
|
||||
@@ -149,13 +151,13 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
const series = this.chartSeries[context[0].dataIndex];
|
||||
if (!series) return [];
|
||||
const lines = [
|
||||
`Read: ${series.booksRead}/${series.booksOwned} owned`
|
||||
this.t.translate('statsUser.seriesProgress.tooltipRead', {read: series.booksRead, owned: series.booksOwned})
|
||||
];
|
||||
if (series.totalInSeries) {
|
||||
lines.push(`Series total: ${series.totalInSeries} books`);
|
||||
lines.push(this.t.translate('statsUser.seriesProgress.tooltipSeriesTotal', {total: series.totalInSeries}));
|
||||
}
|
||||
if (series.avgPersonalRating) {
|
||||
lines.push(`Your rating: ${series.avgPersonalRating.toFixed(1)}/10`);
|
||||
lines.push(this.t.translate('statsUser.seriesProgress.tooltipYourRating', {rating: series.avgPersonalRating.toFixed(1)}));
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
@@ -563,7 +565,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
labels,
|
||||
datasets: [
|
||||
{
|
||||
label: 'Read',
|
||||
label: this.t.translate('statsUser.seriesProgress.read'),
|
||||
data: readPercentages,
|
||||
backgroundColor: 'rgba(76, 175, 80, 0.85)',
|
||||
borderColor: '#4caf50',
|
||||
@@ -571,7 +573,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Reading',
|
||||
label: this.t.translate('statsUser.seriesProgress.reading'),
|
||||
data: readingPercentages,
|
||||
backgroundColor: 'rgba(255, 193, 7, 0.85)',
|
||||
borderColor: '#ffc107',
|
||||
@@ -579,7 +581,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Partially Read',
|
||||
label: this.t.translate('statsUser.seriesProgress.partiallyRead'),
|
||||
data: partiallyReadPercentages,
|
||||
backgroundColor: 'rgba(255, 152, 0, 0.85)',
|
||||
borderColor: '#ff9800',
|
||||
@@ -587,7 +589,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Paused',
|
||||
label: this.t.translate('statsUser.seriesProgress.paused'),
|
||||
data: pausedPercentages,
|
||||
backgroundColor: 'rgba(33, 150, 243, 0.85)',
|
||||
borderColor: '#2196f3',
|
||||
@@ -595,7 +597,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Abandoned',
|
||||
label: this.t.translate('statsUser.seriesProgress.abandoned'),
|
||||
data: abandonedPercentages,
|
||||
backgroundColor: 'rgba(239, 83, 80, 0.85)',
|
||||
borderColor: '#ef5350',
|
||||
@@ -603,7 +605,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Won\'t Read',
|
||||
label: this.t.translate('statsUser.seriesProgress.wontRead'),
|
||||
data: wontReadPercentages,
|
||||
backgroundColor: 'rgba(158, 158, 158, 0.6)',
|
||||
borderColor: '#9e9e9e',
|
||||
@@ -611,7 +613,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||
borderRadius: 2
|
||||
},
|
||||
{
|
||||
label: 'Unread',
|
||||
label: this.t.translate('statsUser.seriesProgress.unread'),
|
||||
data: unreadPercentages,
|
||||
backgroundColor: 'rgba(158, 158, 158, 0.3)',
|
||||
borderColor: '#9e9e9e',
|
||||
|
||||
+42
-1
@@ -1,5 +1,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, Observable} from 'rxjs';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {ReadingSessionHeatmapComponent} from '../charts/reading-session-heatmap/reading-session-heatmap.component';
|
||||
import {FavoriteDaysChartComponent} from '../charts/favorite-days-chart/favorite-days-chart.component';
|
||||
import {PeakHoursChartComponent} from '../charts/peak-hours-chart/peak-hours-chart.component';
|
||||
@@ -34,6 +35,29 @@ export interface UserChartConfig {
|
||||
})
|
||||
export class UserChartConfigService {
|
||||
private readonly STORAGE_KEY = 'userStatsChartConfig';
|
||||
private readonly t = inject(TranslocoService);
|
||||
|
||||
private readonly chartNameKeyMap: Record<string, string> = {
|
||||
'heatmap': 'statsUser.chartNames.heatmap',
|
||||
'favorite-days': 'statsUser.chartNames.favoriteDays',
|
||||
'peak-hours': 'statsUser.chartNames.peakHours',
|
||||
'timeline': 'statsUser.chartNames.timeline',
|
||||
'reading-heatmap': 'statsUser.chartNames.readingHeatmap',
|
||||
'personal-rating': 'statsUser.chartNames.personalRating',
|
||||
'reading-progress': 'statsUser.chartNames.readingProgress',
|
||||
'read-status': 'statsUser.chartNames.readStatus',
|
||||
'genre-stats': 'statsUser.chartNames.genreStats',
|
||||
'completion-timeline': 'statsUser.chartNames.completionTimeline',
|
||||
'reading-clock': 'statsUser.chartNames.readingClock',
|
||||
'page-turner': 'statsUser.chartNames.pageTurner',
|
||||
'completion-race': 'statsUser.chartNames.completionRace',
|
||||
'reading-survival': 'statsUser.chartNames.readingSurvival',
|
||||
'book-length': 'statsUser.chartNames.bookLength',
|
||||
'rating-taste': 'statsUser.chartNames.ratingTaste',
|
||||
'series-progress': 'statsUser.chartNames.seriesProgress',
|
||||
'reading-dna': 'statsUser.chartNames.readingDna',
|
||||
'reading-habits': 'statsUser.chartNames.readingHabits',
|
||||
};
|
||||
|
||||
private readonly defaultCharts: UserChartConfig[] = [
|
||||
{id: 'heatmap', title: 'Reading Session Heatmap', component: ReadingSessionHeatmapComponent, enabled: true, sizeClass: 'chart-full', order: 0},
|
||||
@@ -60,6 +84,23 @@ export class UserChartConfigService {
|
||||
private chartsSubject = new BehaviorSubject<UserChartConfig[]>(this.loadChartConfig());
|
||||
public charts$: Observable<UserChartConfig[]> = this.chartsSubject.asObservable();
|
||||
|
||||
constructor() {
|
||||
this.t.langChanges$.subscribe(() => {
|
||||
const charts = this.chartsSubject.value;
|
||||
this.translateChartTitles(charts);
|
||||
this.chartsSubject.next([...charts]);
|
||||
});
|
||||
}
|
||||
|
||||
private translateChartTitles(charts: UserChartConfig[]): void {
|
||||
charts.forEach(chart => {
|
||||
const key = this.chartNameKeyMap[chart.id];
|
||||
if (key) {
|
||||
chart.title = this.t.translate(key);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getVisibleCharts(): UserChartConfig[] {
|
||||
return this.chartsSubject.value.filter(chart => chart.enabled);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<ng-container *transloco="let t; prefix: 'statsUser'">
|
||||
<div class="user-stats-container">
|
||||
<div class="header-section">
|
||||
<div class="header-content">
|
||||
<div class="greeting">
|
||||
<i class="pi pi-chart-line"></i>
|
||||
<h2>{{ userName }}'s Reading Statistics</h2>
|
||||
<h2>{{ t('main.title', { name: userName }) }}</h2>
|
||||
</div>
|
||||
<button class="config-toggle-btn" (click)="toggleConfigPanel()">
|
||||
<i class="pi pi-cog"></i>
|
||||
<span>Customize Layout</span>
|
||||
<span>{{ t('main.customizeLayout') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -19,7 +20,7 @@
|
||||
[resizable]="false"
|
||||
[style]="{width: '600px', maxWidth: '90vw'}"
|
||||
class="config-dialog"
|
||||
header="Chart Configuration">
|
||||
[header]="t('main.chartConfig')">
|
||||
|
||||
<div class="config-dialog-content">
|
||||
<div class="config-list" cdkDropList (cdkDropListDropped)="drop($event)">
|
||||
@@ -43,18 +44,18 @@
|
||||
<ng-template pTemplate="footer">
|
||||
<p-button class="reset-btn" (click)="resetLayout()" severity="danger">
|
||||
<i class="pi pi-refresh"></i>
|
||||
<span>Reset Layout</span>
|
||||
<span>{{ t('main.resetLayout') }}</span>
|
||||
</p-button>
|
||||
<p-button class="hide-all-btn" (click)="hideAllCharts()" severity="secondary">
|
||||
<i class="pi pi-eye-slash"></i>
|
||||
<span>Hide All</span>
|
||||
<span>{{ t('main.hideAll') }}</span>
|
||||
</p-button>
|
||||
<p-button class="show-all-btn" (click)="showAllCharts()" severity="secondary">
|
||||
<i class="pi pi-eye"></i>
|
||||
<span>Show All</span>
|
||||
<span>{{ t('main.showAll') }}</span>
|
||||
</p-button>
|
||||
<p-button class="close-btn" (click)="toggleConfigPanel()" severity="secondary">
|
||||
<span>Close</span>
|
||||
<span>{{ t('main.close') }}</span>
|
||||
</p-button>
|
||||
</ng-template>
|
||||
</p-dialog>
|
||||
@@ -130,3 +131,4 @@
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {DialogModule} from 'primeng/dialog';
|
||||
import {ButtonModule} from 'primeng/button';
|
||||
import {UserService} from '../../../settings/user-management/user.service';
|
||||
import {takeUntil} from 'rxjs/operators';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
import {PeakHoursChartComponent} from './charts/peak-hours-chart/peak-hours-chart.component';
|
||||
import {FavoriteDaysChartComponent} from './charts/favorite-days-chart/favorite-days-chart.component';
|
||||
import {ReadingDNAChartComponent} from './charts/reading-dna-chart/reading-dna-chart.component';
|
||||
@@ -53,7 +54,8 @@ import {UserChartConfig, UserChartConfigService} from './service/user-chart-conf
|
||||
CompletionRaceChartComponent,
|
||||
ReadingSurvivalChartComponent,
|
||||
ReadingClockChartComponent,
|
||||
BookLengthChartComponent
|
||||
BookLengthChartComponent,
|
||||
TranslocoDirective
|
||||
],
|
||||
templateUrl: './user-stats.component.html',
|
||||
styleUrls: ['./user-stats.component.scss']
|
||||
|
||||
+11
-11
@@ -1,3 +1,4 @@
|
||||
<ng-container *transloco="let t; prefix: 'shared.metadataProgress'">
|
||||
<div class="task-border">
|
||||
@if (Object.keys(activeTasks).length > 0) {
|
||||
@for (task of activeTasks | keyvalue; track task; let idx = $index) {
|
||||
@@ -5,18 +6,18 @@
|
||||
|
||||
<div class="task-header-row">
|
||||
<div class="task-title-group">
|
||||
<p class="task-title">Metadata Fetch Task</p>
|
||||
<p class="task-title">{{ t('taskTitle') }}</p>
|
||||
</div>
|
||||
<div class="task-tags">
|
||||
@if (task.value.review) {
|
||||
<p-tag
|
||||
value="Review"
|
||||
[value]="t('tagReview')"
|
||||
severity="warn"
|
||||
class="task-tag">
|
||||
</p-tag>
|
||||
} @else {
|
||||
<p-tag
|
||||
value="Auto"
|
||||
[value]="t('tagAuto')"
|
||||
severity="success"
|
||||
class="task-tag">
|
||||
</p-tag>
|
||||
@@ -33,9 +34,7 @@
|
||||
{{ task.value.message }}
|
||||
</div>
|
||||
|
||||
<div class="task-progress-info">
|
||||
Book <strong>{{ task.value.status === 'COMPLETED' || task.value.completed >= task.value.total ? task.value.total : task.value.completed + 1 }}</strong>
|
||||
of {{ task.value.total }}
|
||||
<div class="task-progress-info" [innerHTML]="t('bookProgress', { current: task.value.status === 'COMPLETED' || task.value.completed >= task.value.total ? task.value.total : task.value.completed + 1, total: task.value.total })">
|
||||
</div>
|
||||
|
||||
<p-progressBar
|
||||
@@ -48,7 +47,7 @@
|
||||
<div class="action-buttons">
|
||||
@if (task.value.review) {
|
||||
<p-button
|
||||
label="Review"
|
||||
[label]="t('reviewBtn')"
|
||||
severity="info"
|
||||
icon="pi pi-search"
|
||||
size="small"
|
||||
@@ -58,11 +57,11 @@
|
||||
}
|
||||
|
||||
<p-button
|
||||
[label]="task.value.review ? 'Discard' : 'Dismiss'"
|
||||
[label]="task.value.review ? t('discardBtn') : t('dismissBtn')"
|
||||
icon="pi pi-times"
|
||||
[severity]="task.value.review ? 'danger' : 'secondary'"
|
||||
size="small"
|
||||
[pTooltip]="task.value.review ? 'Preserve current metadata, discard new fetched metadata' : ''"
|
||||
[pTooltip]="task.value.review ? t('discardTooltip') : ''"
|
||||
[tooltipPosition]="task.value.review ? 'top' : undefined"
|
||||
outlined
|
||||
(click)="clearTask(task.key)">
|
||||
@@ -71,11 +70,11 @@
|
||||
} @else if (task.value.status === 'IN_PROGRESS') {
|
||||
<div class="action-buttons">
|
||||
<p-button
|
||||
label="Cancel"
|
||||
[label]="t('cancelBtn')"
|
||||
icon="pi pi-stop"
|
||||
severity="danger"
|
||||
size="small"
|
||||
pTooltip="Cancel this task"
|
||||
[pTooltip]="t('cancelTooltip')"
|
||||
tooltipPosition="top"
|
||||
outlined
|
||||
(click)="cancelTask(task.key)">
|
||||
@@ -91,3 +90,4 @@
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</ng-container>
|
||||
|
||||
+12
-4
@@ -7,9 +7,9 @@ import {ButtonModule} from 'primeng/button';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
import {MetadataBatchProgressNotification, MetadataBatchStatus, MetadataBatchStatusLabels} from '../../model/metadata-batch-progress.model';
|
||||
import {MetadataBatchProgressNotification, MetadataBatchStatus} from '../../model/metadata-batch-progress.model';
|
||||
import {MetadataProgressService} from '../../service/metadata-progress.service';
|
||||
import {MetadataTaskService} from '../../../features/book/service/metadata-task';
|
||||
import {Tag} from 'primeng/tag';
|
||||
@@ -21,7 +21,7 @@ import {DialogLauncherService} from '../../services/dialog-launcher.service';
|
||||
templateUrl: './metadata-progress-widget-component.html',
|
||||
styleUrls: ['./metadata-progress-widget-component.scss'],
|
||||
standalone: true,
|
||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag]
|
||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag, TranslocoDirective]
|
||||
})
|
||||
export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
activeTasks: Record<string, MetadataBatchProgressNotification> = {};
|
||||
@@ -160,8 +160,16 @@ export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
private readonly statusLabelKeys: Record<MetadataBatchStatus, string> = {
|
||||
[MetadataBatchStatus.IN_PROGRESS]: 'shared.metadataProgress.statusInProgress',
|
||||
[MetadataBatchStatus.COMPLETED]: 'shared.metadataProgress.statusCompleted',
|
||||
[MetadataBatchStatus.ERROR]: 'shared.metadataProgress.statusError',
|
||||
[MetadataBatchStatus.CANCELLED]: 'shared.metadataProgress.statusCancelled',
|
||||
};
|
||||
|
||||
getStatusLabel(status: MetadataBatchStatus): string {
|
||||
return MetadataBatchStatusLabels[status] ?? status;
|
||||
const key = this.statusLabelKeys[status];
|
||||
return key ? this.t.translate(key) : status;
|
||||
}
|
||||
|
||||
protected readonly Object = Object;
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
[ngStyle]="{ color: iconColor }"
|
||||
style="font-size: 1.25rem"
|
||||
[class.pulsating]="iconPulsating"
|
||||
aria-label="Unified Notification Icon"
|
||||
[attr.aria-label]="t('notificationAriaLabel')"
|
||||
></i>
|
||||
</button>
|
||||
|
||||
|
||||
@@ -451,7 +451,97 @@
|
||||
"filter": {
|
||||
"title": "Filters",
|
||||
"showingFirst100": "Showing first 100 items",
|
||||
"footerNote": "Note: Top 100 items are displayed per filter category"
|
||||
"footerNote": "Note: Top 100 items are displayed per filter category",
|
||||
"labels": {
|
||||
"author": "Author",
|
||||
"category": "Genre",
|
||||
"series": "Series",
|
||||
"bookType": "Book Type",
|
||||
"readStatus": "Read Status",
|
||||
"personalRating": "Personal Rating",
|
||||
"publisher": "Publisher",
|
||||
"matchScore": "Metadata Match Score",
|
||||
"library": "Library",
|
||||
"shelf": "Shelf",
|
||||
"shelfStatus": "Shelf Status",
|
||||
"tag": "Tag",
|
||||
"publishedDate": "Published Year",
|
||||
"fileSize": "File Size",
|
||||
"amazonRating": "Amazon Rating",
|
||||
"goodreadsRating": "Goodreads Rating",
|
||||
"hardcoverRating": "Hardcover Rating",
|
||||
"language": "Language",
|
||||
"pageCount": "Page Count",
|
||||
"mood": "Mood",
|
||||
"ageRating": "Age Rating",
|
||||
"contentRating": "Content Rating",
|
||||
"narrator": "Narrator",
|
||||
"comicCharacter": "Comic Character",
|
||||
"comicTeam": "Comic Team",
|
||||
"comicLocation": "Comic Location",
|
||||
"comicCreator": "Comic Creator"
|
||||
},
|
||||
"readStatus": {
|
||||
"unread": "Unread",
|
||||
"reading": "Reading",
|
||||
"reReading": "Re-reading",
|
||||
"partiallyRead": "Partially Read",
|
||||
"paused": "Paused",
|
||||
"read": "Read",
|
||||
"wontRead": "Won't Read",
|
||||
"abandoned": "Abandoned",
|
||||
"unset": "Unset"
|
||||
},
|
||||
"matchScore": {
|
||||
"outstanding": "Outstanding (95–100%)",
|
||||
"excellent": "Excellent (90–94%)",
|
||||
"great": "Great (80–89%)",
|
||||
"good": "Good (70–79%)",
|
||||
"fair": "Fair (50–69%)",
|
||||
"weak": "Weak (30–49%)",
|
||||
"poor": "Poor (0–29%)"
|
||||
},
|
||||
"fileSize": {
|
||||
"lt1mb": "< 1 MB",
|
||||
"1to10mb": "1–10 MB",
|
||||
"10to50mb": "10–50 MB",
|
||||
"50to100mb": "50–100 MB",
|
||||
"250to500mb": "250–500 MB",
|
||||
"05to1gb": "0.5–1 GB",
|
||||
"1to2gb": "1–2 GB",
|
||||
"5plusGb": "5+ GB"
|
||||
},
|
||||
"pageCount": {
|
||||
"lt50": "< 50 pages",
|
||||
"50to100": "50–100 pages",
|
||||
"100to200": "100–200 pages",
|
||||
"200to400": "200–400 pages",
|
||||
"400to600": "400–600 pages",
|
||||
"600to1000": "600–1000 pages",
|
||||
"1000plus": "1000+ pages"
|
||||
},
|
||||
"ageRating": {
|
||||
"allAges": "All Ages"
|
||||
},
|
||||
"contentRating": {
|
||||
"everyone": "Everyone",
|
||||
"teen": "Teen",
|
||||
"mature": "Mature",
|
||||
"adult": "Adult",
|
||||
"explicit": "Explicit"
|
||||
},
|
||||
"shelfStatus": {
|
||||
"shelved": "Shelved",
|
||||
"unshelved": "Unshelved"
|
||||
},
|
||||
"comicRoles": {
|
||||
"penciller": "Penciller",
|
||||
"inker": "Inker",
|
||||
"colorist": "Colorist",
|
||||
"letterer": "Letterer",
|
||||
"coverArtist": "Cover Artist",
|
||||
"editor": "Editor"
|
||||
}
|
||||
},
|
||||
"shelfAssigner": {
|
||||
"title": "Assign Books to Shelves",
|
||||
@@ -552,7 +642,37 @@
|
||||
"addSortFieldPlaceholder": "Add sort field...",
|
||||
"saveAsDefault": "Save as Default",
|
||||
"ascendingTooltip": "Ascending - click to change",
|
||||
"descendingTooltip": "Descending - click to change"
|
||||
"descendingTooltip": "Descending - click to change",
|
||||
"options": {
|
||||
"title": "Title",
|
||||
"fileName": "File Name",
|
||||
"filePath": "File Path",
|
||||
"author": "Author",
|
||||
"authorSurnameVorname": "Author (Surname)",
|
||||
"seriesName": "Series Name",
|
||||
"seriesNumber": "Series Number",
|
||||
"lastReadTime": "Last Read",
|
||||
"personalRating": "Personal Rating",
|
||||
"addedOn": "Added On",
|
||||
"fileSizeKb": "File Size",
|
||||
"locked": "Locked",
|
||||
"publisher": "Publisher",
|
||||
"publishedDate": "Published Date",
|
||||
"readStatus": "Read Status",
|
||||
"dateFinished": "Date Finished",
|
||||
"readingProgress": "Reading Progress",
|
||||
"bookType": "Book Type",
|
||||
"amazonRating": "Amazon Rating",
|
||||
"amazonReviewCount": "Amazon #",
|
||||
"goodreadsRating": "Goodreads Rating",
|
||||
"goodreadsReviewCount": "Goodreads #",
|
||||
"hardcoverRating": "Hardcover Rating",
|
||||
"hardcoverReviewCount": "Hardcover #",
|
||||
"ranobedbRating": "Ranobedb Rating",
|
||||
"narrator": "Narrator",
|
||||
"pageCount": "Pages",
|
||||
"random": "Random"
|
||||
}
|
||||
},
|
||||
"fileAttacher": {
|
||||
"title": "Attach File to Another Book",
|
||||
|
||||
@@ -16,5 +16,10 @@
|
||||
"next": "Next",
|
||||
"submit": "Submit",
|
||||
"remove": "Remove",
|
||||
"edit": "Edit"
|
||||
"edit": "Edit",
|
||||
"info": "Info",
|
||||
"select": "Select",
|
||||
"dismiss": "Dismiss",
|
||||
"discard": "Discard",
|
||||
"review": "Review"
|
||||
}
|
||||
|
||||
@@ -28,8 +28,12 @@ import book from './book.json';
|
||||
import readerAudiobook from './reader-audiobook.json';
|
||||
import readerCbx from './reader-cbx.json';
|
||||
import readerEbook from './reader-ebook.json';
|
||||
import readerPdf from './reader-pdf.json';
|
||||
import statsLibrary from './stats-library.json';
|
||||
import statsUser from './stats-user.json';
|
||||
import magicShelf from './magic-shelf.json';
|
||||
|
||||
// To add a new domain: create the JSON file and add it here.
|
||||
// Settings tabs each get their own file: settings-email, settings-reader, settings-view, etc.
|
||||
const translations: Translation = {common, auth, nav, dashboard, settings, settingsEmail, settingsReader, settingsView, settingsMeta, settingsLibMeta, settingsApp, settingsUsers, settingsNaming, settingsOpds, settingsTasks, settingsAuth, settingsDevice, settingsProfile, app, shared, layout, libraryCreator, bookdrop, metadata, notebook, book, readerAudiobook, readerCbx, readerEbook};
|
||||
const translations: Translation = {common, auth, nav, dashboard, settings, settingsEmail, settingsReader, settingsView, settingsMeta, settingsLibMeta, settingsApp, settingsUsers, settingsNaming, settingsOpds, settingsTasks, settingsAuth, settingsDevice, settingsProfile, app, shared, layout, libraryCreator, bookdrop, metadata, notebook, book, readerAudiobook, readerCbx, readerEbook, readerPdf, statsLibrary, statsUser, magicShelf};
|
||||
export default translations;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"logout": "Logout",
|
||||
"language": "Language",
|
||||
"supportBookLore": "Support BookLore",
|
||||
"notificationAriaLabel": "Unified Notification Icon",
|
||||
"createLibrary": "Create Library",
|
||||
"stats": "Stats",
|
||||
"libraryStats": "Library Stats",
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"header": {
|
||||
"titleEdit": "Edit Magic Shelf",
|
||||
"titleCreate": "Magic Shelf Builder",
|
||||
"description": "Create smart shelves with custom rules to automatically organize your books"
|
||||
},
|
||||
"form": {
|
||||
"shelfName": "Magic Shelf Name",
|
||||
"namePlaceholder": "E.g. Rom-Zom-Coms, Fast & Furious, Missing Metadata",
|
||||
"shelfIcon": "Shelf Icon",
|
||||
"clickToChange": "Click to change",
|
||||
"removeIcon": "Remove icon",
|
||||
"selectIcon": "Select Icon",
|
||||
"public": "Public"
|
||||
},
|
||||
"actions": {
|
||||
"cancel": "Cancel",
|
||||
"saveFilter": "Save Filter",
|
||||
"addRule": "Add Rule",
|
||||
"addGroup": "Add Group"
|
||||
},
|
||||
"group": {
|
||||
"condition": "Condition:"
|
||||
},
|
||||
"placeholders": {
|
||||
"field": "Field",
|
||||
"operator": "Operator",
|
||||
"startYear": "Start Year",
|
||||
"endYear": "End Year",
|
||||
"startDate": "Start Date",
|
||||
"endDate": "End Date",
|
||||
"startValue": "Start Value",
|
||||
"endValue": "End Value",
|
||||
"value": "Value",
|
||||
"selectStatuses": "Select Statuses",
|
||||
"selectFileTypes": "Select File Types",
|
||||
"selectLibraries": "Select Libraries",
|
||||
"selectShelves": "Select Shelves",
|
||||
"selectGenres": "Select Genres",
|
||||
"enterValues": "Enter values (press Enter)",
|
||||
"selectStatus": "Select Status",
|
||||
"selectFileType": "Select File Type",
|
||||
"selectLibrary": "Select Library",
|
||||
"selectShelf": "Select Shelf",
|
||||
"selectGenre": "Select Genre"
|
||||
},
|
||||
"conditions": {
|
||||
"and": "AND",
|
||||
"or": "OR"
|
||||
},
|
||||
"fields": {
|
||||
"library": "Library",
|
||||
"shelf": "Shelf",
|
||||
"readStatus": "Read Status",
|
||||
"dateFinished": "Date Finished",
|
||||
"lastReadTime": "Last Read Time",
|
||||
"metadataScore": "Metadata Score",
|
||||
"title": "Title",
|
||||
"authors": "Authors",
|
||||
"categories": "Categories",
|
||||
"moods": "Moods",
|
||||
"tags": "Tags",
|
||||
"publisher": "Publisher",
|
||||
"publishedDate": "Published Date",
|
||||
"personalRating": "Personal Rating",
|
||||
"pageCount": "Page Count",
|
||||
"language": "Language",
|
||||
"isbn13": "ISBN-13",
|
||||
"isbn10": "ISBN-10",
|
||||
"seriesName": "Series Name",
|
||||
"seriesNumber": "Series Number",
|
||||
"seriesTotal": "Books in Series",
|
||||
"fileSize": "File Size (Kb)",
|
||||
"fileType": "File Type",
|
||||
"subtitle": "Subtitle",
|
||||
"amazonRating": "Amazon Rating",
|
||||
"amazonReviewCount": "Amazon Review Count",
|
||||
"goodreadsRating": "Goodreads Rating",
|
||||
"goodreadsReviewCount": "Goodreads Review Count",
|
||||
"hardcoverRating": "Hardcover Rating",
|
||||
"hardcoverReviewCount": "Hardcover Review Count",
|
||||
"ranobedbRating": "Ranobedb Rating",
|
||||
"genre": "Genre"
|
||||
},
|
||||
"operators": {
|
||||
"equals": "Equals",
|
||||
"notEqual": "\u2260 Not Equal",
|
||||
"empty": "Empty",
|
||||
"notEmpty": "Not Empty",
|
||||
"includesAny": "Includes Any",
|
||||
"excludesAll": "Excludes All",
|
||||
"includesAll": "Includes All",
|
||||
"contains": "Contains",
|
||||
"doesNotContain": "Doesn't Contain",
|
||||
"startsWith": "Starts With",
|
||||
"endsWith": "Ends With",
|
||||
"greaterThan": "> Greater Than",
|
||||
"greaterOrEqual": "\u2265 Greater or Equal",
|
||||
"lessThan": "< Less Than",
|
||||
"lessOrEqual": "\u2264 Less or Equal",
|
||||
"between": "Between"
|
||||
},
|
||||
"readStatuses": {
|
||||
"unread": "Unread",
|
||||
"reading": "Reading",
|
||||
"reReading": "Re Reading",
|
||||
"read": "Read",
|
||||
"partiallyRead": "Partially Read",
|
||||
"paused": "Paused",
|
||||
"wontRead": "Wont Read",
|
||||
"abandoned": "Abandoned",
|
||||
"unset": "Unset"
|
||||
},
|
||||
"toast": {
|
||||
"validationErrorSummary": "Validation Error",
|
||||
"validationErrorDetail": "You must add at least one valid rule before saving.",
|
||||
"successSummary": "Success",
|
||||
"successDetail": "Magic shelf saved successfully.",
|
||||
"errorSummary": "Error",
|
||||
"errorDetailDefault": "Failed to save magic shelf."
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@
|
||||
"contentRatingAdult": "Adult",
|
||||
"contentRatingExplicit": "Explicit",
|
||||
"ageRatingAllAges": "All Ages",
|
||||
"selectPlaceholder": "Select",
|
||||
"toast": {
|
||||
"successSummary": "Success",
|
||||
"metadataUpdated": "Book metadata updated",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"switchToLightMode": "Switch to Light Mode",
|
||||
"switchToDarkMode": "Switch to Dark Mode",
|
||||
"closePdfReader": "Close PDF Reader"
|
||||
},
|
||||
"toast": {
|
||||
"failedToLoadBook": "Failed to load the book"
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,21 @@
|
||||
"cancellationScheduledSummary": "Cancellation Scheduled",
|
||||
"cancellationScheduledDetail": "Task cancellation has been successfully scheduled",
|
||||
"cancelFailedSummary": "Cancel Failed",
|
||||
"cancelFailedDetail": "Failed to cancel the task. Please try again."
|
||||
"cancelFailedDetail": "Failed to cancel the task. Please try again.",
|
||||
"taskTitle": "Metadata Fetch Task",
|
||||
"tagReview": "Review",
|
||||
"tagAuto": "Auto",
|
||||
"bookProgress": "Book <strong>{{ current }}</strong> of {{ total }}",
|
||||
"reviewBtn": "Review",
|
||||
"discardBtn": "Discard",
|
||||
"dismissBtn": "Dismiss",
|
||||
"discardTooltip": "Preserve current metadata, discard new fetched metadata",
|
||||
"cancelBtn": "Cancel",
|
||||
"cancelTooltip": "Cancel this task",
|
||||
"statusInProgress": "In Progress",
|
||||
"statusCompleted": "Completed",
|
||||
"statusError": "Error",
|
||||
"statusCancelled": "Cancelled"
|
||||
},
|
||||
"reader": {
|
||||
"failedToLoadPages": "Failed to load pages",
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "Library Statistics",
|
||||
"selectLibrary": "Select a library",
|
||||
"totalBooks": "Total books",
|
||||
"books": "Books",
|
||||
"totalAuthors": "Total authors",
|
||||
"authors": "Authors",
|
||||
"totalSeries": "Total series",
|
||||
"series": "Series",
|
||||
"totalPublishers": "Total publishers",
|
||||
"publishers": "Publishers",
|
||||
"totalSize": "Total size",
|
||||
"librarySize": "Library Size",
|
||||
"loading": "Loading statistics...",
|
||||
"noData": "No data available.",
|
||||
"noDataHint": "Make sure your library contains books with metadata.",
|
||||
"dragToReorder": "Drag to reorder"
|
||||
},
|
||||
"config": {
|
||||
"title": "Chart Configuration",
|
||||
"close": "Close",
|
||||
"enableAll": "Enable All",
|
||||
"disableAll": "Disable All",
|
||||
"resetOrder": "Reset Order",
|
||||
"smallCharts": "Small Charts",
|
||||
"largeCharts": "Large Charts",
|
||||
"xlargeCharts": "Extra Large Charts"
|
||||
},
|
||||
"chartNames": {
|
||||
"bookFormats": "Book Formats",
|
||||
"languages": "Languages",
|
||||
"metadataScore": "Metadata Score",
|
||||
"pageCount": "Page Count",
|
||||
"publicationTimeline": "Publication Timeline",
|
||||
"readingJourney": "Reading Journey",
|
||||
"topItems": "Top Items (Authors/Categories/etc.)",
|
||||
"authorUniverse": "Author Universe",
|
||||
"publicationTrend": "Publication Trend"
|
||||
},
|
||||
"bookFormats": {
|
||||
"title": "Book Formats",
|
||||
"description": "Distribution of file types in your library",
|
||||
"noData": "No books available.",
|
||||
"tooltipLabel": "{{ label }}: {{ value }} books ({{ percentage }}%)"
|
||||
},
|
||||
"language": {
|
||||
"title": "Languages",
|
||||
"description": "Languages represented in your collection",
|
||||
"noData": "No language data available.",
|
||||
"tooltipLabel": "{{ label }}: {{ value }} books ({{ percentage }}%)"
|
||||
},
|
||||
"metadataScore": {
|
||||
"title": "Metadata Score",
|
||||
"description": "Quality of book metadata in your library",
|
||||
"noData": "No metadata score data available.",
|
||||
"tooltipLabel": "{{ value }} books ({{ percentage }}%)",
|
||||
"excellent": "Excellent (90-100%)",
|
||||
"good": "Good (70-89%)",
|
||||
"fair": "Fair (50-69%)",
|
||||
"poor": "Poor (25-49%)",
|
||||
"veryPoor": "Very Poor (0-24%)"
|
||||
},
|
||||
"pageCount": {
|
||||
"title": "Page Count Distribution",
|
||||
"description": "Distribution of book lengths in your library",
|
||||
"noData": "No page count data available.",
|
||||
"tooltipTitle": "{{ label }} pages",
|
||||
"tooltipLabel": "{{ value }} book",
|
||||
"tooltipLabelPlural": "{{ value }} books",
|
||||
"axisPageCount": "Page Count",
|
||||
"axisBooks": "Books"
|
||||
},
|
||||
"publicationTimeline": {
|
||||
"title": "Publication Timeline",
|
||||
"description": "When were your books originally published?",
|
||||
"booksWithDates": "{{ count }} books with dates",
|
||||
"noData": "No publication date data available.",
|
||||
"tooltipBook": "{{ value }} book",
|
||||
"tooltipBooks": "{{ value }} books",
|
||||
"axisNumberOfBooks": "Number of Books",
|
||||
"insightOldest": "Oldest",
|
||||
"insightAverageYear": "Average Year",
|
||||
"insightMedian": "Median: {{ year }}",
|
||||
"insightNewest": "Newest",
|
||||
"insightTimeSpan": "Time Span",
|
||||
"insightYearsOfLiterature": "years of literature",
|
||||
"insightPeakDecade": "Peak Decade",
|
||||
"insightPeakDecadeBooks": "{{ count }} books",
|
||||
"insightDecadesCovered": "Decades Covered",
|
||||
"insightDifferentEras": "different eras"
|
||||
},
|
||||
"publicationTrend": {
|
||||
"title": "Publication Trend",
|
||||
"description": "Books by publication year showing collection trends",
|
||||
"noData": "No publication date data available.",
|
||||
"tooltipTitle": "Year {{ year }}",
|
||||
"tooltipBook": "{{ value }} book published",
|
||||
"tooltipBooks": "{{ value }} books published",
|
||||
"axisPublicationYear": "Publication Year",
|
||||
"axisBooks": "Books",
|
||||
"insightPeakYear": "Peak Year",
|
||||
"insightPeakYearBooks": "{{ count }} books",
|
||||
"insightLast10Years": "Last 10 Years",
|
||||
"insightLast10YearsBooks": "{{ count }} books",
|
||||
"insightAvgPerYear": "Avg per Year",
|
||||
"insightBooksPerYear": "books/year",
|
||||
"insightBest5YearSpan": "Best 5-Year Span",
|
||||
"insightMostBooksPublished": "most books published",
|
||||
"insightTimeSpan": "Time Span",
|
||||
"insightYearsCovered": "years covered",
|
||||
"insightCentury21": "21st Century",
|
||||
"insightCentury21Books": "{{ count }} books",
|
||||
"insightClassics": "Classics",
|
||||
"insightClassicsPre1970": "{{ count }} pre-1970",
|
||||
"insightUniqueYears": "Unique Years"
|
||||
},
|
||||
"readingJourney": {
|
||||
"title": "Reading Journey",
|
||||
"description": "Books added vs finished over time - the gap is your backlog",
|
||||
"noData": "No reading journey data available.",
|
||||
"noDataHint": "Books need addedOn or dateFinished dates to appear here.",
|
||||
"axisMonth": "Month",
|
||||
"axisCumulativeBooks": "Cumulative Books",
|
||||
"legendBooksAdded": "Books Added",
|
||||
"legendBooksFinished": "Books Finished",
|
||||
"tooltipBacklog": "Backlog: {{ count }} books",
|
||||
"insightCurrentBacklog": "Current Backlog",
|
||||
"insightBacklogPercent": "{{ percent }}% unread",
|
||||
"insightAvgTimeToFinish": "Avg Time to Finish",
|
||||
"insightDaysAfterAdding": "days after adding",
|
||||
"insightBestReadingMonth": "Best Reading Month",
|
||||
"insightPeakAcquisition": "Peak Acquisition",
|
||||
"insightFinishRate": "Finish Rate",
|
||||
"insightBooksPerMonthAvg": "books/month avg",
|
||||
"insightLongestStreak": "Longest Streak",
|
||||
"insightConsecutiveMonths": "consecutive months",
|
||||
"insightLast3Months": "Last 3 Months",
|
||||
"insightRecentlyFinished": "recently finished",
|
||||
"insightCompletion": "Completion",
|
||||
"insightBooksFinished": "books finished",
|
||||
"recentActivityBooks": "{{ count }} books",
|
||||
"recentActivityNone": "No activity"
|
||||
},
|
||||
"topItems": {
|
||||
"titlePrefix": "Top 15",
|
||||
"descriptionPrefix": "Most represented",
|
||||
"descriptionSuffix": "in your library",
|
||||
"shown": "shown",
|
||||
"noDataPrefix": "No",
|
||||
"noDataSuffix": "data available.",
|
||||
"noDataHintPrefix": "Make sure your books have",
|
||||
"noDataHintSuffix": "metadata.",
|
||||
"axisNumberOfBooks": "Number of Books",
|
||||
"dataTypes": {
|
||||
"authors": "Authors",
|
||||
"categories": "Categories",
|
||||
"series": "Series",
|
||||
"publishers": "Publishers",
|
||||
"tags": "Tags",
|
||||
"moods": "Moods"
|
||||
},
|
||||
"readStatus": {
|
||||
"read": "Read",
|
||||
"reading": "Reading",
|
||||
"reReading": "Re-reading",
|
||||
"unread": "Unread",
|
||||
"partiallyRead": "Partially Read",
|
||||
"paused": "Paused",
|
||||
"wontRead": "Won't Read",
|
||||
"abandoned": "Abandoned",
|
||||
"notSet": "Not Set"
|
||||
},
|
||||
"insightTop": "Top {{ type }}",
|
||||
"insightTopValue": "{{ name }} ({{ count }} books)",
|
||||
"insightMostCompleted": "Most completed",
|
||||
"insightMostCompletedValue": "{{ name }} ({{ percent }}% read)",
|
||||
"insightTop5Coverage": "Top 5 coverage",
|
||||
"insightTop5CoverageValue": "{{ percent }}% of library",
|
||||
"insightAvgPer": "Avg per {{ type }}",
|
||||
"insightAvgPerValue": "{{ avg }} books",
|
||||
"tooltipBooks": "{{ status }}: {{ value }} books",
|
||||
"tooltipBook": "{{ status }}: {{ value }} book"
|
||||
},
|
||||
"authorUniverse": {
|
||||
"title": "Author Universe",
|
||||
"description": "Explore your authors by books, ratings, and reading progress",
|
||||
"authorsBadge": "{{ count }} authors",
|
||||
"legendNote": "Bubble size = total pages \u2022 Position = books vs rating \u2022 Color = completion %",
|
||||
"noData": "No author data available. Authors need at least 2 books to appear.",
|
||||
"axisBooks": "Books in Library",
|
||||
"axisRating": "Average Rating",
|
||||
"legend75to100": "75-100% Read",
|
||||
"legend50to74": "50-74% Read",
|
||||
"legend25to49": "25-49% Read",
|
||||
"legend1to24": "1-24% Read",
|
||||
"legendUnread": "Unread",
|
||||
"tooltipBooks": "Books: {{ count }}",
|
||||
"tooltipTotalPages": "Total Pages: {{ count }}",
|
||||
"tooltipAvgRating": "Avg Rating: {{ rating }}",
|
||||
"tooltipNoRatings": "No ratings",
|
||||
"tooltipRead": "Read: {{ read }}/{{ total }} ({{ percent }}%)",
|
||||
"tooltipGenres": "Genres: {{ genres }}",
|
||||
"insightMostCollected": "Most collected: {{ name }} with {{ count }} books",
|
||||
"insightHighestRated": "Highest rated: {{ name }} ({{ rating }})",
|
||||
"insightMostPages": "Most pages: {{ name }} ({{ count }} pages)",
|
||||
"insightMostRead": "Most read: {{ name }} ({{ percent }}% complete)",
|
||||
"insightHiddenGem": "Hidden gem: {{ name }} ({{ rating }} across {{ count }} books)",
|
||||
"insightBiggestBacklog": "Biggest backlog: {{ name }} ({{ count }} unread books)",
|
||||
"insightTop3Concentration": "Top 3 concentration: {{ percent }}% of your collection",
|
||||
"insightLongestReads": "Longest reads: {{ name }} (avg {{ pages }} pages/book)",
|
||||
"insightMostVersatile": "Most versatile: {{ name }} ({{ count }} genres)",
|
||||
"insightUntouchedAuthor": "Untouched author: {{ name }} ({{ count }} unread books)",
|
||||
"insightOverallProgress": "Overall progress: {{ percent }}% pages read across all authors"
|
||||
},
|
||||
"libraryFilter": {
|
||||
"allLibraries": "All Libraries",
|
||||
"libraryFallback": "Library {{ id }}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,474 @@
|
||||
{
|
||||
"main": {
|
||||
"title": "{{ name }}'s Reading Statistics",
|
||||
"customizeLayout": "Customize Layout",
|
||||
"chartConfig": "Chart Configuration",
|
||||
"resetLayout": "Reset Layout",
|
||||
"hideAll": "Hide All",
|
||||
"showAll": "Show All",
|
||||
"close": "Close"
|
||||
},
|
||||
"chartNames": {
|
||||
"heatmap": "Reading Session Heatmap",
|
||||
"favoriteDays": "Favorite Reading Days",
|
||||
"peakHours": "Peak Reading Hours",
|
||||
"timeline": "Reading Session Timeline",
|
||||
"readingHeatmap": "Reading Activity Heatmap",
|
||||
"personalRating": "Personal Rating Distribution",
|
||||
"readingProgress": "Reading Progress Distribution",
|
||||
"readStatus": "Reading Status Distribution",
|
||||
"genreStats": "Genre Statistics",
|
||||
"completionTimeline": "Completion Timeline",
|
||||
"readingClock": "Reading Clock",
|
||||
"pageTurner": "Page Turner Score",
|
||||
"completionRace": "Reading Completion Race",
|
||||
"readingSurvival": "Reading Survival Curve",
|
||||
"bookLength": "Book Length Sweet Spot",
|
||||
"ratingTaste": "Rating Taste Comparison",
|
||||
"seriesProgress": "Series Progress Tracker",
|
||||
"readingDna": "Reading DNA Profile",
|
||||
"readingHabits": "Reading Habits Analysis"
|
||||
},
|
||||
"sessionHeatmap": {
|
||||
"title": "Reading Session Activity",
|
||||
"tooltip": "A daily heatmap of your reading sessions for the selected year. Darker cells mean more sessions that day. Streak stats track consecutive reading days across all time. Milestones unlock as you hit streak or total-day thresholds.",
|
||||
"description": "Daily overview of your reading sessions across the year",
|
||||
"previousYear": "Previous year",
|
||||
"nextYear": "Next year",
|
||||
"currentStreak": "Current Streak",
|
||||
"longestStreak": "Longest Streak",
|
||||
"totalDays": "Total Days",
|
||||
"consistency": "Consistency",
|
||||
"readingSessions": "Reading Sessions",
|
||||
"readingSession": "{{ count }} reading session",
|
||||
"readingSessions_plural": "{{ count }} reading sessions",
|
||||
"milestone7DayStreak": "7-Day Streak",
|
||||
"milestone30DayStreak": "30-Day Streak",
|
||||
"milestone100ReadingDays": "100 Reading Days",
|
||||
"milestone365ReadingDays": "365 Reading Days",
|
||||
"milestoneYearOfReading": "Year of Reading"
|
||||
},
|
||||
"sessionTimeline": {
|
||||
"title": "Reading Session Timeline",
|
||||
"tooltip": "Shows your reading sessions laid out across each day of the week. Each block represents a session, sized by duration. Hover to see book title, pages read, and time spent. Use the week navigator to browse your reading history week by week.",
|
||||
"description": "Weekly overview of your reading sessions and patterns",
|
||||
"previousWeek": "Previous week",
|
||||
"nextWeek": "Next week",
|
||||
"week": "Week {{ number }}",
|
||||
"selectYear": "Select Year",
|
||||
"selectWeek": "Select Week",
|
||||
"readingSession": "Reading Session",
|
||||
"tooltipTime": "Time:",
|
||||
"tooltipDuration": "Duration:",
|
||||
"tooltipFormat": "Format:",
|
||||
"unknown": "Unknown"
|
||||
},
|
||||
"genreStats": {
|
||||
"title": "Reading by Genre",
|
||||
"tooltip": "Ranks your top genres by total reading time. Each bar shows how many hours you've spent reading books in that genre, so you can see where most of your reading time actually goes.",
|
||||
"description": "Top genres by total reading time",
|
||||
"axisGenres": "Genres",
|
||||
"axisTimeRead": "Time Read",
|
||||
"readingTime": "Reading Time",
|
||||
"day": "day",
|
||||
"days": "days",
|
||||
"hr": "hr",
|
||||
"hrs": "hrs",
|
||||
"min": "min",
|
||||
"sec": "sec"
|
||||
},
|
||||
"completionTimeline": {
|
||||
"title": "Reading Progress",
|
||||
"description": "Monthly book completion statistics",
|
||||
"previousYear": "Previous year",
|
||||
"nextYear": "Next year",
|
||||
"axisMonth": "Month",
|
||||
"axisNumberOfBooks": "Number of Books",
|
||||
"completed": "Completed",
|
||||
"activeReading": "Active Reading",
|
||||
"paused": "Paused",
|
||||
"discontinued": "Discontinued",
|
||||
"tooltipBook": "{{ label }}: {{ value }} book",
|
||||
"tooltipBooks": "{{ label }}: {{ value }} books"
|
||||
},
|
||||
"favoriteDays": {
|
||||
"title": "Favorite Reading Days",
|
||||
"tooltip": "Bars show how many reading sessions and total reading time you logged on each day of the week. Filter by year and month to spot seasonal patterns. Helps you find your most productive reading days.",
|
||||
"description": "Reading sessions and duration by day of the week",
|
||||
"selectYear": "Select Year",
|
||||
"selectMonth": "Select Month",
|
||||
"allYears": "All Years",
|
||||
"allMonths": "All Months",
|
||||
"january": "January",
|
||||
"february": "February",
|
||||
"march": "March",
|
||||
"april": "April",
|
||||
"may": "May",
|
||||
"june": "June",
|
||||
"july": "July",
|
||||
"august": "August",
|
||||
"september": "September",
|
||||
"october": "October",
|
||||
"november": "November",
|
||||
"december": "December",
|
||||
"axisDayOfWeek": "Day of Week",
|
||||
"axisNumberOfSessions": "Number of Sessions",
|
||||
"axisDurationHours": "Duration (hours)",
|
||||
"sessions": "Sessions",
|
||||
"durationHours": "Duration (hours)",
|
||||
"tooltipSessions": "{{ label }}: {{ value }} session",
|
||||
"tooltipSessionsPlural": "{{ label }}: {{ value }} sessions"
|
||||
},
|
||||
"peakHours": {
|
||||
"title": "Peak Reading Hours",
|
||||
"tooltip": "Shows the number of reading sessions and total reading time for each hour of the day (midnight to 11pm). Filter by year and month to see how your habits shift over time. The peak hour highlights when you read the most.",
|
||||
"description": "Reading activity by hour of the day",
|
||||
"selectYear": "Select Year",
|
||||
"selectMonth": "Select Month",
|
||||
"allYears": "All Years",
|
||||
"allMonths": "All Months",
|
||||
"january": "January",
|
||||
"february": "February",
|
||||
"march": "March",
|
||||
"april": "April",
|
||||
"may": "May",
|
||||
"june": "June",
|
||||
"july": "July",
|
||||
"august": "August",
|
||||
"september": "September",
|
||||
"october": "October",
|
||||
"november": "November",
|
||||
"december": "December",
|
||||
"axisHourOfDay": "Hour of Day",
|
||||
"axisNumberOfSessions": "Number of Sessions",
|
||||
"axisAvgDuration": "Avg Duration (min)",
|
||||
"sessions": "Sessions",
|
||||
"avgDurationMin": "Avg Duration (min)",
|
||||
"tooltipSessions": "{{ label }}: {{ value }} session",
|
||||
"tooltipSessionsPlural": "{{ label }}: {{ value }} sessions",
|
||||
"tooltipMin": "{{ label }}: {{ value }} min"
|
||||
},
|
||||
"personalRating": {
|
||||
"title": "Personal Rating Distribution",
|
||||
"tooltip": "Shows how many books you've given each rating from 1 to 10. Helps you see whether you tend to rate generously, harshly, or cluster around a particular score. Only books with a personal rating are included.",
|
||||
"description": "Books by your rating (1\u201310)",
|
||||
"axisPersonalRating": "Personal Rating",
|
||||
"axisNumberOfBooks": "Number of Books",
|
||||
"booksByPersonalRating": "Books by Personal Rating",
|
||||
"tooltipTitle": "Personal Rating: {{ label }}",
|
||||
"tooltipBook": "{{ value }} book",
|
||||
"tooltipBooks": "{{ value }} books"
|
||||
},
|
||||
"readStatus": {
|
||||
"title": "Reading Status Distribution",
|
||||
"tooltip": "Breaks down your entire library by reading status: read, reading, partially read, paused, abandoned, won't read, and unread. Gives you a quick snapshot of how much of your collection you've worked through.",
|
||||
"description": "Books by their reading status",
|
||||
"unread": "Unread",
|
||||
"currentlyReading": "Currently Reading",
|
||||
"reReading": "Re-reading",
|
||||
"read": "Read",
|
||||
"partiallyRead": "Partially Read",
|
||||
"paused": "Paused",
|
||||
"wontRead": "Won't Read",
|
||||
"abandoned": "Abandoned",
|
||||
"noStatus": "No Status",
|
||||
"tooltipLabel": "{{ label }}: {{ value }} books ({{ percentage }}%)"
|
||||
},
|
||||
"readingDna": {
|
||||
"title": "Reading DNA Profile",
|
||||
"tooltip": "A radar chart profiling your reading personality across 8 dimensions. Scores are computed from your library's genres, ratings, page counts, publication dates, and reading progress. Each trait uses non-overlapping criteria for accurate results.",
|
||||
"description": "Your unique reading personality across 8 dimensions",
|
||||
"personalityTraits": "Your Reading Personality Traits",
|
||||
"readingDnaProfile": "Reading DNA Profile",
|
||||
"tooltipPersonality": "{{ label }} Personality",
|
||||
"tooltipScore": "Score: {{ score }}/100",
|
||||
"tooltipDefaultDescription": "Your reading personality trait",
|
||||
"traits": {
|
||||
"adventurous": "Adventurous",
|
||||
"perfectionist": "Perfectionist",
|
||||
"intellectual": "Intellectual",
|
||||
"emotional": "Emotional",
|
||||
"patient": "Patient",
|
||||
"social": "Social",
|
||||
"nostalgic": "Nostalgic",
|
||||
"ambitious": "Ambitious"
|
||||
},
|
||||
"descriptions": {
|
||||
"adventurous": {
|
||||
"low": "You tend to stick to familiar genres and formats",
|
||||
"mid": "You enjoy a healthy mix of genres and styles",
|
||||
"high": "You explore a wide variety of genres, languages, and formats"
|
||||
},
|
||||
"perfectionist": {
|
||||
"low": "You keep many books in progress or unfinished",
|
||||
"mid": "You finish most books and favor quality reads",
|
||||
"high": "You almost always finish what you start and seek top-rated books"
|
||||
},
|
||||
"intellectual": {
|
||||
"low": "Your reading leans toward lighter subjects",
|
||||
"mid": "You balance entertainment with educational reading",
|
||||
"high": "You gravitate heavily toward non-fiction and scholarly material"
|
||||
},
|
||||
"emotional": {
|
||||
"low": "You tend toward plot-driven or factual reading",
|
||||
"mid": "You enjoy a mix of emotional and analytical reads",
|
||||
"high": "You connect deeply with memoirs, poetry, and emotionally rich stories"
|
||||
},
|
||||
"patient": {
|
||||
"low": "You prefer shorter, quicker reads",
|
||||
"mid": "You occasionally tackle longer works and series",
|
||||
"high": "You regularly take on epic novels and multi-book series"
|
||||
},
|
||||
"social": {
|
||||
"low": "You prefer niche or lesser-known titles",
|
||||
"mid": "You read a mix of popular and niche titles",
|
||||
"high": "Your library is packed with bestsellers and widely-discussed books"
|
||||
},
|
||||
"nostalgic": {
|
||||
"low": "You mostly read contemporary publications",
|
||||
"mid": "You appreciate a mix of classic and modern works",
|
||||
"high": "You have a deep love for classic literature and older works"
|
||||
},
|
||||
"ambitious": {
|
||||
"low": "You read at a casual pace with shorter books",
|
||||
"mid": "You maintain a solid reading volume with some challenging picks",
|
||||
"high": "You push yourself with large volumes of challenging, lengthy books"
|
||||
}
|
||||
}
|
||||
},
|
||||
"readingHabits": {
|
||||
"title": "Reading Habits Analysis",
|
||||
"tooltip": "A radar chart analyzing your reading behavior across 8 dimensions. Consistency measures regularity of completions over time. Completionism tracks finish vs. abandonment rate. Methodology checks if you read series in order. Scores are derived from your reading activity, dates, and progress data.",
|
||||
"description": "Your behavioral reading patterns across 8 dimensions",
|
||||
"habitPatterns": "Your Reading Habit Patterns",
|
||||
"readingHabitsProfile": "Reading Habits Profile",
|
||||
"tooltipHabit": "{{ label }} Habit",
|
||||
"tooltipScore": "Score: {{ score }}/100",
|
||||
"tooltipDefaultDescription": "Your reading habit pattern",
|
||||
"habits": {
|
||||
"consistency": "Consistency",
|
||||
"multitasking": "Multitasking",
|
||||
"completionism": "Completionism",
|
||||
"exploration": "Exploration",
|
||||
"organization": "Organization",
|
||||
"intensity": "Intensity",
|
||||
"methodology": "Methodology",
|
||||
"momentum": "Momentum"
|
||||
},
|
||||
"descriptions": {
|
||||
"consistency": {
|
||||
"low": "Your reading is sporadic with long gaps between books",
|
||||
"mid": "You read at a fairly regular pace throughout the year",
|
||||
"high": "You maintain a very steady, disciplined reading rhythm"
|
||||
},
|
||||
"multitasking": {
|
||||
"low": "You prefer focusing on one book at a time",
|
||||
"mid": "You occasionally juggle a couple of books at once",
|
||||
"high": "You regularly read multiple books simultaneously"
|
||||
},
|
||||
"completionism": {
|
||||
"low": "You often set books aside before finishing them",
|
||||
"mid": "You finish most books you start, with a few exceptions",
|
||||
"high": "You almost never abandon a book once you start it"
|
||||
},
|
||||
"exploration": {
|
||||
"low": "You tend to revisit favorite authors and familiar territory",
|
||||
"mid": "You balance familiar authors with occasional new discoveries",
|
||||
"high": "You actively seek out new authors, eras, and languages"
|
||||
},
|
||||
"organization": {
|
||||
"low": "Your library could use more rating and status tracking",
|
||||
"mid": "You keep your library reasonably well curated",
|
||||
"high": "You diligently rate, categorize, and track every book"
|
||||
},
|
||||
"intensity": {
|
||||
"low": "You lean toward shorter, lighter reads",
|
||||
"mid": "You read a mix of short and longer books",
|
||||
"high": "You consistently tackle lengthy, immersive books"
|
||||
},
|
||||
"methodology": {
|
||||
"low": "You pick books spontaneously without a system",
|
||||
"mid": "You show some methodical patterns in your reading choices",
|
||||
"high": "You systematically work through series, authors, and genres"
|
||||
},
|
||||
"momentum": {
|
||||
"low": "Your reading activity has been quiet recently",
|
||||
"mid": "You have a steady reading pace going",
|
||||
"high": "You are on a strong active reading streak right now"
|
||||
}
|
||||
}
|
||||
},
|
||||
"readingHeatmap": {
|
||||
"title": "Reading Activity Heatmap",
|
||||
"tooltip": "A 10-year grid showing how many books were added to your library each month. Darker cells mean more books. Helps you visualize long-term acquisition trends and seasonal reading bursts.",
|
||||
"description": "Monthly reading activity over the past 10 years",
|
||||
"booksRead": "Books Read",
|
||||
"tooltipBook": "{{ value }} book read",
|
||||
"tooltipBooks": "{{ value }} books read"
|
||||
},
|
||||
"readingProgress": {
|
||||
"title": "Reading Progress Distribution",
|
||||
"tooltip": "Shows how many books fall into each progress bracket: not started (0%), just started (1-25%), halfway (26-50%), mostly done (51-75%), nearly finished (76-99%), and completed (100%). Progress is based on the furthest point reached across all reading sessions.",
|
||||
"description": "Books by reading completion status",
|
||||
"booksByProgress": "Books by Progress",
|
||||
"notStarted": "Not Started",
|
||||
"justStarted": "Just Started",
|
||||
"gettingIntoIt": "Getting Into It",
|
||||
"halfwayThrough": "Halfway Through",
|
||||
"almostFinished": "Almost Finished",
|
||||
"completed": "Completed",
|
||||
"tooltipLabel": "{{ value }} book{{ plural }} ({{ description }}) - {{ percentage }}%"
|
||||
},
|
||||
"ratingTaste": {
|
||||
"title": "Rating Taste Comparison",
|
||||
"tooltip": "Each dot is a book plotted by its external rating (X-axis, e.g. Goodreads/Amazon) versus your personal rating (Y-axis). Books on the diagonal mean you agree with the crowd. Above the line means you rated higher; below means you rated lower. Quadrants show your taste patterns.",
|
||||
"description": "Compare your personal ratings against external ratings (Goodreads, Amazon, etc.)",
|
||||
"booksAnalyzed": "books analyzed",
|
||||
"axisExternalRating": "External Rating (1-5 scale)",
|
||||
"axisPersonalRating": "Your Personal Rating (normalized from 1-10)",
|
||||
"tooltipUnknownBook": "Unknown Book",
|
||||
"tooltipYourRating": "Your Rating: {{ rating }}/10 ({{ normalized }}/5)",
|
||||
"tooltipExternalRating": "External Rating: {{ rating }}/5",
|
||||
"tooltipDifference": "Difference: {{ diff }} (on 5-point scale)",
|
||||
"tooltipCategory": "Category: {{ category }}",
|
||||
"quadrantHiddenGems": "Hidden Gems",
|
||||
"quadrantPopularFavorites": "Popular Favorites",
|
||||
"quadrantAgreedMisses": "Agreed Misses",
|
||||
"quadrantOverrated": "Overrated",
|
||||
"quadrantDescHiddenGems": "Books you rate higher than the public",
|
||||
"quadrantDescPopularFavorites": "Books you and the public both love",
|
||||
"quadrantDescAgreedMisses": "Books neither you nor public enjoyed",
|
||||
"quadrantDescOverrated": "Popular books that disappointed you",
|
||||
"tasteProfile": "Your Taste Profile",
|
||||
"avgDeviation": "Avg. deviation:",
|
||||
"uniqueTaste": "Unique taste",
|
||||
"mainstream": "Mainstream",
|
||||
"balanced": "Balanced"
|
||||
},
|
||||
"seriesProgress": {
|
||||
"title": "Series Progress Tracker",
|
||||
"tooltip": "Shows each book series in your library as a stacked bar: read, reading, and unread volumes. Series are sorted by completion percentage. Use this to spot which series you've fallen behind on or are close to finishing.",
|
||||
"description": "Track your reading progress across book series",
|
||||
"series": "Series",
|
||||
"avgCompletion": "Avg. Completion",
|
||||
"topRated": "Top Rated",
|
||||
"seriesBreakdown": "Series Breakdown",
|
||||
"ofTotal": "{{ filtered }} of {{ total }}",
|
||||
"searchSeries": "Search series...",
|
||||
"allStatus": "All Status",
|
||||
"inProgress": "In Progress",
|
||||
"completed": "Completed",
|
||||
"notStarted": "Not Started",
|
||||
"sortByProgress": "Sort by Progress",
|
||||
"sortByRating": "Sort by Rating",
|
||||
"sortByBooks": "Sort by Books",
|
||||
"sortByName": "Sort by Name",
|
||||
"read": "Read",
|
||||
"reading": "Reading",
|
||||
"partiallyRead": "Partially Read",
|
||||
"paused": "Paused",
|
||||
"abandoned": "Abandoned",
|
||||
"wontRead": "Won't Read",
|
||||
"unread": "Unread",
|
||||
"booksRead": "{{ read }}/{{ owned }} read",
|
||||
"inSeriesHint": "({{ total }} in series)",
|
||||
"next": "Next:",
|
||||
"axisCompletion": "Completion %",
|
||||
"tooltipRead": "Read: {{ read }}/{{ owned }} owned",
|
||||
"tooltipSeriesTotal": "Series total: {{ total }} books",
|
||||
"tooltipYourRating": "Your rating: {{ rating }}/10",
|
||||
"noMatchingSearch": "No series matching \"{{ term }}\"",
|
||||
"pageInfo": "Page {{ current }} of {{ total }}",
|
||||
"noData": "No series found in your library.",
|
||||
"noDataHint": "Books need series metadata to appear here."
|
||||
},
|
||||
"pageTurner": {
|
||||
"title": "Page Turner Score",
|
||||
"tooltip": "Each book gets a 'grip score' (0-100) based on how your reading behavior changed over time. It measures whether your sessions got longer, whether gaps between sessions shrank, and whether you had a burst of reading near the end. Higher scores mean the book pulled you in more as you read.",
|
||||
"description": "How gripping each book was based on your reading patterns",
|
||||
"mostGripping": "Most Gripping",
|
||||
"avgGripScore": "Avg Grip Score",
|
||||
"guiltyPleasure": "Guilty Pleasure",
|
||||
"sessionDurationTrend": "Session duration trend",
|
||||
"gapBetweenSessionsTrend": "Gap between sessions trend",
|
||||
"finishBurst": "Finish Burst",
|
||||
"increasing": "Increasing",
|
||||
"decreasing": "Decreasing",
|
||||
"steady": "Steady",
|
||||
"shrinking": "Shrinking",
|
||||
"growing": "Growing",
|
||||
"axisGripScore": "Grip Score (0-100)",
|
||||
"gripScore": "Grip Score",
|
||||
"tooltipGripScore": "Grip Score: {{ score }}/100",
|
||||
"tooltipSessions": "Sessions: {{ count }}",
|
||||
"tooltipAvgSession": "Avg Session: {{ minutes }}min",
|
||||
"tooltipRating": "Rating: {{ rating }}/10"
|
||||
},
|
||||
"completionRace": {
|
||||
"title": "Reading Completion Race",
|
||||
"tooltip": "Each line represents a completed book's reading journey. The X-axis shows days since you started that book, and the Y-axis shows your progress from 0% to 100%. Steeper lines mean faster reads. Only books marked as 'Read' with tracked sessions are included.",
|
||||
"description": "Compare how quickly you finished different books",
|
||||
"previousYear": "Previous year",
|
||||
"nextYear": "Next year",
|
||||
"books": "Books",
|
||||
"sessions": "Sessions",
|
||||
"avgDays": "Avg Days",
|
||||
"medianDays": "Median Days",
|
||||
"fastest": "Fastest",
|
||||
"slowest": "Slowest",
|
||||
"axisDaysSinceFirstSession": "Days Since First Session",
|
||||
"axisProgress": "Progress (%)",
|
||||
"tooltipDayProgress": "Day {{ day }}: {{ progress }}% progress",
|
||||
"noData": "No completed books with reading sessions found for {{ year }}.",
|
||||
"noDataHint": "Complete some books with tracked reading sessions to see your completion races."
|
||||
},
|
||||
"readingSurvival": {
|
||||
"title": "Reading Survival Curve",
|
||||
"tooltip": "Inspired by survival analysis: starting from all books you've begun reading, this curve shows what fraction made it to each progress milestone. A steep drop at a threshold reveals where you tend to abandon books. The 'danger zone' highlights the steepest single drop-off point.",
|
||||
"description": "Of books started, what percentage reached each progress threshold",
|
||||
"started": "Started",
|
||||
"completionRate": "Completion Rate",
|
||||
"medianDropout": "Median Dropout",
|
||||
"dangerZone": "Danger Zone",
|
||||
"survivalRate": "Survival Rate",
|
||||
"axisProgressThreshold": "Progress Threshold",
|
||||
"axisBooksSurviving": "% of Books Surviving",
|
||||
"tooltipProgress": "{{ label }} progress",
|
||||
"tooltipSurvival": "{{ value }}% of books reached this point",
|
||||
"noData": "No books with reading progress found.",
|
||||
"noDataHint": "Start reading some books to see your survival curve."
|
||||
},
|
||||
"readingClock": {
|
||||
"title": "Reading Clock",
|
||||
"tooltip": "Each segment of the clock represents one hour of the day (12am-11pm). The size of each segment shows how many total minutes you've spent reading during that hour across all time. Warm colors indicate your busiest hours. You're classified as a Night Owl (most reading 8pm-2am), Early Bird (5am-11am), or Balanced.",
|
||||
"description": "When do you read throughout the day",
|
||||
"peakHour": "Peak Hour",
|
||||
"totalRead": "Total Read",
|
||||
"readerType": "Reader Type",
|
||||
"nightOwl": "Night Owl",
|
||||
"earlyBird": "Early Bird",
|
||||
"balanced": "Balanced",
|
||||
"tooltipReading": "{{ time }} of reading",
|
||||
"noData": "No reading session data found.",
|
||||
"noDataHint": "Track your reading sessions to see your reading clock."
|
||||
},
|
||||
"bookLength": {
|
||||
"title": "Book Length Sweet Spot",
|
||||
"tooltip": "Each dot is a book you've rated, plotted by its page count (X-axis) and your personal rating (Y-axis). Colors indicate read status: green = read, blue = reading, red = abandoned. The trend line shows whether you tend to rate longer or shorter books higher. The 'sweet spot' is the page-count range where your average rating is highest.",
|
||||
"description": "How book length relates to your personal ratings",
|
||||
"booksAnalyzed": "books analyzed",
|
||||
"sweetSpot": "Sweet Spot",
|
||||
"highestRated": "Highest Rated",
|
||||
"axisPageCount": "Page Count",
|
||||
"axisPersonalRating": "Personal Rating",
|
||||
"tooltipUnknownBook": "Unknown Book",
|
||||
"tooltipPages": "Pages: {{ count }}",
|
||||
"tooltipRating": "Rating: {{ rating }}/10",
|
||||
"tooltipStatus": "Status: {{ status }}",
|
||||
"statusRead": "Read",
|
||||
"statusReading": "Reading",
|
||||
"statusAbandoned": "Abandoned",
|
||||
"statusOther": "Other",
|
||||
"trend": "Trend"
|
||||
}
|
||||
}
|
||||
@@ -451,7 +451,97 @@
|
||||
"filter": {
|
||||
"title": "Filtros",
|
||||
"showingFirst100": "Mostrando los primeros 100 elementos",
|
||||
"footerNote": "Nota: Se muestran los 100 primeros elementos por categoría de filtro"
|
||||
"footerNote": "Nota: Se muestran los 100 primeros elementos por categoría de filtro",
|
||||
"labels": {
|
||||
"author": "Autor",
|
||||
"category": "Género",
|
||||
"series": "Serie",
|
||||
"bookType": "Tipo de libro",
|
||||
"readStatus": "Estado de lectura",
|
||||
"personalRating": "Calificación personal",
|
||||
"publisher": "Editorial",
|
||||
"matchScore": "Puntuación de coincidencia de metadatos",
|
||||
"library": "Biblioteca",
|
||||
"shelf": "Estante",
|
||||
"shelfStatus": "Estado del estante",
|
||||
"tag": "Etiqueta",
|
||||
"publishedDate": "Año de publicación",
|
||||
"fileSize": "Tamaño de archivo",
|
||||
"amazonRating": "Calificación Amazon",
|
||||
"goodreadsRating": "Calificación Goodreads",
|
||||
"hardcoverRating": "Calificación Hardcover",
|
||||
"language": "Idioma",
|
||||
"pageCount": "Número de páginas",
|
||||
"mood": "Estado de ánimo",
|
||||
"ageRating": "Clasificación por edad",
|
||||
"contentRating": "Clasificación de contenido",
|
||||
"narrator": "Narrador",
|
||||
"comicCharacter": "Personaje de cómic",
|
||||
"comicTeam": "Equipo de cómic",
|
||||
"comicLocation": "Ubicación de cómic",
|
||||
"comicCreator": "Creador de cómic"
|
||||
},
|
||||
"readStatus": {
|
||||
"unread": "No leído",
|
||||
"reading": "Leyendo",
|
||||
"reReading": "Releyendo",
|
||||
"partiallyRead": "Parcialmente leído",
|
||||
"paused": "Pausado",
|
||||
"read": "Leído",
|
||||
"wontRead": "No leeré",
|
||||
"abandoned": "Abandonado",
|
||||
"unset": "Sin definir"
|
||||
},
|
||||
"matchScore": {
|
||||
"outstanding": "Sobresaliente (95–100%)",
|
||||
"excellent": "Excelente (90–94%)",
|
||||
"great": "Genial (80–89%)",
|
||||
"good": "Bueno (70–79%)",
|
||||
"fair": "Regular (50–69%)",
|
||||
"weak": "Débil (30–49%)",
|
||||
"poor": "Pobre (0–29%)"
|
||||
},
|
||||
"fileSize": {
|
||||
"lt1mb": "< 1 MB",
|
||||
"1to10mb": "1–10 MB",
|
||||
"10to50mb": "10–50 MB",
|
||||
"50to100mb": "50–100 MB",
|
||||
"250to500mb": "250–500 MB",
|
||||
"05to1gb": "0,5–1 GB",
|
||||
"1to2gb": "1–2 GB",
|
||||
"5plusGb": "5+ GB"
|
||||
},
|
||||
"pageCount": {
|
||||
"lt50": "< 50 páginas",
|
||||
"50to100": "50–100 páginas",
|
||||
"100to200": "100–200 páginas",
|
||||
"200to400": "200–400 páginas",
|
||||
"400to600": "400–600 páginas",
|
||||
"600to1000": "600–1000 páginas",
|
||||
"1000plus": "1000+ páginas"
|
||||
},
|
||||
"ageRating": {
|
||||
"allAges": "Todas las edades"
|
||||
},
|
||||
"contentRating": {
|
||||
"everyone": "Todos",
|
||||
"teen": "Adolescente",
|
||||
"mature": "Maduro",
|
||||
"adult": "Adulto",
|
||||
"explicit": "Explícito"
|
||||
},
|
||||
"shelfStatus": {
|
||||
"shelved": "En estante",
|
||||
"unshelved": "Sin estante"
|
||||
},
|
||||
"comicRoles": {
|
||||
"penciller": "Dibujante",
|
||||
"inker": "Entintador",
|
||||
"colorist": "Colorista",
|
||||
"letterer": "Rotulista",
|
||||
"coverArtist": "Artista de portada",
|
||||
"editor": "Editor"
|
||||
}
|
||||
},
|
||||
"shelfAssigner": {
|
||||
"title": "Asignar libros a estantes",
|
||||
@@ -552,7 +642,37 @@
|
||||
"addSortFieldPlaceholder": "Agregar campo de orden...",
|
||||
"saveAsDefault": "Guardar como predeterminado",
|
||||
"ascendingTooltip": "Ascendente - clic para cambiar",
|
||||
"descendingTooltip": "Descendente - clic para cambiar"
|
||||
"descendingTooltip": "Descendente - clic para cambiar",
|
||||
"options": {
|
||||
"title": "Título",
|
||||
"fileName": "Nombre de archivo",
|
||||
"filePath": "Ruta de archivo",
|
||||
"author": "Autor",
|
||||
"authorSurnameVorname": "Autor (Apellido)",
|
||||
"seriesName": "Nombre de serie",
|
||||
"seriesNumber": "Número de serie",
|
||||
"lastReadTime": "Última lectura",
|
||||
"personalRating": "Calificación personal",
|
||||
"addedOn": "Fecha de añadido",
|
||||
"fileSizeKb": "Tamaño de archivo",
|
||||
"locked": "Bloqueado",
|
||||
"publisher": "Editorial",
|
||||
"publishedDate": "Fecha de publicación",
|
||||
"readStatus": "Estado de lectura",
|
||||
"dateFinished": "Fecha de finalización",
|
||||
"readingProgress": "Progreso de lectura",
|
||||
"bookType": "Tipo de libro",
|
||||
"amazonRating": "Calificación Amazon",
|
||||
"amazonReviewCount": "Amazon #",
|
||||
"goodreadsRating": "Calificación Goodreads",
|
||||
"goodreadsReviewCount": "Goodreads #",
|
||||
"hardcoverRating": "Calificación Hardcover",
|
||||
"hardcoverReviewCount": "Hardcover #",
|
||||
"ranobedbRating": "Calificación Ranobedb",
|
||||
"narrator": "Narrador",
|
||||
"pageCount": "Páginas",
|
||||
"random": "Aleatorio"
|
||||
}
|
||||
},
|
||||
"fileAttacher": {
|
||||
"title": "Adjuntar archivo a otro libro",
|
||||
|
||||
@@ -16,5 +16,10 @@
|
||||
"next": "Siguiente",
|
||||
"submit": "Enviar",
|
||||
"remove": "Eliminar",
|
||||
"edit": "Editar"
|
||||
"edit": "Editar",
|
||||
"info": "Información",
|
||||
"select": "Seleccionar",
|
||||
"dismiss": "Descartar",
|
||||
"discard": "Descartar",
|
||||
"review": "Revisar"
|
||||
}
|
||||
|
||||
@@ -28,8 +28,12 @@ import book from './book.json';
|
||||
import readerAudiobook from './reader-audiobook.json';
|
||||
import readerCbx from './reader-cbx.json';
|
||||
import readerEbook from './reader-ebook.json';
|
||||
import readerPdf from './reader-pdf.json';
|
||||
import statsLibrary from './stats-library.json';
|
||||
import statsUser from './stats-user.json';
|
||||
import magicShelf from './magic-shelf.json';
|
||||
|
||||
// To add a new domain: create the JSON file and add it here.
|
||||
// Settings tabs each get their own file: settings-email, settings-reader, settings-view, etc.
|
||||
const translations: Translation = {common, auth, nav, dashboard, settings, settingsEmail, settingsReader, settingsView, settingsMeta, settingsLibMeta, settingsApp, settingsUsers, settingsNaming, settingsOpds, settingsTasks, settingsAuth, settingsDevice, settingsProfile, app, shared, layout, libraryCreator, bookdrop, metadata, notebook, book, readerAudiobook, readerCbx, readerEbook};
|
||||
const translations: Translation = {common, auth, nav, dashboard, settings, settingsEmail, settingsReader, settingsView, settingsMeta, settingsLibMeta, settingsApp, settingsUsers, settingsNaming, settingsOpds, settingsTasks, settingsAuth, settingsDevice, settingsProfile, app, shared, layout, libraryCreator, bookdrop, metadata, notebook, book, readerAudiobook, readerCbx, readerEbook, readerPdf, statsLibrary, statsUser, magicShelf};
|
||||
export default translations;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"logout": "Cerrar sesión",
|
||||
"language": "Idioma",
|
||||
"supportBookLore": "Apoyar BookLore",
|
||||
"notificationAriaLabel": "Icono de notificación unificado",
|
||||
"createLibrary": "Crear biblioteca",
|
||||
"stats": "Estadísticas",
|
||||
"libraryStats": "Estadísticas de biblioteca",
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"header": {
|
||||
"titleEdit": "Editar Estante M\u00e1gico",
|
||||
"titleCreate": "Constructor de Estante M\u00e1gico",
|
||||
"description": "Crea estantes inteligentes con reglas personalizadas para organizar tus libros autom\u00e1ticamente"
|
||||
},
|
||||
"form": {
|
||||
"shelfName": "Nombre del Estante M\u00e1gico",
|
||||
"namePlaceholder": "Ej. Rom-Zom-Coms, R\u00e1pidos y Furiosos, Metadatos Faltantes",
|
||||
"shelfIcon": "\u00cdcono del Estante",
|
||||
"clickToChange": "Clic para cambiar",
|
||||
"removeIcon": "Eliminar \u00edcono",
|
||||
"selectIcon": "Seleccionar \u00cdcono",
|
||||
"public": "P\u00fablico"
|
||||
},
|
||||
"actions": {
|
||||
"cancel": "Cancelar",
|
||||
"saveFilter": "Guardar Filtro",
|
||||
"addRule": "Agregar Regla",
|
||||
"addGroup": "Agregar Grupo"
|
||||
},
|
||||
"group": {
|
||||
"condition": "Condici\u00f3n:"
|
||||
},
|
||||
"placeholders": {
|
||||
"field": "Campo",
|
||||
"operator": "Operador",
|
||||
"startYear": "A\u00f1o Inicio",
|
||||
"endYear": "A\u00f1o Fin",
|
||||
"startDate": "Fecha Inicio",
|
||||
"endDate": "Fecha Fin",
|
||||
"startValue": "Valor Inicio",
|
||||
"endValue": "Valor Fin",
|
||||
"value": "Valor",
|
||||
"selectStatuses": "Seleccionar Estados",
|
||||
"selectFileTypes": "Seleccionar Tipos de Archivo",
|
||||
"selectLibraries": "Seleccionar Bibliotecas",
|
||||
"selectShelves": "Seleccionar Estantes",
|
||||
"selectGenres": "Seleccionar G\u00e9neros",
|
||||
"enterValues": "Ingrese valores (presione Enter)",
|
||||
"selectStatus": "Seleccionar Estado",
|
||||
"selectFileType": "Seleccionar Tipo de Archivo",
|
||||
"selectLibrary": "Seleccionar Biblioteca",
|
||||
"selectShelf": "Seleccionar Estante",
|
||||
"selectGenre": "Seleccionar G\u00e9nero"
|
||||
},
|
||||
"conditions": {
|
||||
"and": "Y",
|
||||
"or": "O"
|
||||
},
|
||||
"fields": {
|
||||
"library": "Biblioteca",
|
||||
"shelf": "Estante",
|
||||
"readStatus": "Estado de Lectura",
|
||||
"dateFinished": "Fecha de Finalizaci\u00f3n",
|
||||
"lastReadTime": "\u00daltima Lectura",
|
||||
"metadataScore": "Puntuaci\u00f3n de Metadatos",
|
||||
"title": "T\u00edtulo",
|
||||
"authors": "Autores",
|
||||
"categories": "Categor\u00edas",
|
||||
"moods": "Estados de \u00c1nimo",
|
||||
"tags": "Etiquetas",
|
||||
"publisher": "Editorial",
|
||||
"publishedDate": "Fecha de Publicaci\u00f3n",
|
||||
"personalRating": "Calificaci\u00f3n Personal",
|
||||
"pageCount": "N\u00famero de P\u00e1ginas",
|
||||
"language": "Idioma",
|
||||
"isbn13": "ISBN-13",
|
||||
"isbn10": "ISBN-10",
|
||||
"seriesName": "Nombre de la Serie",
|
||||
"seriesNumber": "N\u00famero de Serie",
|
||||
"seriesTotal": "Libros en la Serie",
|
||||
"fileSize": "Tama\u00f1o del Archivo (Kb)",
|
||||
"fileType": "Tipo de Archivo",
|
||||
"subtitle": "Subt\u00edtulo",
|
||||
"amazonRating": "Calificaci\u00f3n de Amazon",
|
||||
"amazonReviewCount": "Cantidad de Rese\u00f1as de Amazon",
|
||||
"goodreadsRating": "Calificaci\u00f3n de Goodreads",
|
||||
"goodreadsReviewCount": "Cantidad de Rese\u00f1as de Goodreads",
|
||||
"hardcoverRating": "Calificaci\u00f3n de Hardcover",
|
||||
"hardcoverReviewCount": "Cantidad de Rese\u00f1as de Hardcover",
|
||||
"ranobedbRating": "Calificaci\u00f3n de Ranobedb",
|
||||
"genre": "G\u00e9nero"
|
||||
},
|
||||
"operators": {
|
||||
"equals": "Igual",
|
||||
"notEqual": "\u2260 No Igual",
|
||||
"empty": "Vac\u00edo",
|
||||
"notEmpty": "No Vac\u00edo",
|
||||
"includesAny": "Incluye Alguno",
|
||||
"excludesAll": "Excluye Todos",
|
||||
"includesAll": "Incluye Todos",
|
||||
"contains": "Contiene",
|
||||
"doesNotContain": "No Contiene",
|
||||
"startsWith": "Comienza Con",
|
||||
"endsWith": "Termina Con",
|
||||
"greaterThan": "> Mayor Que",
|
||||
"greaterOrEqual": "\u2265 Mayor o Igual",
|
||||
"lessThan": "< Menor Que",
|
||||
"lessOrEqual": "\u2264 Menor o Igual",
|
||||
"between": "Entre"
|
||||
},
|
||||
"readStatuses": {
|
||||
"unread": "No Le\u00eddo",
|
||||
"reading": "Leyendo",
|
||||
"reReading": "Releyendo",
|
||||
"read": "Le\u00eddo",
|
||||
"partiallyRead": "Parcialmente Le\u00eddo",
|
||||
"paused": "Pausado",
|
||||
"wontRead": "No Leer\u00e9",
|
||||
"abandoned": "Abandonado",
|
||||
"unset": "Sin Establecer"
|
||||
},
|
||||
"toast": {
|
||||
"validationErrorSummary": "Error de Validaci\u00f3n",
|
||||
"validationErrorDetail": "Debe agregar al menos una regla v\u00e1lida antes de guardar.",
|
||||
"successSummary": "\u00c9xito",
|
||||
"successDetail": "Estante m\u00e1gico guardado exitosamente.",
|
||||
"errorSummary": "Error",
|
||||
"errorDetailDefault": "No se pudo guardar el estante m\u00e1gico."
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,7 @@
|
||||
"contentRatingAdult": "Adulto",
|
||||
"contentRatingExplicit": "Explícito",
|
||||
"ageRatingAllAges": "Todas las edades",
|
||||
"selectPlaceholder": "Seleccionar",
|
||||
"toast": {
|
||||
"successSummary": "Éxito",
|
||||
"metadataUpdated": "Metadatos del libro actualizados",
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"toolbar": {
|
||||
"switchToLightMode": "Cambiar a modo claro",
|
||||
"switchToDarkMode": "Cambiar a modo oscuro",
|
||||
"closePdfReader": "Cerrar lector PDF"
|
||||
},
|
||||
"toast": {
|
||||
"failedToLoadBook": "Error al cargar el libro"
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,21 @@
|
||||
"cancellationScheduledSummary": "Cancelación programada",
|
||||
"cancellationScheduledDetail": "La cancelación de la tarea se ha programado correctamente",
|
||||
"cancelFailedSummary": "Error al cancelar",
|
||||
"cancelFailedDetail": "No se pudo cancelar la tarea. Inténtalo de nuevo."
|
||||
"cancelFailedDetail": "No se pudo cancelar la tarea. Inténtalo de nuevo.",
|
||||
"taskTitle": "Tarea de obtención de metadatos",
|
||||
"tagReview": "Revisión",
|
||||
"tagAuto": "Auto",
|
||||
"bookProgress": "Libro <strong>{{ current }}</strong> de {{ total }}",
|
||||
"reviewBtn": "Revisar",
|
||||
"discardBtn": "Descartar",
|
||||
"dismissBtn": "Cerrar",
|
||||
"discardTooltip": "Conservar metadatos actuales, descartar los nuevos metadatos obtenidos",
|
||||
"cancelBtn": "Cancelar",
|
||||
"cancelTooltip": "Cancelar esta tarea",
|
||||
"statusInProgress": "En progreso",
|
||||
"statusCompleted": "Completado",
|
||||
"statusError": "Error",
|
||||
"statusCancelled": "Cancelado"
|
||||
},
|
||||
"reader": {
|
||||
"failedToLoadPages": "Error al cargar las páginas",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user