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 sideBarFilter = new SideBarFilter(this.selectedFilter, this.selectedFilterMode);
|
||||||
private headerFilter = new HeaderFilter(this.searchTerm$);
|
private headerFilter = new HeaderFilter(this.searchTerm$);
|
||||||
protected bookSorter = new BookSorter(
|
protected bookSorter = new BookSorter(
|
||||||
sortCriteria => this.onMultiSortChange(sortCriteria)
|
sortCriteria => this.onMultiSortChange(sortCriteria),
|
||||||
|
this.t
|
||||||
);
|
);
|
||||||
private sortService = inject(SortService);
|
private sortService = inject(SortService);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
<p-accordion-header>
|
<p-accordion-header>
|
||||||
<span class="filter-type-label">
|
<span class="filter-type-label">
|
||||||
<span class="filter-label-text">
|
<span class="filter-label-text">
|
||||||
{{ filterLabels[filterType] || (filterType | titlecase) }}
|
{{ getFilterLabel(filterType) }}
|
||||||
</span>
|
</span>
|
||||||
@if (activeFilters[filterType]?.length) {
|
@if (activeFilters[filterType]?.length) {
|
||||||
<span class="active-filter-count">
|
<span class="active-filter-count">
|
||||||
|
|||||||
+11
-5
@@ -5,16 +5,16 @@ import {Shelf} from '../../../model/shelf.model';
|
|||||||
import {EntityType} from '../book-browser.component';
|
import {EntityType} from '../book-browser.component';
|
||||||
import {Accordion, AccordionContent, AccordionHeader, AccordionPanel} from 'primeng/accordion';
|
import {Accordion, AccordionContent, AccordionHeader, AccordionPanel} from 'primeng/accordion';
|
||||||
import {CdkFixedSizeVirtualScroll, CdkVirtualForOf, CdkVirtualScrollViewport} from '@angular/cdk/scrolling';
|
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 {Badge} from 'primeng/badge';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {SelectButton} from 'primeng/selectbutton';
|
import {SelectButton} from 'primeng/selectbutton';
|
||||||
import {BookFilterMode, DEFAULT_VISIBLE_FILTERS, UserService, VisibleFilterType} from '../../../../settings/user-management/user.service';
|
import {BookFilterMode, DEFAULT_VISIBLE_FILTERS, UserService, VisibleFilterType} from '../../../../settings/user-management/user.service';
|
||||||
import {MagicShelf} from '../../../../magic-shelf/service/magic-shelf.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 {BookFilterService} from './book-filter.service';
|
||||||
import {filter} from 'rxjs/operators';
|
import {filter} from 'rxjs/operators';
|
||||||
import {TranslocoDirective} from '@jsverse/transloco';
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type FilterModeOption = { label: string; value: BookFilterMode };
|
type FilterModeOption = { label: string; value: BookFilterMode };
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ type FilterModeOption = { label: string; value: BookFilterMode };
|
|||||||
imports: [
|
imports: [
|
||||||
Accordion, AccordionPanel, AccordionHeader, AccordionContent,
|
Accordion, AccordionPanel, AccordionHeader, AccordionContent,
|
||||||
CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf,
|
CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf,
|
||||||
NgClass, Badge, AsyncPipe, TitleCasePipe, FormsModule, SelectButton,
|
NgClass, Badge, AsyncPipe, FormsModule, SelectButton,
|
||||||
TranslocoDirective
|
TranslocoDirective
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -42,6 +42,7 @@ export class BookFilterComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private readonly filterService = inject(BookFilterService);
|
private readonly filterService = inject(BookFilterService);
|
||||||
private readonly userService = inject(UserService);
|
private readonly userService = inject(UserService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
private readonly activeFilters$ = new BehaviorSubject<Record<string, unknown[]> | null>(null);
|
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 _selectedFilterMode: BookFilterMode = 'and';
|
||||||
private _visibleFilters: VisibleFilterType[] = [...DEFAULT_VISIBLE_FILTERS];
|
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[] = [
|
readonly filterModeOptions: FilterModeOption[] = [
|
||||||
{label: 'AND', value: 'and'},
|
{label: 'AND', value: 'and'},
|
||||||
{label: 'OR', value: 'or'},
|
{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'>>> = {
|
export const FILTER_CONFIGS: Readonly<Record<Exclude<FilterType, 'library'>, Omit<FilterConfig, 'extractor'>>> = {
|
||||||
author: {label: 'Author', sortMode: 'count'},
|
author: {label: 'Author', sortMode: 'count'},
|
||||||
category: {label: 'Genre', 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 metadataCenterViewMode: 'route' | 'dialog' = 'route';
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
readonly allColumns = [
|
readonly allColumns: { field: string; header: string }[] = [
|
||||||
{field: 'readStatus', header: '📖'},
|
{field: 'readStatus', header: this.t.translate('book.columnPref.columns.readStatus')},
|
||||||
{field: 'title', header: 'Title'},
|
{field: 'title', header: this.t.translate('book.columnPref.columns.title')},
|
||||||
{field: 'authors', header: 'Authors'},
|
{field: 'authors', header: this.t.translate('book.columnPref.columns.authors')},
|
||||||
{field: 'publisher', header: 'Publisher'},
|
{field: 'publisher', header: this.t.translate('book.columnPref.columns.publisher')},
|
||||||
{field: 'seriesName', header: 'Series'},
|
{field: 'seriesName', header: this.t.translate('book.columnPref.columns.seriesName')},
|
||||||
{field: 'seriesNumber', header: 'Series #'},
|
{field: 'seriesNumber', header: this.t.translate('book.columnPref.columns.seriesNumber')},
|
||||||
{field: 'categories', header: 'Genres'},
|
{field: 'categories', header: this.t.translate('book.columnPref.columns.categories')},
|
||||||
{field: 'publishedDate', header: 'Published'},
|
{field: 'publishedDate', header: this.t.translate('book.columnPref.columns.publishedDate')},
|
||||||
{field: 'lastReadTime', header: 'Last Read'},
|
{field: 'lastReadTime', header: this.t.translate('book.columnPref.columns.lastReadTime')},
|
||||||
{field: 'addedOn', header: 'Added'},
|
{field: 'addedOn', header: this.t.translate('book.columnPref.columns.addedOn')},
|
||||||
{field: 'fileName', header: 'File Name'},
|
{field: 'fileName', header: this.t.translate('book.columnPref.columns.fileName')},
|
||||||
{field: 'fileSizeKb', header: 'File Size'},
|
{field: 'fileSizeKb', header: this.t.translate('book.columnPref.columns.fileSizeKb')},
|
||||||
{field: 'language', header: 'Language'},
|
{field: 'language', header: this.t.translate('book.columnPref.columns.language')},
|
||||||
{field: 'isbn', header: 'ISBN'},
|
{field: 'isbn', header: this.t.translate('book.columnPref.columns.isbn')},
|
||||||
{field: 'pageCount', header: 'Pages'},
|
{field: 'pageCount', header: this.t.translate('book.columnPref.columns.pageCount')},
|
||||||
{field: 'amazonRating', header: 'Amazon'},
|
{field: 'amazonRating', header: this.t.translate('book.columnPref.columns.amazonRating')},
|
||||||
{field: 'amazonReviewCount', header: 'AZ #'},
|
{field: 'amazonReviewCount', header: this.t.translate('book.columnPref.columns.amazonReviewCount')},
|
||||||
{field: 'goodreadsRating', header: 'Goodreads'},
|
{field: 'goodreadsRating', header: this.t.translate('book.columnPref.columns.goodreadsRating')},
|
||||||
{field: 'goodreadsReviewCount', header: 'GR #'},
|
{field: 'goodreadsReviewCount', header: this.t.translate('book.columnPref.columns.goodreadsReviewCount')},
|
||||||
{field: 'hardcoverRating', header: 'Hardcover'},
|
{field: 'hardcoverRating', header: this.t.translate('book.columnPref.columns.hardcoverRating')},
|
||||||
{field: 'hardcoverReviewCount', header: 'HC #'},
|
{field: 'hardcoverReviewCount', header: this.t.translate('book.columnPref.columns.hardcoverReviewCount')},
|
||||||
{field: 'ranobedbRating', header: 'Ranobedb'},
|
{field: 'ranobedbRating', header: this.t.translate('book.columnPref.columns.ranobedbRating')},
|
||||||
];
|
];
|
||||||
|
|
||||||
scrollHeight = 'calc(100dvh - 160px)';
|
scrollHeight = 'calc(100dvh - 160px)';
|
||||||
|
|||||||
@@ -1,41 +1,80 @@
|
|||||||
import {SortDirection, SortOption} from '../../../model/sort.model';
|
import {SortDirection, SortOption} from '../../../model/sort.model';
|
||||||
import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
|
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 {
|
export class BookSorter {
|
||||||
selectedSortCriteria: SortOption[] = [];
|
selectedSortCriteria: SortOption[] = [];
|
||||||
|
|
||||||
sortOptions: 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},
|
|
||||||
];
|
|
||||||
|
|
||||||
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
|
// 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}),
|
message: this.t.translate('book.browser.confirm.regenCoverMessage', {count}),
|
||||||
header: this.t.translate('book.browser.confirm.regenCoverHeader'),
|
header: this.t.translate('book.browser.confirm.regenCoverHeader'),
|
||||||
icon: 'pi pi-image',
|
icon: 'pi pi-image',
|
||||||
acceptLabel: 'Yes',
|
acceptLabel: this.t.translate('common.yes'),
|
||||||
rejectLabel: 'No',
|
rejectLabel: this.t.translate('common.no'),
|
||||||
acceptButtonProps: {
|
acceptButtonProps: {
|
||||||
label: this.t.translate('common.yes'),
|
label: this.t.translate('common.yes'),
|
||||||
severity: 'success'
|
severity: 'success'
|
||||||
@@ -483,8 +483,8 @@ export class SeriesPageComponent implements OnDestroy {
|
|||||||
message: this.t.translate('book.browser.confirm.customCoverMessage', {count}),
|
message: this.t.translate('book.browser.confirm.customCoverMessage', {count}),
|
||||||
header: this.t.translate('book.browser.confirm.customCoverHeader'),
|
header: this.t.translate('book.browser.confirm.customCoverHeader'),
|
||||||
icon: 'pi pi-palette',
|
icon: 'pi pi-palette',
|
||||||
acceptLabel: 'Yes',
|
acceptLabel: this.t.translate('common.yes'),
|
||||||
rejectLabel: 'No',
|
rejectLabel: this.t.translate('common.no'),
|
||||||
acceptButtonProps: {
|
acceptButtonProps: {
|
||||||
label: this.t.translate('common.yes'),
|
label: this.t.translate('common.yes'),
|
||||||
severity: 'success'
|
severity: 'success'
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ export class BookMenuService {
|
|||||||
|
|
||||||
if (allShelfIds.size === 0) {
|
if (allShelfIds.size === 0) {
|
||||||
this.loadingService.hide(loader);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'magicShelf'">
|
||||||
<div class="magic-shelf-container">
|
<div class="magic-shelf-container">
|
||||||
<div class="panel-header">
|
<div class="panel-header">
|
||||||
<div class="header-icon-wrapper">
|
<div class="header-icon-wrapper">
|
||||||
@@ -5,9 +6,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="header-text">
|
<div class="header-text">
|
||||||
<h2 class="panel-title">
|
<h2 class="panel-title">
|
||||||
{{ editMode ? 'Edit Magic Shelf' : 'Magic Shelf Builder' }}
|
{{ editMode ? t('header.titleEdit') : t('header.titleCreate') }}
|
||||||
</h2>
|
</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>
|
</div>
|
||||||
<p-button
|
<p-button
|
||||||
icon="pi pi-times"
|
icon="pi pi-times"
|
||||||
@@ -23,12 +24,12 @@
|
|||||||
<fieldset [disabled]="form.get('isPublic')?.value && !isAdmin">
|
<fieldset [disabled]="form.get('isPublic')?.value && !isAdmin">
|
||||||
<div class="form-header">
|
<div class="form-header">
|
||||||
<div class="form-field">
|
<div class="form-field">
|
||||||
<label for="shelfName">Magic Shelf Name</label>
|
<label for="shelfName">{{ t('form.shelfName') }}</label>
|
||||||
<input pInputText id="shelfName" type="text" formControlName="name" placeholder="E.g. Rom-Zom-Coms, Fast & Furious, Missing Metadata"/>
|
<input pInputText id="shelfName" type="text" formControlName="name" [placeholder]="t('form.namePlaceholder')"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon-picker-section">
|
<div class="icon-picker-section">
|
||||||
<div class="icon-picker-wrapper">
|
<div class="icon-picker-wrapper">
|
||||||
<label>Shelf Icon</label>
|
<label>{{ t('form.shelfIcon') }}</label>
|
||||||
@if (selectedIcon) {
|
@if (selectedIcon) {
|
||||||
<div class="selected-icon-display">
|
<div class="selected-icon-display">
|
||||||
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
iconClass="selected-icon"
|
iconClass="selected-icon"
|
||||||
alt="Selected shelf icon">
|
alt="Selected shelf icon">
|
||||||
</app-icon-display>
|
</app-icon-display>
|
||||||
<span class="icon-label">Click to change</span>
|
<span class="icon-label">{{ t('form.clickToChange') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<p-button
|
<p-button
|
||||||
icon="pi pi-times"
|
icon="pi pi-times"
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
[rounded]="true"
|
[rounded]="true"
|
||||||
size="small"
|
size="small"
|
||||||
(onClick)="clearSelectedIcon()"
|
(onClick)="clearSelectedIcon()"
|
||||||
pTooltip="Remove icon"
|
[pTooltip]="t('form.removeIcon')"
|
||||||
tooltipPosition="left"
|
tooltipPosition="left"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -55,7 +56,7 @@
|
|||||||
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
<div class="icon-display-container" (click)="openIconPicker()" (keydown.enter)="openIconPicker()" tabindex="0" role="button">
|
||||||
<div class="icon-placeholder">
|
<div class="icon-placeholder">
|
||||||
<i class="pi pi-plus"></i>
|
<i class="pi pi-plus"></i>
|
||||||
<span>Select Icon</span>
|
<span>{{ t('form.selectIcon') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@
|
|||||||
<div class="public-checkbox-section">
|
<div class="public-checkbox-section">
|
||||||
<div class="checkbox-wrapper">
|
<div class="checkbox-wrapper">
|
||||||
<p-checkbox formControlName="isPublic" [binary]="true" inputId="isPublic" (onChange)="onIsPublicChange($event)"></p-checkbox>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -80,13 +81,13 @@
|
|||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
<div class="footer-actions">
|
<div class="footer-actions">
|
||||||
<p-button
|
<p-button
|
||||||
label="Cancel"
|
[label]="t('actions.cancel')"
|
||||||
severity="secondary"
|
severity="secondary"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
(onClick)="cancel()"
|
(onClick)="cancel()"
|
||||||
/>
|
/>
|
||||||
<p-button
|
<p-button
|
||||||
label="Save Filter"
|
[label]="t('actions.saveFilter')"
|
||||||
icon="pi pi-save"
|
icon="pi pi-save"
|
||||||
severity="success"
|
severity="success"
|
||||||
(onClick)="submit()"
|
(onClick)="submit()"
|
||||||
@@ -98,10 +99,10 @@
|
|||||||
<ng-template #groupTemplate let-group="group">
|
<ng-template #groupTemplate let-group="group">
|
||||||
<div class="group-container" [formGroup]="group">
|
<div class="group-container" [formGroup]="group">
|
||||||
<div class="group-header">
|
<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-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-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="Add Group" 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) {
|
@if (group.parent) {
|
||||||
<p-button icon="pi pi-trash" text (click)="deleteGroup(group)" severity="danger"></p-button>
|
<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 *ngTemplateOutlet="groupTemplate; context: { group: ruleCtrl }"></ng-container>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
} @else {
|
} @else {
|
||||||
<p-select [options]="fieldOptions" formControlName="field" (onChange)="onFieldChange(ruleCtrl)" placeholder="Field" appendTo="body" class="field-select"/>
|
<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="Operator" class="operator-select" (onChange)="onOperatorChange(ruleCtrl)"/>
|
<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 (!['is_empty', 'is_not_empty'].includes(ruleCtrl.get('operator')?.value)) {
|
||||||
@if (ruleCtrl.get('operator')?.value === 'in_between') {
|
@if (ruleCtrl.get('operator')?.value === 'in_between') {
|
||||||
@if (ruleCtrl.get('field')?.value === 'publishedDate') {
|
@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('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="End Year" 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') {
|
} @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('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="End Date" 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') {
|
} @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('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="End Value" [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') {
|
} @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('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="End 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]="t('placeholders.endValue')" [showButtons]="true"></p-inputNumber>
|
||||||
} @else {
|
} @else {
|
||||||
<input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" placeholder="Start Value"/>
|
<input pInputText [formControl]="ruleCtrl.get('valueStart')" class="value-input" [placeholder]="t('placeholders.startValue')"/>
|
||||||
<input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" placeholder="End Value"/>
|
<input pInputText [formControl]="ruleCtrl.get('valueEnd')" class="value-input" [placeholder]="t('placeholders.endValue')"/>
|
||||||
}
|
}
|
||||||
} @else {
|
} @else {
|
||||||
@if (ruleCtrl.get('field')?.value === 'publishedDate') {
|
@if (ruleCtrl.get('field')?.value === 'publishedDate') {
|
||||||
@@ -142,37 +143,37 @@
|
|||||||
} @else if (ruleCtrl.get('field')?.value === 'dateFinished') {
|
} @else if (ruleCtrl.get('field')?.value === 'dateFinished') {
|
||||||
<p-datepicker formControlName="value" dateFormat="dd-M-yy" appendTo="body" fluid class="value-input"></p-datepicker>
|
<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') {
|
} @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') {
|
} @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)) {
|
} @else if (['includes_any', 'includes_all', 'excludes_all'].includes(ruleCtrl.get('operator')?.value)) {
|
||||||
@if (ruleCtrl.get('field')?.value === 'readStatus') {
|
@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') {
|
} @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') {
|
} @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') {
|
} @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') {
|
} @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 {
|
} @else {
|
||||||
<div class="autocomplete-wrapper">
|
<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>
|
</div>
|
||||||
}
|
}
|
||||||
} @else if (ruleCtrl.get('field')?.value === 'readStatus') {
|
} @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') {
|
} @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') {
|
} @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') {
|
} @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') {
|
} @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 {
|
} @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>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import {Tooltip} from 'primeng/tooltip';
|
|||||||
import {BookService} from '../../book/service/book.service';
|
import {BookService} from '../../book/service/book.service';
|
||||||
import {ShelfService} from '../../book/service/shelf.service';
|
import {ShelfService} from '../../book/service/shelf.service';
|
||||||
import {Shelf} from '../../book/model/shelf.model';
|
import {Shelf} from '../../book/model/shelf.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
export type RuleOperator =
|
export type RuleOperator =
|
||||||
| 'equals'
|
| 'equals'
|
||||||
@@ -119,37 +120,49 @@ export type GroupFormGroup = FormGroup<{
|
|||||||
}>;
|
}>;
|
||||||
|
|
||||||
const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
||||||
library: {label: 'Library'},
|
library: {label: 'library'},
|
||||||
shelf: {label: 'Shelf'},
|
shelf: {label: 'shelf'},
|
||||||
readStatus: {label: 'Read Status'},
|
readStatus: {label: 'readStatus'},
|
||||||
dateFinished: {label: 'Date Finished', type: 'date'},
|
dateFinished: {label: 'dateFinished', type: 'date'},
|
||||||
lastReadTime: {label: 'Last Read Time', type: 'date'},
|
lastReadTime: {label: 'lastReadTime', type: 'date'},
|
||||||
metadataScore: {label: 'Metadata Score', type: 'decimal', max: 100},
|
metadataScore: {label: 'metadataScore', type: 'decimal', max: 100},
|
||||||
title: {label: 'Title'},
|
title: {label: 'title'},
|
||||||
authors: {label: 'Authors'},
|
authors: {label: 'authors'},
|
||||||
categories: {label: 'Categories'},
|
categories: {label: 'categories'},
|
||||||
moods: {label: 'Moods'},
|
moods: {label: 'moods'},
|
||||||
tags: {label: 'Tags'},
|
tags: {label: 'tags'},
|
||||||
publisher: {label: 'Publisher'},
|
publisher: {label: 'publisher'},
|
||||||
publishedDate: {label: 'Published Date', type: 'date'},
|
publishedDate: {label: 'publishedDate', type: 'date'},
|
||||||
personalRating: {label: 'Personal Rating', type: 'decimal', max: 10},
|
personalRating: {label: 'personalRating', type: 'decimal', max: 10},
|
||||||
pageCount: {label: 'Page Count', type: 'number'},
|
pageCount: {label: 'pageCount', type: 'number'},
|
||||||
language: {label: 'Language'},
|
language: {label: 'language'},
|
||||||
isbn13: {label: 'ISBN-13'},
|
isbn13: {label: 'isbn13'},
|
||||||
isbn10: {label: 'ISBN-10'},
|
isbn10: {label: 'isbn10'},
|
||||||
seriesName: {label: 'Series Name'},
|
seriesName: {label: 'seriesName'},
|
||||||
seriesNumber: {label: 'Series Number', type: 'number'},
|
seriesNumber: {label: 'seriesNumber', type: 'number'},
|
||||||
seriesTotal: {label: 'Books in Series', type: 'number'},
|
seriesTotal: {label: 'seriesTotal', type: 'number'},
|
||||||
fileSize: {label: 'File Size (Kb)', type: 'number'},
|
fileSize: {label: 'fileSize', type: 'number'},
|
||||||
fileType: {label: 'File Type'},
|
fileType: {label: 'fileType'},
|
||||||
subtitle: {label: 'Subtitle'},
|
subtitle: {label: 'subtitle'},
|
||||||
amazonRating: {label: 'Amazon Rating', type: 'decimal', max: 5},
|
amazonRating: {label: 'amazonRating', type: 'decimal', max: 5},
|
||||||
amazonReviewCount: {label: 'Amazon Review Count', type: 'number'},
|
amazonReviewCount: {label: 'amazonReviewCount', type: 'number'},
|
||||||
goodreadsRating: {label: 'Goodreads Rating', type: 'decimal', max: 5},
|
goodreadsRating: {label: 'goodreadsRating', type: 'decimal', max: 5},
|
||||||
goodreadsReviewCount: {label: 'Goodreads Review Count', type: 'number'},
|
goodreadsReviewCount: {label: 'goodreadsReviewCount', type: 'number'},
|
||||||
hardcoverRating: {label: 'Hardcover Rating', type: 'decimal', max: 5},
|
hardcoverRating: {label: 'hardcoverRating', type: 'decimal', max: 5},
|
||||||
hardcoverReviewCount: {label: 'Hardcover Review Count', type: 'number'},
|
hardcoverReviewCount: {label: 'hardcoverReviewCount', type: 'number'},
|
||||||
ranobedbRating: {label: 'Ranobedb Rating', type: 'decimal', max: 5}
|
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({
|
@Component({
|
||||||
@@ -169,30 +182,36 @@ const FIELD_CONFIGS: Record<RuleField, FullFieldConfig> = {
|
|||||||
AutoComplete,
|
AutoComplete,
|
||||||
CheckboxModule,
|
CheckboxModule,
|
||||||
IconDisplayComponent,
|
IconDisplayComponent,
|
||||||
Tooltip
|
Tooltip,
|
||||||
|
TranslocoDirective
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MagicShelfComponent implements OnInit {
|
export class MagicShelfComponent implements OnInit {
|
||||||
|
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
|
|
||||||
numericFieldConfigMap = new Map<RuleField, FieldConfig>(
|
numericFieldConfigMap = new Map<RuleField, FieldConfig>(
|
||||||
Object.entries(FIELD_CONFIGS)
|
Object.entries(FIELD_CONFIGS)
|
||||||
.filter(([_, config]) => config.type)
|
.filter(([_, config]) => config.type)
|
||||||
.map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}])
|
.map(([key, config]) => [key as RuleField, {type: config.type!, max: config.max}])
|
||||||
);
|
);
|
||||||
|
|
||||||
conditionOptions: { label: string; value: 'and' | 'or' }[] = [
|
get conditionOptions(): { label: string; value: 'and' | 'or' }[] {
|
||||||
{label: 'AND', value: 'and'},
|
return [
|
||||||
{label: 'OR', value: 'or'},
|
{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]) => {
|
get fieldOptions() {
|
||||||
// Use "Genre" instead of "Categories" for user-facing label
|
return Object.entries(FIELD_CONFIGS).map(([key, config]) => {
|
||||||
const label = key === 'categories' ? 'Genre' : config.label;
|
const translationKey = key === 'categories' ? 'genre' : config.label;
|
||||||
return {
|
return {
|
||||||
label: label,
|
label: this.t.translate(`magicShelf.fields.${translationKey}`),
|
||||||
value: key as RuleField
|
value: key as RuleField
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
fileType: { label: string; value: string }[] = [
|
fileType: { label: string; value: string }[] = [
|
||||||
{label: 'PDF', value: 'pdf'},
|
{label: 'PDF', value: 'pdf'},
|
||||||
@@ -205,10 +224,12 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
{label: 'AZW3', value: 'azw3'}
|
{label: 'AZW3', value: 'azw3'}
|
||||||
];
|
];
|
||||||
|
|
||||||
readStatusOptions = Object.entries(ReadStatus).map(([key, value]) => ({
|
get readStatusOptions() {
|
||||||
label: key.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, l => l.toUpperCase()),
|
return Object.entries(ReadStatus).map(([key, value]) => ({
|
||||||
value
|
label: this.t.translate(`magicShelf.readStatuses.${READ_STATUS_KEYS[key]}`),
|
||||||
}));
|
value
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
libraries: Library[] = [];
|
libraries: Library[] = [];
|
||||||
libraryOptions: { label: string; value: number }[] = [];
|
libraryOptions: { label: string; value: number }[] = [];
|
||||||
@@ -343,31 +364,31 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
|
|
||||||
getOperatorOptionsForField(field: RuleField | null | undefined) {
|
getOperatorOptionsForField(field: RuleField | null | undefined) {
|
||||||
const baseOperators = [
|
const baseOperators = [
|
||||||
{label: 'Equals', value: 'equals'},
|
{label: this.t.translate('magicShelf.operators.equals'), value: 'equals'},
|
||||||
{label: '≠ Not Equal', value: 'not_equals'},
|
{label: this.t.translate('magicShelf.operators.notEqual'), value: 'not_equals'},
|
||||||
{label: 'Empty', value: 'is_empty'},
|
{label: this.t.translate('magicShelf.operators.empty'), value: 'is_empty'},
|
||||||
{label: 'Not Empty', value: 'is_not_empty'},
|
{label: this.t.translate('magicShelf.operators.notEmpty'), value: 'is_not_empty'},
|
||||||
];
|
];
|
||||||
|
|
||||||
const multiValueOperators = [
|
const multiValueOperators = [
|
||||||
{label: 'Includes Any', value: 'includes_any'},
|
{label: this.t.translate('magicShelf.operators.includesAny'), value: 'includes_any'},
|
||||||
{label: 'Excludes All', value: 'excludes_all'},
|
{label: this.t.translate('magicShelf.operators.excludesAll'), value: 'excludes_all'},
|
||||||
{label: 'Includes All', value: 'includes_all'},
|
{label: this.t.translate('magicShelf.operators.includesAll'), value: 'includes_all'},
|
||||||
];
|
];
|
||||||
|
|
||||||
const textOperators = [
|
const textOperators = [
|
||||||
{label: 'Contains', value: 'contains'},
|
{label: this.t.translate('magicShelf.operators.contains'), value: 'contains'},
|
||||||
{label: 'Doesn\'t Contain', value: 'does_not_contain'},
|
{label: this.t.translate('magicShelf.operators.doesNotContain'), value: 'does_not_contain'},
|
||||||
{label: 'Starts With', value: 'starts_with'},
|
{label: this.t.translate('magicShelf.operators.startsWith'), value: 'starts_with'},
|
||||||
{label: 'Ends With', value: 'ends_with'},
|
{label: this.t.translate('magicShelf.operators.endsWith'), value: 'ends_with'},
|
||||||
];
|
];
|
||||||
|
|
||||||
const comparisonOperators = [
|
const comparisonOperators = [
|
||||||
{label: '> Greater Than', value: 'greater_than'},
|
{label: this.t.translate('magicShelf.operators.greaterThan'), value: 'greater_than'},
|
||||||
{label: '≥ Greater or Equal', value: 'greater_than_equal_to'},
|
{label: this.t.translate('magicShelf.operators.greaterOrEqual'), value: 'greater_than_equal_to'},
|
||||||
{label: '< Less Than', value: 'less_than'},
|
{label: this.t.translate('magicShelf.operators.lessThan'), value: 'less_than'},
|
||||||
{label: '≤ Less or Equal', value: 'less_than_equal_to'},
|
{label: this.t.translate('magicShelf.operators.lessOrEqual'), value: 'less_than_equal_to'},
|
||||||
{label: 'Between', value: 'in_between'},
|
{label: this.t.translate('magicShelf.operators.between'), value: 'in_between'},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!field) return [...baseOperators, ...multiValueOperators];
|
if (!field) return [...baseOperators, ...multiValueOperators];
|
||||||
@@ -525,7 +546,7 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
if (!this.hasAtLeastOneValidRule(this.group)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +562,7 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
group: cleanedGroup
|
group: cleanedGroup
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: (savedShelf) => {
|
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) {
|
if (savedShelf?.id) {
|
||||||
this.shelfId = savedShelf.id;
|
this.shelfId = savedShelf.id;
|
||||||
this.form.patchValue({
|
this.form.patchValue({
|
||||||
@@ -554,8 +575,8 @@ export class MagicShelfComponent implements OnInit {
|
|||||||
error: (err) => {
|
error: (err) => {
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'error',
|
severity: 'error',
|
||||||
summary: 'Error',
|
summary: this.t.translate('magicShelf.toast.errorSummary'),
|
||||||
detail: err?.error?.message || 'Failed to save magic shelf.'
|
detail: err?.error?.message || this.t.translate('magicShelf.toast.errorDetailDefault')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -452,7 +452,7 @@
|
|||||||
[options]="ageRatingOptions"
|
[options]="ageRatingOptions"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select"
|
[placeholder]="t('selectPlaceholder')"
|
||||||
[showClear]="true"
|
[showClear]="true"
|
||||||
appendTo="body">
|
appendTo="body">
|
||||||
</p-select>
|
</p-select>
|
||||||
@@ -473,7 +473,7 @@
|
|||||||
[options]="contentRatingOptions"
|
[options]="contentRatingOptions"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select"
|
[placeholder]="t('selectPlaceholder')"
|
||||||
[showClear]="true"
|
[showClear]="true"
|
||||||
appendTo="body">
|
appendTo="body">
|
||||||
</p-select>
|
</p-select>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
<pdf-text-editor></pdf-text-editor>
|
<pdf-text-editor></pdf-text-editor>
|
||||||
<pdf-draw-editor></pdf-draw-editor>
|
<pdf-draw-editor></pdf-draw-editor>
|
||||||
<div class="verticalToolbarSeparator"></div>
|
<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) {
|
@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">
|
<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"/>
|
<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>
|
</svg>
|
||||||
}
|
}
|
||||||
</button>
|
</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">
|
<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"/>
|
<path d="M18 6 6 18"/><path d="m6 6 12 12"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ import {PdfAnnotationService} from '../../../shared/service/pdf-annotation.servi
|
|||||||
|
|
||||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||||
import {MessageService} from 'primeng/api';
|
import {MessageService} from 'primeng/api';
|
||||||
|
import {TranslocoService, TranslocoPipe} from '@jsverse/transloco';
|
||||||
import {ReadingSessionService} from '../../../shared/service/reading-session.service';
|
import {ReadingSessionService} from '../../../shared/service/reading-session.service';
|
||||||
import {Location} from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pdf-reader',
|
selector: 'app-pdf-reader',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [NgxExtendedPdfViewerModule, ProgressSpinner],
|
imports: [NgxExtendedPdfViewerModule, ProgressSpinner, TranslocoPipe],
|
||||||
templateUrl: './pdf-reader.component.html',
|
templateUrl: './pdf-reader.component.html',
|
||||||
styleUrl: './pdf-reader.component.scss',
|
styleUrl: './pdf-reader.component.scss',
|
||||||
})
|
})
|
||||||
@@ -59,6 +60,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
private location = inject(Location);
|
private location = inject(Location);
|
||||||
private pdfViewerService = inject(NgxExtendedPdfViewerService);
|
private pdfViewerService = inject(NgxExtendedPdfViewerService);
|
||||||
private pdfAnnotationService = inject(PdfAnnotationService);
|
private pdfAnnotationService = inject(PdfAnnotationService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.annotationSaveSubscription = this.annotationSaveSubject
|
this.annotationSaveSubscription = this.annotationSaveSubject
|
||||||
@@ -101,7 +103,7 @@ export class PdfReaderComponent implements OnInit, OnDestroy {
|
|||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
error: () => {
|
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;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export class CustomFontsComponent implements OnInit {
|
|||||||
this.customFonts = this.customFonts.filter(f => f.id !== font.id);
|
this.customFonts = this.customFonts.filter(f => f.id !== font.id);
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'success',
|
severity: 'success',
|
||||||
summary: 'Success',
|
summary: this.t.translate('common.success'),
|
||||||
detail: this.t.translate('settingsReader.fonts.deleteSuccess', {name: font.fontName})
|
detail: this.t.translate('settingsReader.fonts.deleteSuccess', {name: font.fontName})
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -203,6 +203,16 @@ export const DEFAULT_VISIBLE_FILTERS: VisibleFilterType[] = [
|
|||||||
'matchScore', 'publisher', 'publishedDate', 'fileSize'
|
'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 }[] = [
|
export const ALL_FILTER_OPTIONS: { label: string; value: VisibleFilterType }[] = [
|
||||||
{label: 'Author', value: 'author'},
|
{label: 'Author', value: 'author'},
|
||||||
{label: 'Genre', value: 'category'},
|
{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) {
|
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;
|
this.isEditing = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-3
@@ -1,6 +1,7 @@
|
|||||||
import {Component, ElementRef, inject, OnDestroy, OnInit, viewChild} from '@angular/core';
|
import {Component, ElementRef, inject, OnDestroy, OnInit, viewChild} from '@angular/core';
|
||||||
import {Select} from 'primeng/select';
|
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 {MessageService} from 'primeng/api';
|
||||||
import {Observable, Subject} from 'rxjs';
|
import {Observable, Subject} from 'rxjs';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
@@ -100,11 +101,14 @@ export class FilterPreferencesComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
get availableFilters(): {label: string; value: string}[] {
|
get availableFilters(): {label: string; value: string}[] {
|
||||||
const used = new Set(this.selectedVisibleFilters);
|
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 {
|
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 {
|
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="author-universe-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-globe author-title-icon"></i>
|
<i class="pi pi-globe author-title-icon"></i>
|
||||||
Author Universe
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Explore your authors by books, ratings, and reading progress</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (totalAuthors > 0) {
|
@if (totalAuthors > 0) {
|
||||||
<div class="author-count-badge">
|
<div class="author-count-badge">
|
||||||
{{ totalAuthors }} authors
|
{{ t('authorsBadge', { count: totalAuthors }) }}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -18,7 +19,7 @@
|
|||||||
<div class="chart-legend-info">
|
<div class="chart-legend-info">
|
||||||
<span class="legend-note">
|
<span class="legend-note">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
Bubble size = total pages • Position = books vs rating • Color = completion %
|
{{ t('legendNote') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -47,7 +48,8 @@
|
|||||||
@if (totalAuthors === 0) {
|
@if (totalAuthors === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<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>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface AuthorStats {
|
interface AuthorStats {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -41,13 +42,14 @@ const COMPLETION_COLORS = {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-author-universe-chart',
|
selector: 'app-author-universe-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './author-universe-chart.component.html',
|
templateUrl: './author-universe-chart.component.html',
|
||||||
styleUrls: ['./author-universe-chart.component.scss']
|
styleUrls: ['./author-universe-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'bubble' as const;
|
public readonly chartType = 'bubble' as const;
|
||||||
@@ -104,7 +106,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Books in Library',
|
text: this.t.translate('statsLibrary.authorUniverse.axisBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -130,7 +132,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
y: {
|
y: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Average Rating',
|
text: this.t.translate('statsLibrary.authorUniverse.axisRating'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -349,7 +351,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (highCompletion.length > 0) {
|
if (highCompletion.length > 0) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: '75-100% Read',
|
label: this.t.translate('statsLibrary.authorUniverse.legend75to100'),
|
||||||
data: highCompletion,
|
data: highCompletion,
|
||||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.high, 0.6),
|
backgroundColor: this.hexToRgba(COMPLETION_COLORS.high, 0.6),
|
||||||
borderColor: COMPLETION_COLORS.high,
|
borderColor: COMPLETION_COLORS.high,
|
||||||
@@ -361,7 +363,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (mediumCompletion.length > 0) {
|
if (mediumCompletion.length > 0) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: '50-74% Read',
|
label: this.t.translate('statsLibrary.authorUniverse.legend50to74'),
|
||||||
data: mediumCompletion,
|
data: mediumCompletion,
|
||||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.medium, 0.6),
|
backgroundColor: this.hexToRgba(COMPLETION_COLORS.medium, 0.6),
|
||||||
borderColor: COMPLETION_COLORS.medium,
|
borderColor: COMPLETION_COLORS.medium,
|
||||||
@@ -373,7 +375,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (lowCompletion.length > 0) {
|
if (lowCompletion.length > 0) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: '25-49% Read',
|
label: this.t.translate('statsLibrary.authorUniverse.legend25to49'),
|
||||||
data: lowCompletion,
|
data: lowCompletion,
|
||||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.low, 0.6),
|
backgroundColor: this.hexToRgba(COMPLETION_COLORS.low, 0.6),
|
||||||
borderColor: COMPLETION_COLORS.low,
|
borderColor: COMPLETION_COLORS.low,
|
||||||
@@ -385,7 +387,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (minimalCompletion.length > 0) {
|
if (minimalCompletion.length > 0) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: '1-24% Read',
|
label: this.t.translate('statsLibrary.authorUniverse.legend1to24'),
|
||||||
data: minimalCompletion,
|
data: minimalCompletion,
|
||||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.minimal, 0.6),
|
backgroundColor: this.hexToRgba(COMPLETION_COLORS.minimal, 0.6),
|
||||||
borderColor: COMPLETION_COLORS.minimal,
|
borderColor: COMPLETION_COLORS.minimal,
|
||||||
@@ -397,7 +399,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
if (unread.length > 0) {
|
if (unread.length > 0) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: 'Unread',
|
label: this.t.translate('statsLibrary.authorUniverse.legendUnread'),
|
||||||
data: unread,
|
data: unread,
|
||||||
backgroundColor: this.hexToRgba(COMPLETION_COLORS.unread, 0.6),
|
backgroundColor: this.hexToRgba(COMPLETION_COLORS.unread, 0.6),
|
||||||
borderColor: COMPLETION_COLORS.unread,
|
borderColor: COMPLETION_COLORS.unread,
|
||||||
@@ -421,20 +423,20 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
// Most prolific author
|
// Most prolific author
|
||||||
const mostProlific = authorStats[0];
|
const mostProlific = authorStats[0];
|
||||||
if (mostProlific) {
|
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)
|
// Highest rated author (with at least 2 books)
|
||||||
const ratedAuthors = authorStats.filter(a => a.avgRating > 0);
|
const ratedAuthors = authorStats.filter(a => a.avgRating > 0);
|
||||||
if (ratedAuthors.length > 0) {
|
if (ratedAuthors.length > 0) {
|
||||||
const highestRated = ratedAuthors.reduce((a, b) => a.avgRating > b.avgRating ? a : b);
|
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
|
// Most pages by author
|
||||||
const mostPages = authorStats.reduce((a, b) => a.totalPages > b.totalPages ? a : b);
|
const mostPages = authorStats.reduce((a, b) => a.totalPages > b.totalPages ? a : b);
|
||||||
if (mostPages.totalPages > 0) {
|
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)
|
// Best completion rate (with at least 3 books)
|
||||||
@@ -444,7 +446,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
a.completionRate > b.completionRate ? a : b
|
a.completionRate > b.completionRate ? a : b
|
||||||
);
|
);
|
||||||
if (bestCompletion.completionRate > 0) {
|
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);
|
const hiddenGems = ratedAuthors.filter(a => a.bookCount <= 3 && a.avgRating >= 4.0);
|
||||||
if (hiddenGems.length > 0) {
|
if (hiddenGems.length > 0) {
|
||||||
const gem = hiddenGems.reduce((a, b) => a.avgRating > b.avgRating ? a : b);
|
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
|
// Biggest backlog - author with most unread books
|
||||||
@@ -463,7 +465,7 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
const unreadCount = biggestBacklog.bookCount - biggestBacklog.readCount;
|
const unreadCount = biggestBacklog.bookCount - biggestBacklog.readCount;
|
||||||
if (unreadCount >= 2) {
|
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 top3Books = authorStats.slice(0, 3).reduce((sum, a) => sum + a.bookCount, 0);
|
||||||
const concentration = Math.round((top3Books / totalBooks) * 100);
|
const concentration = Math.round((top3Books / totalBooks) * 100);
|
||||||
if (concentration >= 25) {
|
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);
|
const avgPages = Math.round(longestReads.totalPages / longestReads.bookCount);
|
||||||
if (avgPages >= 300) {
|
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) =>
|
const mostVersatile = versatileAuthors.reduce((a, b) =>
|
||||||
a.categories.length > b.categories.length ? 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
|
// Completely unread - authors with 0% completion but multiple books
|
||||||
const completelyUnread = authorStats.filter(a => a.completionRate === 0 && a.bookCount >= 2);
|
const completelyUnread = authorStats.filter(a => a.completionRate === 0 && a.bookCount >= 2);
|
||||||
if (completelyUnread.length > 0) {
|
if (completelyUnread.length > 0) {
|
||||||
const topUnread = completelyUnread.reduce((a, b) => a.bookCount > b.bookCount ? a : b);
|
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
|
// 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);
|
const totalRead = authorStats.reduce((sum, a) => sum + (a.totalPages * a.completionRate / 100), 0);
|
||||||
if (totalPages > 0) {
|
if (totalPages > 0) {
|
||||||
const overallProgress = Math.round((totalRead / totalPages) * 100);
|
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;
|
return insights;
|
||||||
@@ -557,19 +559,24 @@ export class AuthorUniverseChartComponent implements OnInit, OnDestroy {
|
|||||||
const stats = raw.authorStats;
|
const stats = raw.authorStats;
|
||||||
|
|
||||||
const ratingText = stats.avgRating > 0
|
const ratingText = stats.avgRating > 0
|
||||||
? `${stats.avgRating.toFixed(2)} ★`
|
? `${stats.avgRating.toFixed(2)} \u2605`
|
||||||
: 'No ratings';
|
: this.t.translate('statsLibrary.authorUniverse.tooltipNoRatings');
|
||||||
|
|
||||||
const categoriesHtml = stats.categories.length > 0
|
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 = `
|
tooltipEl.innerHTML = `
|
||||||
<div style="color:#fff;font-size:14px;font-weight:700;margin-bottom:6px">${stats.name}</div>
|
<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">${booksLine}</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">${pagesLine}</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">${ratingLine}</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">${readLine}</div>
|
||||||
${categoriesHtml}
|
${categoriesHtml}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,11 +1,12 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsLibrary.bookFormats'">
|
||||||
<div class="book-formats-container">
|
<div class="book-formats-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-file formats-title-icon"></i>
|
<i class="pi pi-file formats-title-icon"></i>
|
||||||
Book Formats
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Distribution of file types in your library</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No books available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface FormatStats {
|
interface FormatStats {
|
||||||
format: string;
|
format: string;
|
||||||
@@ -29,13 +30,14 @@ const FORMAT_COLORS: Record<string, string> = {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-book-formats-chart',
|
selector: 'app-book-formats-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './book-formats-chart.component.html',
|
templateUrl: './book-formats-chart.component.html',
|
||||||
styleUrls: ['./book-formats-chart.component.scss']
|
styleUrls: ['./book-formats-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class BookFormatsChartComponent implements OnInit, OnDestroy {
|
export class BookFormatsChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'pie' as const;
|
public readonly chartType = 'pie' as const;
|
||||||
@@ -79,7 +81,7 @@ export class BookFormatsChartComponent implements OnInit, OnDestroy {
|
|||||||
const value = context.parsed;
|
const value = context.parsed;
|
||||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||||
const percentage = ((value / total) * 100).toFixed(1);
|
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="language-chart-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-globe language-title-icon"></i>
|
<i class="pi pi-globe language-title-icon"></i>
|
||||||
Languages
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Languages represented in your collection</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
@if (booksWithLanguage === 0) {
|
@if (booksWithLanguage === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No language data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface LanguageStats {
|
interface LanguageStats {
|
||||||
language: string;
|
language: string;
|
||||||
@@ -131,13 +132,14 @@ const LANGUAGE_NAMES: Record<string, string> = {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-language-chart',
|
selector: 'app-language-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './language-chart.component.html',
|
templateUrl: './language-chart.component.html',
|
||||||
styleUrls: ['./language-chart.component.scss']
|
styleUrls: ['./language-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class LanguageChartComponent implements OnInit, OnDestroy {
|
export class LanguageChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'pie' as const;
|
public readonly chartType = 'pie' as const;
|
||||||
@@ -182,7 +184,7 @@ export class LanguageChartComponent implements OnInit, OnDestroy {
|
|||||||
const value = context.parsed;
|
const value = context.parsed;
|
||||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||||
const percentage = ((value / total) * 100).toFixed(1);
|
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="metadata-score-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-check-circle score-title-icon"></i>
|
<i class="pi pi-check-circle score-title-icon"></i>
|
||||||
Metadata Score
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Quality of book metadata in your library</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No metadata score data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ScoreRange {
|
interface ScoreRange {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -25,24 +26,27 @@ interface ScoreStats {
|
|||||||
|
|
||||||
type ScoreChartData = ChartData<'doughnut', number[], string>;
|
type ScoreChartData = ChartData<'doughnut', number[], string>;
|
||||||
|
|
||||||
const SCORE_RANGES: ScoreRange[] = [
|
const SCORE_RANGE_KEYS = ['excellent', 'good', 'fair', 'poor', 'veryPoor'] as const;
|
||||||
{label: 'Excellent (90-100%)', min: 90, max: 100, color: '#16A34A'},
|
|
||||||
{label: 'Good (70-89%)', min: 70, max: 89, color: '#22C55E'},
|
const SCORE_RANGE_DEFS: { key: typeof SCORE_RANGE_KEYS[number]; min: number; max: number; color: string }[] = [
|
||||||
{label: 'Fair (50-69%)', min: 50, max: 69, color: '#F59E0B'},
|
{key: 'excellent', min: 90, max: 100, color: '#16A34A'},
|
||||||
{label: 'Poor (25-49%)', min: 25, max: 49, color: '#F97316'},
|
{key: 'good', min: 70, max: 89, color: '#22C55E'},
|
||||||
{label: 'Very Poor (0-24%)', min: 0, max: 24, color: '#DC2626'}
|
{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({
|
@Component({
|
||||||
selector: 'app-metadata-score-chart',
|
selector: 'app-metadata-score-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './metadata-score-chart.component.html',
|
templateUrl: './metadata-score-chart.component.html',
|
||||||
styleUrls: ['./metadata-score-chart.component.scss']
|
styleUrls: ['./metadata-score-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'doughnut' as const;
|
public readonly chartType = 'doughnut' as const;
|
||||||
@@ -89,7 +93,7 @@ export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
|||||||
const value = context.parsed;
|
const value = context.parsed;
|
||||||
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
const total = context.dataset.data.reduce((a: number, b: number) => a + b, 0);
|
||||||
const percentage = ((value / total) * 100).toFixed(1);
|
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[] {
|
private calculateScoreStats(books: Book[]): ScoreStats[] {
|
||||||
const rangeCounts = new Map<string, { count: number, color: string }>();
|
const rangeCounts = new Map<string, { count: number, color: string }>();
|
||||||
|
|
||||||
SCORE_RANGES.forEach(range => {
|
SCORE_RANGE_DEFS.forEach(range => {
|
||||||
rangeCounts.set(range.label, {count: 0, color: range.color});
|
rangeCounts.set(range.key, {count: 0, color: range.color});
|
||||||
});
|
});
|
||||||
|
|
||||||
books.forEach(book => {
|
books.forEach(book => {
|
||||||
const score = book.metadataMatchScore!;
|
const score = book.metadataMatchScore!;
|
||||||
for (const range of SCORE_RANGES) {
|
for (const range of SCORE_RANGE_DEFS) {
|
||||||
if (score >= range.min && score <= range.max) {
|
if (score >= range.min && score <= range.max) {
|
||||||
const data = rangeCounts.get(range.label)!;
|
const data = rangeCounts.get(range.key)!;
|
||||||
data.count++;
|
data.count++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -198,11 +202,11 @@ export class MetadataScoreChartComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const total = books.length;
|
const total = books.length;
|
||||||
return SCORE_RANGES
|
return SCORE_RANGE_DEFS
|
||||||
.map(range => {
|
.map(range => {
|
||||||
const data = rangeCounts.get(range.label)!;
|
const data = rangeCounts.get(range.key)!;
|
||||||
return {
|
return {
|
||||||
range: range.label,
|
range: this.t.translate(`statsLibrary.metadataScore.${range.key}`),
|
||||||
count: data.count,
|
count: data.count,
|
||||||
percentage: (data.count / total) * 100,
|
percentage: (data.count / total) * 100,
|
||||||
color: data.color
|
color: data.color
|
||||||
|
|||||||
+5
-3
@@ -1,11 +1,12 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsLibrary.pageCount'">
|
||||||
<div class="page-count-container">
|
<div class="page-count-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-book page-title-icon"></i>
|
<i class="pi pi-book page-title-icon"></i>
|
||||||
Page Count Distribution
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Distribution of book lengths in your library</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No page count data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface PageRange {
|
interface PageRange {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -37,13 +38,14 @@ const PAGE_RANGES: PageRange[] = [
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-count-chart',
|
selector: 'app-page-count-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './page-count-chart.component.html',
|
templateUrl: './page-count-chart.component.html',
|
||||||
styleUrls: ['./page-count-chart.component.scss']
|
styleUrls: ['./page-count-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class PageCountChartComponent implements OnInit, OnDestroy {
|
export class PageCountChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'bar' as const;
|
public readonly chartType = 'bar' as const;
|
||||||
@@ -69,10 +71,12 @@ export class PageCountChartComponent implements OnInit, OnDestroy {
|
|||||||
titleFont: {size: 13, weight: 'bold'},
|
titleFont: {size: 13, weight: 'bold'},
|
||||||
bodyFont: {size: 11},
|
bodyFont: {size: 11},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => `${context[0].label} pages`,
|
title: (context) => this.t.translate('statsLibrary.pageCount.tooltipTitle', {label: context[0].label}),
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const value = context.parsed.y;
|
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: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Page Count',
|
text: this.t.translate('statsLibrary.pageCount.axisPageCount'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -102,7 +106,7 @@ export class PageCountChartComponent implements OnInit, OnDestroy {
|
|||||||
y: {
|
y: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Books',
|
text: this.t.translate('statsLibrary.pageCount.axisBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
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="publication-timeline-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-calendar timeline-title-icon"></i>
|
<i class="pi pi-calendar timeline-title-icon"></i>
|
||||||
Publication Timeline
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">When were your books originally published?</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (totalBooks > 0) {
|
@if (totalBooks > 0) {
|
||||||
<div class="books-count-badge">
|
<div class="books-count-badge">
|
||||||
{{ totalBooks }} books with dates
|
{{ t('booksWithDates', { count: totalBooks }) }}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -28,21 +29,21 @@
|
|||||||
<div class="insights-row">
|
<div class="insights-row">
|
||||||
@if (insights.oldestBook) {
|
@if (insights.oldestBook) {
|
||||||
<div class="insight-item oldest">
|
<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-value">{{ insights.oldestBook.year }}</span>
|
||||||
<span class="insight-detail" [title]="insights.oldestBook.title">{{ insights.oldestBook.title }}</span>
|
<span class="insight-detail" [title]="insights.oldestBook.title">{{ insights.oldestBook.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="insight-item average">
|
<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-value">{{ insights.averageYear }}</span>
|
||||||
<span class="insight-detail">Median: {{ insights.medianYear }}</span>
|
<span class="insight-detail">{{ t('insightMedian', { year: insights.medianYear }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (insights.newestBook) {
|
@if (insights.newestBook) {
|
||||||
<div class="insight-item newest">
|
<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-value">{{ insights.newestBook.year }}</span>
|
||||||
<span class="insight-detail" [title]="insights.newestBook.title">{{ insights.newestBook.title }}</span>
|
<span class="insight-detail" [title]="insights.newestBook.title">{{ insights.newestBook.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,21 +52,21 @@
|
|||||||
|
|
||||||
<div class="insights-row secondary">
|
<div class="insights-row secondary">
|
||||||
<div class="insight-item timespan">
|
<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-value">{{ insights.timeSpan }}</span>
|
||||||
<span class="insight-detail">years of literature</span>
|
<span class="insight-detail">{{ t('insightYearsOfLiterature') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item peak">
|
<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-value">{{ insights.peakDecade }}</span>
|
||||||
<span class="insight-detail">{{ insights.peakDecadeCount }} books</span>
|
<span class="insight-detail">{{ t('insightPeakDecadeBooks', { count: insights.peakDecadeCount }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item decades">
|
<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-value">{{ insights.decadesCovered }}</span>
|
||||||
<span class="insight-detail">different eras</span>
|
<span class="insight-detail">{{ t('insightDifferentEras') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -75,7 +76,8 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No publication date data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface DecadeStats {
|
interface DecadeStats {
|
||||||
decade: string;
|
decade: string;
|
||||||
@@ -52,13 +53,14 @@ const DECADE_COLORS: Record<string, string> = {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publication-timeline-chart',
|
selector: 'app-publication-timeline-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './publication-timeline-chart.component.html',
|
templateUrl: './publication-timeline-chart.component.html',
|
||||||
styleUrls: ['./publication-timeline-chart.component.scss']
|
styleUrls: ['./publication-timeline-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'bar' as const;
|
public readonly chartType = 'bar' as const;
|
||||||
@@ -128,7 +130,7 @@ export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Books',
|
text: this.t.translate('statsLibrary.publicationTimeline.axisNumberOfBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -169,8 +171,9 @@ export class PublicationTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const value = context.parsed.x;
|
const value = context.parsed.x;
|
||||||
const bookText = value === 1 ? 'book' : 'books';
|
return value === 1
|
||||||
return `${value} ${bookText}`;
|
? 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="publication-trend-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-line trend-title-icon"></i>
|
<i class="pi pi-chart-line trend-title-icon"></i>
|
||||||
Publication Trend
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Books by publication year showing collection trends</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (totalBooks > 0 && yearRange) {
|
@if (totalBooks > 0 && yearRange) {
|
||||||
<div class="year-range-badge">
|
<div class="year-range-badge">
|
||||||
@@ -27,49 +28,49 @@
|
|||||||
<div class="insights-section">
|
<div class="insights-section">
|
||||||
<div class="insights-row">
|
<div class="insights-row">
|
||||||
<div class="insight-item peak">
|
<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-value">{{ insights.peakYear }}</span>
|
||||||
<span class="insight-detail">{{ insights.peakYearCount }} books</span>
|
<span class="insight-detail">{{ t('insightPeakYearBooks', { count: insights.peakYearCount }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item recent">
|
<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-value">{{ insights.booksLast10YearsPercent }}%</span>
|
||||||
<span class="insight-detail">{{ insights.booksLast10Years }} books</span>
|
<span class="insight-detail">{{ t('insightLast10YearsBooks', { count: insights.booksLast10Years }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item average">
|
<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-value">{{ insights.averageBooksPerYear }}</span>
|
||||||
<span class="insight-detail">books/year</span>
|
<span class="insight-detail">{{ t('insightBooksPerYear') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item productive">
|
<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-value">{{ insights.mostProductiveSpan }}</span>
|
||||||
<span class="insight-detail">most books published</span>
|
<span class="insight-detail">{{ t('insightMostBooksPublished') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item timespan">
|
<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-value">{{ insights.timeSpan }}</span>
|
||||||
<span class="insight-detail">years covered</span>
|
<span class="insight-detail">{{ t('insightYearsCovered') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item century21">
|
<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-value">{{ insights.century21Percent }}%</span>
|
||||||
<span class="insight-detail">{{ insights.century21Books }} books</span>
|
<span class="insight-detail">{{ t('insightCentury21Books', { count: insights.century21Books }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item classics">
|
<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-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>
|
||||||
|
|
||||||
<div class="insight-item unique">
|
<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-value">{{ insights.uniqueYears }}</span>
|
||||||
<span class="insight-detail">{{ insights.oldestDecade }} - {{ insights.newestDecade }}</span>
|
<span class="insight-detail">{{ insights.oldestDecade }} - {{ insights.newestDecade }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -81,7 +82,8 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No publication date data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface TrendInsights {
|
interface TrendInsights {
|
||||||
peakYear: number;
|
peakYear: number;
|
||||||
@@ -32,13 +33,14 @@ type TrendChartData = ChartData<'line', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publication-trend-chart',
|
selector: 'app-publication-trend-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './publication-trend-chart.component.html',
|
templateUrl: './publication-trend-chart.component.html',
|
||||||
styleUrls: ['./publication-trend-chart.component.scss']
|
styleUrls: ['./publication-trend-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'line' as const;
|
public readonly chartType = 'line' as const;
|
||||||
@@ -109,7 +111,7 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Publication Year',
|
text: this.t.translate('statsLibrary.publicationTrend.axisPublicationYear'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -135,7 +137,7 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Books',
|
text: this.t.translate('statsLibrary.publicationTrend.axisBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -161,11 +163,12 @@ export class PublicationTrendChartComponent implements OnInit, OnDestroy {
|
|||||||
titleFont: {size: 13, weight: 'bold'},
|
titleFont: {size: 13, weight: 'bold'},
|
||||||
bodyFont: {size: 11},
|
bodyFont: {size: 11},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => `Year ${context[0].label}`,
|
title: (context) => this.t.translate('statsLibrary.publicationTrend.tooltipTitle', {year: context[0].label}),
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const value = context.parsed.y;
|
const value = context.parsed.y;
|
||||||
const bookText = value === 1 ? 'book' : 'books';
|
return value === 1
|
||||||
return `${value} ${bookText} published`;
|
? 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="reading-journey-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-directions journey-title-icon"></i>
|
<i class="pi pi-directions journey-title-icon"></i>
|
||||||
Reading Journey
|
{{ t('title') }}
|
||||||
</h3>
|
</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>
|
</div>
|
||||||
@if (dateRange) {
|
@if (dateRange) {
|
||||||
<div class="date-range-badge">
|
<div class="date-range-badge">
|
||||||
@@ -26,51 +27,51 @@
|
|||||||
<div class="insights-section">
|
<div class="insights-section">
|
||||||
<div class="insights-row">
|
<div class="insights-row">
|
||||||
<div class="insight-item backlog">
|
<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-value">{{ insights.currentBacklog }}</span>
|
||||||
<span class="insight-detail">{{ insights.backlogPercent }}% unread</span>
|
<span class="insight-detail">{{ t('insightBacklogPercent', { percent: insights.backlogPercent }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item time-to-read">
|
<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-value">{{ insights.avgTimeToFinishDays }}</span>
|
||||||
<span class="insight-detail">days after adding</span>
|
<span class="insight-detail">{{ t('insightDaysAfterAdding') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item productive">
|
<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-value">{{ insights.mostProductiveCount }}</span>
|
||||||
<span class="insight-detail">{{ insights.mostProductiveMonth }}</span>
|
<span class="insight-detail">{{ insights.mostProductiveMonth }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item acquisition">
|
<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-value">{{ insights.busiestAcquisitionCount }}</span>
|
||||||
<span class="insight-detail">{{ insights.busiestAcquisitionMonth }}</span>
|
<span class="insight-detail">{{ insights.busiestAcquisitionMonth }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item finish-rate">
|
<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-value">{{ insights.finishRate }}</span>
|
||||||
<span class="insight-detail">books/month avg</span>
|
<span class="insight-detail">{{ t('insightBooksPerMonthAvg') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item streak">
|
<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-value">{{ insights.longestStreak }}</span>
|
||||||
<span class="insight-detail">consecutive months</span>
|
<span class="insight-detail">{{ t('insightConsecutiveMonths') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item recent">
|
<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-value">{{ insights.recentActivity }}</span>
|
||||||
<span class="insight-detail">recently finished</span>
|
<span class="insight-detail">{{ t('insightRecentlyFinished') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="insight-item total">
|
<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-value">{{ insights.totalFinished }}/{{ insights.totalAdded }}</span>
|
||||||
<span class="insight-detail">books finished</span>
|
<span class="insight-detail">{{ t('insightBooksFinished') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -79,8 +80,9 @@
|
|||||||
@if (totalBooks === 0 || !insights) {
|
@if (totalBooks === 0 || !insights) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No reading journey data available.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
<small>Books need addedOn or dateFinished dates to appear here.</small>
|
<small>{{ t('noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface MonthlyData {
|
interface MonthlyData {
|
||||||
month: string;
|
month: string;
|
||||||
@@ -38,13 +39,14 @@ type JourneyChartData = ChartData<'line', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-journey-chart',
|
selector: 'app-reading-journey-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './reading-journey-chart.component.html',
|
templateUrl: './reading-journey-chart.component.html',
|
||||||
styleUrls: ['./reading-journey-chart.component.scss']
|
styleUrls: ['./reading-journey-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'line' as const;
|
public readonly chartType = 'line' as const;
|
||||||
@@ -115,7 +117,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Month',
|
text: this.t.translate('statsLibrary.readingJourney.axisMonth'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -140,7 +142,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Cumulative Books',
|
text: this.t.translate('statsLibrary.readingJourney.axisCumulativeBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
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 addedValue = context[0].chart.data.datasets[0].data[dataIndex] as number;
|
||||||
const finishedValue = context[0].chart.data.datasets[1].data[dataIndex] as number;
|
const finishedValue = context[0].chart.data.datasets[1].data[dataIndex] as number;
|
||||||
const backlog = addedValue - finishedValue;
|
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)
|
// Longest reading streak (consecutive months with finished books)
|
||||||
let longestStreak = 0;
|
let longestStreak = 0;
|
||||||
@@ -459,7 +463,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Books Added',
|
label: this.t.translate('statsLibrary.readingJourney.legendBooksAdded'),
|
||||||
data: addedData,
|
data: addedData,
|
||||||
borderColor: '#3b82f6',
|
borderColor: '#3b82f6',
|
||||||
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
||||||
@@ -469,7 +473,7 @@ export class ReadingJourneyChartComponent implements OnInit, OnDestroy {
|
|||||||
order: 2
|
order: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Books Finished',
|
label: this.t.translate('statsLibrary.readingJourney.legendBooksFinished'),
|
||||||
data: finishedData,
|
data: finishedData,
|
||||||
borderColor: '#10b981',
|
borderColor: '#10b981',
|
||||||
backgroundColor: 'rgba(16, 185, 129, 0.2)',
|
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="top-items-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi" [ngClass]="selectedDataType.icon" [style.color]="selectedDataType.color"></i>
|
<i class="pi" [ngClass]="selectedDataType.icon" [style.color]="selectedDataType.color"></i>
|
||||||
Top 15 {{ selectedDataType.label }}
|
{{ t('titlePrefix') }} {{ selectedDataType.label }}
|
||||||
</h3>
|
</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>
|
||||||
<div class="header-controls">
|
<div class="header-controls">
|
||||||
<p-select
|
<p-select
|
||||||
@@ -34,7 +35,7 @@
|
|||||||
@if (totalItems > 0) {
|
@if (totalItems > 0) {
|
||||||
<div class="stats-badge">
|
<div class="stats-badge">
|
||||||
<span class="badge-value">{{ totalItems }}</span>
|
<span class="badge-value">{{ totalItems }}</span>
|
||||||
<span class="badge-label">shown</span>
|
<span class="badge-label">{{ t('shown') }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -67,8 +68,9 @@
|
|||||||
@if (totalItems === 0) {
|
@if (totalItems === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No {{ selectedDataType.label.toLowerCase() }} data available.</p>
|
<p>{{ t('noDataPrefix') }} {{ selectedDataType.label.toLowerCase() }} {{ t('noDataSuffix') }}</p>
|
||||||
<small>Make sure your books have {{ selectedDataType.label.toLowerCase() }} metadata.</small>
|
<small>{{ t('noDataHintPrefix') }} {{ selectedDataType.label.toLowerCase() }} {{ t('noDataHintSuffix') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ItemStats {
|
interface ItemStats {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -27,25 +28,37 @@ interface DataTypeOption {
|
|||||||
type DataType = 'authors' | 'categories' | 'publishers' | 'tags' | 'moods' | 'series';
|
type DataType = 'authors' | 'categories' | 'publishers' | 'tags' | 'moods' | 'series';
|
||||||
type ItemChartData = ChartData<'bar', number[], string>;
|
type ItemChartData = ChartData<'bar', number[], string>;
|
||||||
|
|
||||||
const DATA_TYPE_OPTIONS: DataTypeOption[] = [
|
const DATA_TYPE_DEFS: { key: string; value: DataType; icon: string; color: string }[] = [
|
||||||
{label: 'Authors', value: 'authors', icon: 'pi-th-large', color: '#2563EB'},
|
{key: 'authors', value: 'authors', icon: 'pi-th-large', color: '#2563EB'},
|
||||||
{label: 'Categories', value: 'categories', icon: 'pi-user', color: '#0D9488'},
|
{key: 'categories', value: 'categories', icon: 'pi-user', color: '#0D9488'},
|
||||||
{label: 'Series', value: 'series', icon: 'pi-tag', color: '#DB2777'},
|
{key: 'series', value: 'series', icon: 'pi-tag', color: '#DB2777'},
|
||||||
{label: 'Publishers', value: 'publishers', icon: 'pi-building', color: '#7C3AED'},
|
{key: 'publishers', value: 'publishers', icon: 'pi-building', color: '#7C3AED'},
|
||||||
{label: 'Tags', value: 'tags', icon: 'pi-bookmark', color: '#EAB308'},
|
{key: 'tags', value: 'tags', icon: 'pi-bookmark', color: '#EAB308'},
|
||||||
{label: 'Moods', value: 'moods', icon: 'pi-heart', color: '#EA580C'}
|
{key: 'moods', value: 'moods', icon: 'pi-heart', color: '#EA580C'}
|
||||||
];
|
];
|
||||||
|
|
||||||
const READ_STATUS_CONFIG: Record<ReadStatus, { label: string; color: string }> = {
|
const READ_STATUS_KEYS: Record<ReadStatus, string> = {
|
||||||
[ReadStatus.READ]: {label: 'Read', color: '#22c55e'},
|
[ReadStatus.READ]: 'read',
|
||||||
[ReadStatus.READING]: {label: 'Reading', color: '#3b82f6'},
|
[ReadStatus.READING]: 'reading',
|
||||||
[ReadStatus.RE_READING]: {label: 'Re-reading', color: '#8b5cf6'},
|
[ReadStatus.RE_READING]: 'reReading',
|
||||||
[ReadStatus.UNREAD]: {label: 'Unread', color: '#6b7280'},
|
[ReadStatus.UNREAD]: 'unread',
|
||||||
[ReadStatus.PARTIALLY_READ]: {label: 'Partially Read', color: '#f59e0b'},
|
[ReadStatus.PARTIALLY_READ]: 'partiallyRead',
|
||||||
[ReadStatus.PAUSED]: {label: 'Paused', color: '#eab308'},
|
[ReadStatus.PAUSED]: 'paused',
|
||||||
[ReadStatus.WONT_READ]: {label: "Won't Read", color: '#ef4444'},
|
[ReadStatus.WONT_READ]: 'wontRead',
|
||||||
[ReadStatus.ABANDONED]: {label: 'Abandoned', color: '#dc2626'},
|
[ReadStatus.ABANDONED]: 'abandoned',
|
||||||
[ReadStatus.UNSET]: {label: 'Not Set', color: '#9ca3af'}
|
[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[] = [
|
const READ_STATUS_ORDER: ReadStatus[] = [
|
||||||
@@ -63,7 +76,7 @@ const READ_STATUS_ORDER: ReadStatus[] = [
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-top-items-chart',
|
selector: 'app-top-items-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, FormsModule, BaseChartDirective, Select],
|
imports: [CommonModule, FormsModule, BaseChartDirective, Select, TranslocoDirective],
|
||||||
templateUrl: './top-items-chart.component.html',
|
templateUrl: './top-items-chart.component.html',
|
||||||
styleUrls: ['./top-items-chart.component.scss']
|
styleUrls: ['./top-items-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -73,8 +86,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
public readonly chartType = 'bar' as const;
|
public readonly chartType = 'bar' as const;
|
||||||
public readonly chartData$: Observable<ItemChartData>;
|
public readonly chartData$: Observable<ItemChartData>;
|
||||||
public chartOptions: ChartConfiguration<'bar'>['options'];
|
public chartOptions: ChartConfiguration<'bar'>['options'];
|
||||||
public dataTypeOptions = DATA_TYPE_OPTIONS;
|
public dataTypeOptions: DataTypeOption[];
|
||||||
public selectedDataType: DataTypeOption = DATA_TYPE_OPTIONS[0];
|
public selectedDataType: DataTypeOption;
|
||||||
|
|
||||||
public totalItems = 0;
|
public totalItems = 0;
|
||||||
public totalBooks = 0;
|
public totalBooks = 0;
|
||||||
@@ -82,12 +95,20 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<ItemChartData>;
|
private readonly chartDataSubject: BehaviorSubject<ItemChartData>;
|
||||||
private lastCalculatedStats: ItemStats[] = [];
|
private lastCalculatedStats: ItemStats[] = [];
|
||||||
private allBooks: Book[] = [];
|
private allBooks: Book[] = [];
|
||||||
|
|
||||||
constructor() {
|
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>({
|
this.chartDataSubject = new BehaviorSubject<ItemChartData>({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: []
|
datasets: []
|
||||||
@@ -98,7 +119,7 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (this.initialDataType) {
|
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) {
|
if (initialOption) {
|
||||||
this.selectedDataType = initialOption;
|
this.selectedDataType = initialOption;
|
||||||
this.initChartOptions();
|
this.initChartOptions();
|
||||||
@@ -162,7 +183,7 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
border: {display: false},
|
border: {display: false},
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Books',
|
text: this.t.translate('statsLibrary.topItems.axisNumberOfBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -264,12 +285,13 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
const datasets = READ_STATUS_ORDER
|
const datasets = READ_STATUS_ORDER
|
||||||
.filter(status => stats.some(s => s.statusBreakdown[status] > 0))
|
.filter(status => stats.some(s => s.statusBreakdown[status] > 0))
|
||||||
.map(status => {
|
.map(status => {
|
||||||
const config = READ_STATUS_CONFIG[status];
|
const statusKey = READ_STATUS_KEYS[status];
|
||||||
|
const color = READ_STATUS_COLORS[status];
|
||||||
return {
|
return {
|
||||||
label: config.label,
|
label: this.t.translate(`statsLibrary.topItems.readStatus.${statusKey}`),
|
||||||
data: stats.map(s => s.statusBreakdown[status]),
|
data: stats.map(s => s.statusBreakdown[status]),
|
||||||
backgroundColor: config.color,
|
backgroundColor: color,
|
||||||
borderColor: config.color,
|
borderColor: color,
|
||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderRadius: 4,
|
borderRadius: 4,
|
||||||
barPercentage: 0.85,
|
barPercentage: 0.85,
|
||||||
@@ -295,14 +317,13 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
if (stats.length === 0) return;
|
if (stats.length === 0) return;
|
||||||
|
|
||||||
const typeName = this.selectedDataType.label.toLowerCase().slice(0, -1); // Remove 's' for singular
|
const typeName = this.selectedDataType.label.toLowerCase().slice(0, -1); // Remove 's' for singular
|
||||||
const typeNamePlural = this.selectedDataType.label.toLowerCase();
|
|
||||||
|
|
||||||
// 1. Top item
|
// 1. Top item
|
||||||
const top = stats[0];
|
const top = stats[0];
|
||||||
this.insights.push({
|
this.insights.push({
|
||||||
icon: 'pi-trophy',
|
icon: 'pi-trophy',
|
||||||
label: `Top ${typeName}`,
|
label: this.t.translate('statsLibrary.topItems.insightTop', {type: typeName}),
|
||||||
value: `${top.name} (${top.count} books)`
|
value: this.t.translate('statsLibrary.topItems.insightTopValue', {name: top.name, count: top.count})
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. Most completed - highest read percentage
|
// 2. Most completed - highest read percentage
|
||||||
@@ -317,8 +338,8 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
if (readPct > 0) {
|
if (readPct > 0) {
|
||||||
this.insights.push({
|
this.insights.push({
|
||||||
icon: 'pi-check-circle',
|
icon: 'pi-check-circle',
|
||||||
label: 'Most completed',
|
label: this.t.translate('statsLibrary.topItems.insightMostCompleted'),
|
||||||
value: `${mostRead.name} (${readPct}% read)`
|
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);
|
const concentration = Math.round((top5Books / totalAllBooks) * 100);
|
||||||
this.insights.push({
|
this.insights.push({
|
||||||
icon: 'pi-chart-pie',
|
icon: 'pi-chart-pie',
|
||||||
label: 'Top 5 coverage',
|
label: this.t.translate('statsLibrary.topItems.insightTop5Coverage'),
|
||||||
value: `${concentration}% of library`
|
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);
|
const avgBooks = (this.totalBooks / stats.length).toFixed(1);
|
||||||
this.insights.push({
|
this.insights.push({
|
||||||
icon: 'pi-book',
|
icon: 'pi-book',
|
||||||
label: `Avg per ${typeName}`,
|
label: this.t.translate('statsLibrary.topItems.insightAvgPer', {type: typeName}),
|
||||||
value: `${avgBooks} books`
|
value: this.t.translate('statsLibrary.topItems.insightAvgPerValue', {avg: avgBooks})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,10 +466,10 @@ export class TopItemsChartComponent implements OnInit, OnDestroy {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusLabel = context.dataset.label || 'Books';
|
const statusLabel = context.dataset.label || this.t.translate('statsLibrary.pageCount.axisBooks');
|
||||||
const bookText = value === 1 ? 'book' : 'books';
|
return value === 1
|
||||||
|
? this.t.translate('statsLibrary.topItems.tooltipBook', {status: statusLabel, value})
|
||||||
return `${statusLabel}: ${value} ${bookText}`;
|
: this.t.translate('statsLibrary.topItems.tooltipBooks', {status: statusLabel, value});
|
||||||
}
|
}
|
||||||
|
|
||||||
private truncateTitle(title: string, maxLength: number): string {
|
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="library-stats-container">
|
||||||
<div class="header-card">
|
<div class="header-card">
|
||||||
<div class="filter-section">
|
<div class="filter-section">
|
||||||
<div class="library-filter">
|
<div class="library-filter">
|
||||||
<div class="select-row">
|
<div class="select-row">
|
||||||
<label for="library-dropdown">Library Statistics</label>
|
<label for="library-dropdown">{{ t('main.title') }}</label>
|
||||||
<div class="dropdown-row">
|
<div class="dropdown-row">
|
||||||
<p-select
|
<p-select
|
||||||
fluid
|
fluid
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
[(ngModel)]="selectedLibrary"
|
[(ngModel)]="selectedLibrary"
|
||||||
optionLabel="name"
|
optionLabel="name"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Select a library"
|
[placeholder]="t('main.selectLibrary')"
|
||||||
(onChange)="onLibraryChange()"
|
(onChange)="onLibraryChange()"
|
||||||
appendTo="body"
|
appendTo="body"
|
||||||
[style]="{'min-width': '200px'}"
|
[style]="{'min-width': '200px'}"
|
||||||
@@ -29,33 +30,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="library-totals" role="status" aria-live="polite">
|
<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>
|
<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>
|
<span class="total-value">{{ totalBooks$ | async }}</span>
|
||||||
</div>
|
</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>
|
<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>
|
<span class="total-value">{{ totalAuthors$ | async }}</span>
|
||||||
</div>
|
</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>
|
<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>
|
<span class="total-value">{{ totalSeries$ | async }}</span>
|
||||||
</div>
|
</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>
|
<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>
|
<span class="total-value">{{ totalPublishers$ | async }}</span>
|
||||||
</div>
|
</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>
|
<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>
|
<span class="total-value">{{ totalSize$ | async }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,28 +68,28 @@
|
|||||||
<div class="config-modal-overlay" (click)="closeConfigPanel()">
|
<div class="config-modal-overlay" (click)="closeConfigPanel()">
|
||||||
<div class="config-modal" (click)="$event.stopPropagation()">
|
<div class="config-modal" (click)="$event.stopPropagation()">
|
||||||
<div class="config-modal-header">
|
<div class="config-modal-header">
|
||||||
<h3><i class="pi pi-cog"></i> Chart Configuration</h3>
|
<h3><i class="pi pi-cog"></i> {{ t('config.title') }}</h3>
|
||||||
<button type="button" class="close-btn" (click)="closeConfigPanel()" title="Close">
|
<button type="button" class="close-btn" (click)="closeConfigPanel()" [title]="t('config.close')">
|
||||||
<i class="pi pi-times"></i>
|
<i class="pi pi-times"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-modal-actions">
|
<div class="config-modal-actions">
|
||||||
<button type="button" class="config-action-btn enable-all" (click)="enableAllCharts()">
|
<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>
|
||||||
<button type="button" class="config-action-btn disable-all" (click)="disableAllCharts()">
|
<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>
|
||||||
<button type="button" class="config-action-btn reset-order" (click)="resetChartOrder()">
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-modal-content">
|
<div class="config-modal-content">
|
||||||
<div class="config-categories">
|
<div class="config-categories">
|
||||||
<div class="config-category">
|
<div class="config-category">
|
||||||
<h4>Small Charts</h4>
|
<h4>{{ t('config.smallCharts') }}</h4>
|
||||||
<div class="chart-toggles">
|
<div class="chart-toggles">
|
||||||
@for (chart of getChartsByCategory('small'); track chart.id) {
|
@for (chart of getChartsByCategory('small'); track chart.id) {
|
||||||
<div class="chart-toggle">
|
<div class="chart-toggle">
|
||||||
@@ -104,7 +105,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-category">
|
<div class="config-category">
|
||||||
<h4>Large Charts</h4>
|
<h4>{{ t('config.largeCharts') }}</h4>
|
||||||
<div class="chart-toggles">
|
<div class="chart-toggles">
|
||||||
@for (chart of getChartsByCategory('large'); track chart.id) {
|
@for (chart of getChartsByCategory('large'); track chart.id) {
|
||||||
<div class="chart-toggle">
|
<div class="chart-toggle">
|
||||||
@@ -120,7 +121,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="config-category">
|
<div class="config-category">
|
||||||
<h4>Extra Large Charts</h4>
|
<h4>{{ t('config.xlargeCharts') }}</h4>
|
||||||
<div class="chart-toggles">
|
<div class="chart-toggles">
|
||||||
@for (chart of getChartsByCategory('xlarge'); track chart.id) {
|
@for (chart of getChartsByCategory('xlarge'); track chart.id) {
|
||||||
<div class="chart-toggle">
|
<div class="chart-toggle">
|
||||||
@@ -152,7 +153,7 @@
|
|||||||
[cdkDragData]="chartConfig"
|
[cdkDragData]="chartConfig"
|
||||||
[class]="'chart-section ' + chartConfig.category">
|
[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>
|
<i class="pi pi-bars"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -192,14 +193,15 @@
|
|||||||
|
|
||||||
@if (isLoading) {
|
@if (isLoading) {
|
||||||
<div class="loading-message">
|
<div class="loading-message">
|
||||||
Loading statistics...
|
{{ t('main.loading') }}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!isLoading && !hasData) {
|
@if (!isLoading && !hasData) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
No data available.
|
{{ t('main.noData') }}
|
||||||
<small>Make sure your library contains books with metadata.</small>
|
<small>{{ t('main.noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {ReadingJourneyChartComponent} from './charts/reading-journey-chart/reading-journey-chart.component';
|
||||||
import {LibrariesSummaryService} from './service/libraries-summary.service';
|
import {LibrariesSummaryService} from './service/libraries-summary.service';
|
||||||
import {LibraryFilterService, LibraryOption} from './service/library-filter.service';
|
import {LibraryFilterService, LibraryOption} from './service/library-filter.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ChartConfig {
|
interface ChartConfig {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -42,7 +43,8 @@ interface ChartConfig {
|
|||||||
AuthorUniverseChartComponent,
|
AuthorUniverseChartComponent,
|
||||||
PublicationTimelineChartComponent,
|
PublicationTimelineChartComponent,
|
||||||
PublicationTrendChartComponent,
|
PublicationTrendChartComponent,
|
||||||
ReadingJourneyChartComponent
|
ReadingJourneyChartComponent,
|
||||||
|
TranslocoDirective
|
||||||
],
|
],
|
||||||
templateUrl: './library-stats.component.html',
|
templateUrl: './library-stats.component.html',
|
||||||
styleUrls: ['./library-stats.component.scss']
|
styleUrls: ['./library-stats.component.scss']
|
||||||
@@ -50,6 +52,7 @@ interface ChartConfig {
|
|||||||
export class LibraryStatsComponent implements OnInit, OnDestroy {
|
export class LibraryStatsComponent implements OnInit, OnDestroy {
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
private readonly librariesSummaryService = inject(LibrariesSummaryService);
|
private readonly librariesSummaryService = inject(LibrariesSummaryService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public isLoading = true;
|
public isLoading = true;
|
||||||
@@ -59,17 +62,7 @@ export class LibraryStatsComponent implements OnInit, OnDestroy {
|
|||||||
public selectedLibrary: LibraryOption | null = null;
|
public selectedLibrary: LibraryOption | null = null;
|
||||||
public showConfigPanel = false;
|
public showConfigPanel = false;
|
||||||
|
|
||||||
public chartsConfig: ChartConfig[] = [
|
public chartsConfig: ChartConfig[] = this.buildChartsConfig();
|
||||||
{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'}
|
|
||||||
];
|
|
||||||
|
|
||||||
booksSummary$ = this.librariesSummaryService.getBooksSummary().pipe(
|
booksSummary$ = this.librariesSummaryService.getBooksSummary().pipe(
|
||||||
catchError(error => {
|
catchError(error => {
|
||||||
@@ -184,16 +177,20 @@ export class LibraryStatsComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public resetChartOrder(): void {
|
public resetChartOrder(): void {
|
||||||
this.chartsConfig = [
|
this.chartsConfig = this.buildChartsConfig();
|
||||||
{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'},
|
private buildChartsConfig(): ChartConfig[] {
|
||||||
{id: 'pageCountDistribution', name: 'Page Count', enabled: true, category: 'small'},
|
return [
|
||||||
{id: 'publicationTimeline', name: 'Publication Timeline', enabled: true, category: 'large'},
|
{id: 'bookFormats', name: this.t.translate('statsLibrary.chartNames.bookFormats'), enabled: true, category: 'small'},
|
||||||
{id: 'readingJourney', name: 'Reading Journey', enabled: true, category: 'large'},
|
{id: 'languageDistribution', name: this.t.translate('statsLibrary.chartNames.languages'), enabled: true, category: 'small'},
|
||||||
{id: 'topItems', name: 'Top Items (Authors/Categories/etc.)', enabled: true, category: 'large'},
|
{id: 'metadataScore', name: this.t.translate('statsLibrary.chartNames.metadataScore'), enabled: true, category: 'small'},
|
||||||
{id: 'authorUniverse', name: 'Author Universe', enabled: true, category: 'large'},
|
{id: 'pageCountDistribution', name: this.t.translate('statsLibrary.chartNames.pageCount'), enabled: true, category: 'small'},
|
||||||
{id: 'publicationTrend', name: 'Publication Trend', enabled: true, category: 'xlarge'}
|
{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 {BehaviorSubject, combineLatest, map, Observable} from 'rxjs';
|
||||||
import {BookService} from '../../../../book/service/book.service';
|
import {BookService} from '../../../../book/service/book.service';
|
||||||
import {LibraryService} from '../../../../book/service/library.service';
|
import {LibraryService} from '../../../../book/service/library.service';
|
||||||
|
import {TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
export interface LibraryOption {
|
export interface LibraryOption {
|
||||||
id: number | null;
|
id: number | null;
|
||||||
@@ -26,6 +27,7 @@ export class LibraryFilterService {
|
|||||||
|
|
||||||
private bookService = inject(BookService);
|
private bookService = inject(BookService);
|
||||||
private libraryService = inject(LibraryService);
|
private libraryService = inject(LibraryService);
|
||||||
|
private t = inject(TranslocoService);
|
||||||
|
|
||||||
getLibraryOptions(): Observable<LibraryOption[]> {
|
getLibraryOptions(): Observable<LibraryOption[]> {
|
||||||
return combineLatest([
|
return combineLatest([
|
||||||
@@ -34,24 +36,24 @@ export class LibraryFilterService {
|
|||||||
]).pipe(
|
]).pipe(
|
||||||
map(([bookState, libraryState]) => {
|
map(([bookState, libraryState]) => {
|
||||||
if (!bookState.loaded || !bookState.books || bookState.books.length === 0) {
|
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) {
|
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>();
|
const libraryMap = new Map<number, string>();
|
||||||
bookState.books.forEach(book => {
|
bookState.books.forEach(book => {
|
||||||
if (!libraryMap.has(book.libraryId)) {
|
if (!libraryMap.has(book.libraryId)) {
|
||||||
const library = libraryState.libraries?.find(lib => lib.id === 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);
|
libraryMap.set(book.libraryId, libraryName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const options: LibraryOption[] = [
|
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}))
|
...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="book-length-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-book book-length-icon"></i>
|
<i class="pi pi-book book-length-icon"></i>
|
||||||
Book Length Sweet Spot
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">How book length relates to your personal ratings</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (totalRatedBooks > 0) {
|
@if (totalRatedBooks > 0) {
|
||||||
<div class="stats-badge">
|
<div class="stats-badge">
|
||||||
<span class="badge-value">{{ totalRatedBooks }}</span>
|
<span class="badge-value">{{ totalRatedBooks }}</span>
|
||||||
<span class="badge-label">books analyzed</span>
|
<span class="badge-label">{{ t('booksAnalyzed') }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -24,11 +25,11 @@
|
|||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value-sm">{{ sweetSpot }}</span>
|
<span class="stat-value-sm">{{ sweetSpot }}</span>
|
||||||
<span class="stat-label">Sweet Spot</span>
|
<span class="stat-label">{{ t('sweetSpot') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value-sm">{{ highestRatedLength }}</span>
|
<span class="stat-value-sm">{{ highestRatedLength }}</span>
|
||||||
<span class="stat-label">Highest Rated</span>
|
<span class="stat-label">{{ t('highestRated') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -41,3 +42,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</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 {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface BookScatterPoint extends ScatterDataPoint {
|
interface BookScatterPoint extends ScatterDataPoint {
|
||||||
bookTitle: string;
|
bookTitle: string;
|
||||||
@@ -17,10 +18,10 @@ interface BookScatterPoint extends ScatterDataPoint {
|
|||||||
type LengthChartData = ChartData<'scatter', BookScatterPoint[], string>;
|
type LengthChartData = ChartData<'scatter', BookScatterPoint[], string>;
|
||||||
|
|
||||||
const STATUS_COLORS: Record<string, { bg: string; border: string }> = {
|
const STATUS_COLORS: Record<string, { bg: string; border: string }> = {
|
||||||
'Read': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
'read': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||||
'Reading': {bg: 'rgba(33, 150, 243, 0.7)', border: '#2196f3'},
|
'reading': {bg: 'rgba(33, 150, 243, 0.7)', border: '#2196f3'},
|
||||||
'Abandoned': {bg: 'rgba(244, 67, 54, 0.7)', border: '#f44336'},
|
'abandoned': {bg: 'rgba(244, 67, 54, 0.7)', border: '#f44336'},
|
||||||
'Other': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
'other': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||||
};
|
};
|
||||||
|
|
||||||
const PAGE_RANGES = [
|
const PAGE_RANGES = [
|
||||||
@@ -35,12 +36,13 @@ const PAGE_RANGES = [
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-book-length-chart',
|
selector: 'app-book-length-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './book-length-chart.component.html',
|
templateUrl: './book-length-chart.component.html',
|
||||||
styleUrls: ['./book-length-chart.component.scss']
|
styleUrls: ['./book-length-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class BookLengthChartComponent implements OnInit, OnDestroy {
|
export class BookLengthChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'scatter' as const;
|
public readonly chartType = 'scatter' as const;
|
||||||
@@ -58,7 +60,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Page Count',
|
text: this.t.translate('statsUser.bookLength.axisPageCount'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -73,7 +75,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 10,
|
max: 10,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Personal Rating',
|
text: this.t.translate('statsUser.bookLength.axisPersonalRating'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -111,14 +113,14 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => {
|
title: (context) => {
|
||||||
const point = context[0].raw as BookScatterPoint;
|
const point = context[0].raw as BookScatterPoint;
|
||||||
return point.bookTitle || 'Unknown Book';
|
return point.bookTitle || this.t.translate('statsUser.bookLength.tooltipUnknownBook');
|
||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const point = context.raw as BookScatterPoint;
|
const point = context.raw as BookScatterPoint;
|
||||||
return [
|
return [
|
||||||
`Pages: ${point.x}`,
|
this.t.translate('statsUser.bookLength.tooltipPages', {count: point.x}),
|
||||||
`Rating: ${point.y}/10`,
|
this.t.translate('statsUser.bookLength.tooltipRating', {rating: point.y}),
|
||||||
`Status: ${point.readStatus}`
|
this.t.translate('statsUser.bookLength.tooltipStatus', {status: point.readStatus})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,12 +171,13 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
this.totalRatedBooks = ratedBooks.length;
|
this.totalRatedBooks = ratedBooks.length;
|
||||||
if (this.totalRatedBooks === 0) return;
|
if (this.totalRatedBooks === 0) return;
|
||||||
|
|
||||||
// Group by status
|
// Group by status key (for colors) and translated label (for display)
|
||||||
const grouped = new Map<string, BookScatterPoint[]>();
|
const grouped = new Map<string, { label: string; points: BookScatterPoint[] }>();
|
||||||
for (const book of ratedBooks) {
|
for (const book of ratedBooks) {
|
||||||
|
const statusKey = this.getStatusKey(book.readStatus);
|
||||||
const statusLabel = this.getStatusLabel(book.readStatus);
|
const statusLabel = this.getStatusLabel(book.readStatus);
|
||||||
if (!grouped.has(statusLabel)) grouped.set(statusLabel, []);
|
if (!grouped.has(statusKey)) grouped.set(statusKey, {label: statusLabel, points: []});
|
||||||
grouped.get(statusLabel)!.push({
|
grouped.get(statusKey)!.points.push({
|
||||||
x: book.metadata!.pageCount!,
|
x: book.metadata!.pageCount!,
|
||||||
y: book.personalRating!,
|
y: book.personalRating!,
|
||||||
bookTitle: book.metadata?.title || book.fileName || 'Unknown',
|
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 datasets = Array.from(grouped.entries()).map(([key, {label, points}]) => {
|
||||||
const colors = STATUS_COLORS[label] || STATUS_COLORS['Other'];
|
const colors = STATUS_COLORS[key] || STATUS_COLORS['other'];
|
||||||
return {
|
return {
|
||||||
label: `${label} (${points.length})`,
|
label: `${label} (${points.length})`,
|
||||||
data: points,
|
data: points,
|
||||||
@@ -200,7 +203,7 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
const trend = this.computeTrendLine(allPoints);
|
const trend = this.computeTrendLine(allPoints);
|
||||||
if (trend) {
|
if (trend) {
|
||||||
datasets.push({
|
datasets.push({
|
||||||
label: 'Trend',
|
label: this.t.translate('statsUser.bookLength.trend'),
|
||||||
data: trend as BookScatterPoint[],
|
data: trend as BookScatterPoint[],
|
||||||
backgroundColor: 'transparent',
|
backgroundColor: 'transparent',
|
||||||
borderColor: 'rgba(255, 255, 255, 0.4)',
|
borderColor: 'rgba(255, 255, 255, 0.4)',
|
||||||
@@ -216,20 +219,37 @@ export class BookLengthChartComponent implements OnInit, OnDestroy {
|
|||||||
this.computeStats(ratedBooks);
|
this.computeStats(ratedBooks);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getStatusLabel(status?: ReadStatus): string {
|
private getStatusKey(status?: ReadStatus): string {
|
||||||
if (!status) return 'Other';
|
if (!status) return 'other';
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case ReadStatus.READ:
|
case ReadStatus.READ:
|
||||||
case ReadStatus.PARTIALLY_READ:
|
case ReadStatus.PARTIALLY_READ:
|
||||||
return 'Read';
|
return 'read';
|
||||||
case ReadStatus.READING:
|
case ReadStatus.READING:
|
||||||
case ReadStatus.RE_READING:
|
case ReadStatus.RE_READING:
|
||||||
return 'Reading';
|
return 'reading';
|
||||||
case ReadStatus.ABANDONED:
|
case ReadStatus.ABANDONED:
|
||||||
case ReadStatus.WONT_READ:
|
case ReadStatus.WONT_READ:
|
||||||
return 'Abandoned';
|
return 'abandoned';
|
||||||
default:
|
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="completion-race-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-flag completion-race-icon"></i>
|
<i class="pi pi-flag completion-race-icon"></i>
|
||||||
Reading Completion Race
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Compare how quickly you finished different books</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="year-selector">
|
<div class="year-selector">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(-1)"
|
(click)="changeYear(-1)"
|
||||||
title="Previous year">
|
[title]="t('previousYear')">
|
||||||
<i class="pi pi-chevron-left"></i>
|
<i class="pi pi-chevron-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="current-year">{{ currentYear }}</span>
|
<span class="current-year">{{ currentYear }}</span>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(1)"
|
(click)="changeYear(1)"
|
||||||
title="Next year">
|
[title]="t('nextYear')">
|
||||||
<i class="pi pi-chevron-right"></i>
|
<i class="pi pi-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,29 +34,29 @@
|
|||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ totalBooks }}</span>
|
<span class="stat-value">{{ totalBooks }}</span>
|
||||||
<span class="stat-label">Books</span>
|
<span class="stat-label">{{ t('books') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ totalSessions }}</span>
|
<span class="stat-value">{{ totalSessions }}</span>
|
||||||
<span class="stat-label">Sessions</span>
|
<span class="stat-label">{{ t('sessions') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ avgDaysToFinish }}d</span>
|
<span class="stat-value">{{ avgDaysToFinish }}d</span>
|
||||||
<span class="stat-label">Avg Days</span>
|
<span class="stat-label">{{ t('avgDays') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ medianDaysToFinish }}d</span>
|
<span class="stat-value">{{ medianDaysToFinish }}d</span>
|
||||||
<span class="stat-label">Median Days</span>
|
<span class="stat-label">{{ t('medianDays') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card fastest">
|
<div class="stat-card fastest">
|
||||||
<span class="stat-value">{{ fastestDays }}</span>
|
<span class="stat-value">{{ fastestDays }}</span>
|
||||||
<span class="stat-subtitle">{{ fastestTitle }}</span>
|
<span class="stat-subtitle">{{ fastestTitle }}</span>
|
||||||
<span class="stat-label">Fastest</span>
|
<span class="stat-label">{{ t('fastest') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card slowest">
|
<div class="stat-card slowest">
|
||||||
<span class="stat-value">{{ slowestDays }}</span>
|
<span class="stat-value">{{ slowestDays }}</span>
|
||||||
<span class="stat-subtitle">{{ slowestTitle }}</span>
|
<span class="stat-subtitle">{{ slowestTitle }}</span>
|
||||||
<span class="stat-label">Slowest</span>
|
<span class="stat-label">{{ t('slowest') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -71,8 +72,9 @@
|
|||||||
@if (totalBooks === 0) {
|
@if (totalBooks === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No completed books with reading sessions found for {{ currentYear }}.</p>
|
<p>{{ t('noData', { year: currentYear }) }}</p>
|
||||||
<small>Complete some books with tracked reading sessions to see your completion races.</small>
|
<small>{{ t('noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+6
-4
@@ -6,6 +6,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
|||||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {CompletionRaceResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {CompletionRaceResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface BookRace {
|
interface BookRace {
|
||||||
bookId: number;
|
bookId: number;
|
||||||
@@ -25,7 +26,7 @@ const LINE_COLORS = [
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-completion-race-chart',
|
selector: 'app-completion-race-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './completion-race-chart.component.html',
|
templateUrl: './completion-race-chart.component.html',
|
||||||
styleUrls: ['./completion-race-chart.component.scss']
|
styleUrls: ['./completion-race-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -47,6 +48,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
|||||||
public slowestTitle = '';
|
public slowestTitle = '';
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<RaceChartData>;
|
private readonly chartDataSubject: BehaviorSubject<RaceChartData>;
|
||||||
|
|
||||||
@@ -89,7 +91,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
|||||||
label: (context) => {
|
label: (context) => {
|
||||||
const progress = (context.parsed.y ?? 0).toFixed(1);
|
const progress = (context.parsed.y ?? 0).toFixed(1);
|
||||||
const day = context.parsed.x;
|
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',
|
type: 'linear',
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Days Since First Session',
|
text: this.t.translate('statsUser.completionRace.axisDaysSinceFirstSession'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -117,7 +119,7 @@ export class CompletionRaceChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 100,
|
max: 100,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Progress (%)',
|
text: this.t.translate('statsUser.completionRace.axisProgress'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
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="completion-timeline-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-calendar completion-title-icon"></i>
|
<i class="pi pi-calendar completion-title-icon"></i>
|
||||||
Reading Progress
|
{{ t('title') }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Monthly book completion statistics</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="year-selector">
|
<div class="year-selector">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(-1)"
|
(click)="changeYear(-1)"
|
||||||
title="Previous year">
|
[title]="t('previousYear')">
|
||||||
<i class="pi pi-chevron-left"></i>
|
<i class="pi pi-chevron-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="current-year">{{ currentYear }}</span>
|
<span class="current-year">{{ currentYear }}</span>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(1)"
|
(click)="changeYear(1)"
|
||||||
title="Next year">
|
[title]="t('nextYear')">
|
||||||
<i class="pi pi-chevron-right"></i>
|
<i class="pi pi-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -31,4 +32,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+11
-8
@@ -5,13 +5,14 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
|||||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {CompletionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {CompletionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type CompletionChartData = ChartData<'bar', number[], string>;
|
type CompletionChartData = ChartData<'bar', number[], string>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-completion-timeline-chart',
|
selector: 'app-completion-timeline-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective],
|
imports: [CommonModule, BaseChartDirective, TranslocoDirective],
|
||||||
templateUrl: './completion-timeline-chart.component.html',
|
templateUrl: './completion-timeline-chart.component.html',
|
||||||
styleUrls: ['./completion-timeline-chart.component.scss']
|
styleUrls: ['./completion-timeline-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -24,6 +25,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
public readonly chartOptions: ChartConfiguration['options'];
|
public readonly chartOptions: ChartConfiguration['options'];
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<CompletionChartData>;
|
private readonly chartDataSubject: BehaviorSubject<CompletionChartData>;
|
||||||
|
|
||||||
@@ -69,7 +71,8 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
label: (context) => {
|
label: (context) => {
|
||||||
const label = context.dataset.label || '';
|
const label = context.dataset.label || '';
|
||||||
const value = context.parsed.y;
|
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: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Month',
|
text: this.t.translate('statsUser.completionTimeline.axisMonth'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -97,7 +100,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
y: {
|
y: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Books',
|
text: this.t.translate('statsUser.completionTimeline.axisNumberOfBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -190,7 +193,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Completed',
|
label: this.t.translate('statsUser.completionTimeline.completed'),
|
||||||
data: completedBooks,
|
data: completedBooks,
|
||||||
backgroundColor: 'rgba(106, 176, 76, 0.8)',
|
backgroundColor: 'rgba(106, 176, 76, 0.8)',
|
||||||
borderColor: 'rgba(106, 176, 76, 1)',
|
borderColor: 'rgba(106, 176, 76, 1)',
|
||||||
@@ -200,7 +203,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
categoryPercentage: 0.6
|
categoryPercentage: 0.6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Active Reading',
|
label: this.t.translate('statsUser.completionTimeline.activeReading'),
|
||||||
data: activeReading,
|
data: activeReading,
|
||||||
backgroundColor: 'rgba(59, 130, 246, 0.8)',
|
backgroundColor: 'rgba(59, 130, 246, 0.8)',
|
||||||
borderColor: 'rgba(59, 130, 246, 1)',
|
borderColor: 'rgba(59, 130, 246, 1)',
|
||||||
@@ -210,7 +213,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
categoryPercentage: 0.6
|
categoryPercentage: 0.6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Paused',
|
label: this.t.translate('statsUser.completionTimeline.paused'),
|
||||||
data: pausedBooks,
|
data: pausedBooks,
|
||||||
backgroundColor: 'rgba(255, 193, 7, 0.8)',
|
backgroundColor: 'rgba(255, 193, 7, 0.8)',
|
||||||
borderColor: 'rgba(255, 193, 7, 1)',
|
borderColor: 'rgba(255, 193, 7, 1)',
|
||||||
@@ -220,7 +223,7 @@ export class CompletionTimelineChartComponent implements OnInit, OnDestroy {
|
|||||||
categoryPercentage: 0.6
|
categoryPercentage: 0.6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Discontinued',
|
label: this.t.translate('statsUser.completionTimeline.discontinued'),
|
||||||
data: discontinuedBooks,
|
data: discontinuedBooks,
|
||||||
backgroundColor: 'rgba(239, 68, 68, 0.8)',
|
backgroundColor: 'rgba(239, 68, 68, 0.8)',
|
||||||
borderColor: 'rgba(239, 68, 68, 1)',
|
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="favorite-days-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-calendar-plus favorite-days-icon"></i>
|
<i class="pi pi-calendar-plus favorite-days-icon"></i>
|
||||||
Favorite Reading Days
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Reading sessions and duration by day of the week</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="filter-controls">
|
<div class="filter-controls">
|
||||||
<p-select
|
<p-select
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
(onChange)="onFilterChange()"
|
(onChange)="onFilterChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Year"
|
[placeholder]="t('selectYear')"
|
||||||
[style]="{'min-width': '90px'}">
|
[style]="{'min-width': '90px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
<p-select
|
<p-select
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
(onChange)="onFilterChange()"
|
(onChange)="onFilterChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Month"
|
[placeholder]="t('selectMonth')"
|
||||||
[style]="{'min-width': '120px'}">
|
[style]="{'min-width': '120px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,3 +42,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+19
-24
@@ -8,13 +8,14 @@ import {Select} from 'primeng/select';
|
|||||||
import {Tooltip} from 'primeng/tooltip';
|
import {Tooltip} from 'primeng/tooltip';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {FavoriteDaysResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {FavoriteDaysResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type FavoriteDaysChartData = ChartData<'bar', number[], string>;
|
type FavoriteDaysChartData = ChartData<'bar', number[], string>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-favorite-days-chart',
|
selector: 'app-favorite-days-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './favorite-days-chart.component.html',
|
templateUrl: './favorite-days-chart.component.html',
|
||||||
styleUrls: ['./favorite-days-chart.component.scss']
|
styleUrls: ['./favorite-days-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -24,6 +25,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
public readonly chartOptions: ChartConfiguration['options'];
|
public readonly chartOptions: ChartConfiguration['options'];
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<FavoriteDaysChartData>;
|
private readonly chartDataSubject: BehaviorSubject<FavoriteDaysChartData>;
|
||||||
|
|
||||||
@@ -32,21 +34,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
public selectedYear: number | null = null;
|
public selectedYear: number | null = null;
|
||||||
public selectedMonth: number | null = null;
|
public selectedMonth: number | null = null;
|
||||||
public yearOptions: { label: string; value: number | null }[] = [];
|
public yearOptions: { label: string; value: number | null }[] = [];
|
||||||
public monthOptions: { 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}
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.chartDataSubject = new BehaviorSubject<FavoriteDaysChartData>({
|
this.chartDataSubject = new BehaviorSubject<FavoriteDaysChartData>({
|
||||||
@@ -88,8 +76,10 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
label: (context) => {
|
label: (context) => {
|
||||||
const label = context.dataset.label || '';
|
const label = context.dataset.label || '';
|
||||||
const value = context.parsed.y;
|
const value = context.parsed.y;
|
||||||
if (label === 'Sessions') {
|
const sessionsLabel = this.t.translate('statsUser.favoriteDays.sessions');
|
||||||
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
|
if (label === sessionsLabel) {
|
||||||
|
const key = value !== 1 ? 'statsUser.favoriteDays.tooltipSessionsPlural' : 'statsUser.favoriteDays.tooltipSessions';
|
||||||
|
return this.t.translate(key, {label, value});
|
||||||
} else {
|
} else {
|
||||||
const hours = Math.floor(value);
|
const hours = Math.floor(value);
|
||||||
const minutes = Math.floor((value % 1) * 60);
|
const minutes = Math.floor((value % 1) * 60);
|
||||||
@@ -104,7 +94,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Day of Week',
|
text: this.t.translate('statsUser.favoriteDays.axisDayOfWeek'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -125,7 +115,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
position: 'left',
|
position: 'left',
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Sessions',
|
text: this.t.translate('statsUser.favoriteDays.axisNumberOfSessions'),
|
||||||
color: 'rgba(139, 92, 246, 1)',
|
color: 'rgba(139, 92, 246, 1)',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -150,7 +140,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
position: 'right',
|
position: 'right',
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Duration (hours)',
|
text: this.t.translate('statsUser.favoriteDays.axisDurationHours'),
|
||||||
color: 'rgba(236, 72, 153, 1)',
|
color: 'rgba(236, 72, 153, 1)',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -187,10 +177,15 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private initializeYearOptions(): void {
|
private initializeYearOptions(): void {
|
||||||
const currentYear = new Date().getFullYear();
|
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--) {
|
for (let year = currentYear; year >= currentYear - 10; year--) {
|
||||||
this.yearOptions.push({label: year.toString(), value: 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 {
|
public onFilterChange(): void {
|
||||||
@@ -235,7 +230,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Sessions',
|
label: this.t.translate('statsUser.favoriteDays.sessions'),
|
||||||
data: sessionCounts,
|
data: sessionCounts,
|
||||||
backgroundColor: 'rgba(139, 92, 246, 0.8)',
|
backgroundColor: 'rgba(139, 92, 246, 0.8)',
|
||||||
borderColor: 'rgba(139, 92, 246, 1)',
|
borderColor: 'rgba(139, 92, 246, 1)',
|
||||||
@@ -246,7 +241,7 @@ export class FavoriteDaysChartComponent implements OnInit, OnDestroy {
|
|||||||
yAxisID: 'y'
|
yAxisID: 'y'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Duration (hours)',
|
label: this.t.translate('statsUser.favoriteDays.durationHours'),
|
||||||
data: durations,
|
data: durations,
|
||||||
backgroundColor: 'rgba(236, 72, 153, 0.8)',
|
backgroundColor: 'rgba(236, 72, 153, 0.8)',
|
||||||
borderColor: 'rgba(236, 72, 153, 1)',
|
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="genre-stats-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-bar genre-title-icon"></i>
|
<i class="pi pi-chart-bar genre-title-icon"></i>
|
||||||
Reading by Genre
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Top genres by total reading time</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -21,3 +22,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+17
-10
@@ -6,13 +6,14 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
|||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {Tooltip} from 'primeng/tooltip';
|
import {Tooltip} from 'primeng/tooltip';
|
||||||
import {GenreStatsResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {GenreStatsResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type GenreChartData = ChartData<'bar', number[], string>;
|
type GenreChartData = ChartData<'bar', number[], string>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-genre-stats-chart',
|
selector: 'app-genre-stats-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './genre-stats-chart.component.html',
|
templateUrl: './genre-stats-chart.component.html',
|
||||||
styleUrls: ['./genre-stats-chart.component.scss']
|
styleUrls: ['./genre-stats-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -24,6 +25,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
|||||||
public readonly chartOptions: ChartConfiguration['options'];
|
public readonly chartOptions: ChartConfiguration['options'];
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<GenreChartData>;
|
private readonly chartDataSubject: BehaviorSubject<GenreChartData>;
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Genres',
|
text: this.t.translate('statsUser.genreStats.axisGenres'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -104,7 +106,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
|||||||
y: {
|
y: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Time Read',
|
text: this.t.translate('statsUser.genreStats.axisTimeRead'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -121,22 +123,27 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
|||||||
const hours = Math.floor(minutes / 60);
|
const hours = Math.floor(minutes / 60);
|
||||||
const days = Math.floor(hours / 24);
|
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) {
|
if (days > 0) {
|
||||||
const remainingHours = hours % 24;
|
const remainingHours = hours % 24;
|
||||||
if (remainingHours > 0) {
|
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) {
|
} else if (hours > 0) {
|
||||||
const remainingMinutes = minutes % 60;
|
const remainingMinutes = minutes % 60;
|
||||||
if (remainingMinutes > 0) {
|
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) {
|
} else if (minutes > 0) {
|
||||||
return `${minutes} min`;
|
return `${minutes} ${minLabel}`;
|
||||||
}
|
}
|
||||||
return `${seconds} sec`;
|
return `${seconds} ${secLabel}`;
|
||||||
},
|
},
|
||||||
stepSize: undefined,
|
stepSize: undefined,
|
||||||
maxTicksLimit: 8
|
maxTicksLimit: 8
|
||||||
@@ -185,7 +192,7 @@ export class GenreStatsChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Reading Time',
|
label: this.t.translate('statsUser.genreStats.readingTime'),
|
||||||
data: durations,
|
data: durations,
|
||||||
backgroundColor: 'rgba(34, 197, 94, 0.8)',
|
backgroundColor: 'rgba(34, 197, 94, 0.8)',
|
||||||
borderColor: 'rgba(34, 197, 94, 1)',
|
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="page-turner-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-bolt page-turner-icon"></i>
|
<i class="pi pi-bolt page-turner-icon"></i>
|
||||||
Page Turner Score
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</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>
|
</div>
|
||||||
|
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-item">
|
<div class="stat-item">
|
||||||
<span class="stat-value" [title]="stats.mostGripping">{{ stats.mostGripping | slice:0:18 }}</span>
|
<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>
|
||||||
<div class="stat-item">
|
<div class="stat-item">
|
||||||
<span class="stat-value">{{ stats.avgGripScore }}</span>
|
<span class="stat-value">{{ stats.avgGripScore }}</span>
|
||||||
<span class="stat-label">Avg Grip Score</span>
|
<span class="stat-label">{{ t('avgGripScore') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-item">
|
<div class="stat-item">
|
||||||
<span class="stat-value" [title]="stats.guiltyPleasure">{{ stats.guiltyPleasure | slice:0:18 }}</span>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -37,15 +38,15 @@
|
|||||||
<div class="book-info">
|
<div class="book-info">
|
||||||
<span class="book-name">{{ book.bookTitle | slice:0:30 }}</span>
|
<span class="book-name">{{ book.bookTitle | slice:0:30 }}</span>
|
||||||
<div class="book-indicators">
|
<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) }}
|
<i class="pi pi-clock"></i> {{ getAccelerationLabel(book.sessionAcceleration) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="indicator" [title]="'Gap between sessions trend'">
|
<span class="indicator" [title]="t('gapBetweenSessionsTrend')">
|
||||||
<i class="pi pi-calendar"></i> {{ getGapLabel(book.gapReduction) }}
|
<i class="pi pi-calendar"></i> {{ getGapLabel(book.gapReduction) }}
|
||||||
</span>
|
</span>
|
||||||
@if (book.finishBurst) {
|
@if (book.finishBurst) {
|
||||||
<span class="indicator burst">
|
<span class="indicator burst">
|
||||||
<i class="pi pi-forward"></i> Finish Burst
|
<i class="pi pi-forward"></i> {{ t('finishBurst') }}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -64,3 +65,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+15
-13
@@ -6,13 +6,14 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
|||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {ChartConfiguration, ChartData} from 'chart.js';
|
import {ChartConfiguration, ChartData} from 'chart.js';
|
||||||
import {PageTurnerScoreResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {PageTurnerScoreResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type PageTurnerChartData = ChartData<'bar', number[], string>;
|
type PageTurnerChartData = ChartData<'bar', number[], string>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-turner-chart',
|
selector: 'app-page-turner-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './page-turner-chart.component.html',
|
templateUrl: './page-turner-chart.component.html',
|
||||||
styleUrls: ['./page-turner-chart.component.scss']
|
styleUrls: ['./page-turner-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -25,6 +26,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
|||||||
public topBooks: PageTurnerScoreResponse[] = [];
|
public topBooks: PageTurnerScoreResponse[] = [];
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<PageTurnerChartData>;
|
private readonly chartDataSubject: BehaviorSubject<PageTurnerChartData>;
|
||||||
|
|
||||||
@@ -61,7 +63,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Grip Score (0-100)',
|
text: this.t.translate('statsUser.pageTurner.axisGripScore'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 13, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 13, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -145,12 +147,12 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
|||||||
const item = top15[idx];
|
const item = top15[idx];
|
||||||
if (!item) return '';
|
if (!item) return '';
|
||||||
const lines = [
|
const lines = [
|
||||||
`Grip Score: ${item.gripScore}/100`,
|
this.t.translate('statsUser.pageTurner.tooltipGripScore', {score: item.gripScore}),
|
||||||
`Sessions: ${item.totalSessions}`,
|
this.t.translate('statsUser.pageTurner.tooltipSessions', {count: item.totalSessions}),
|
||||||
`Avg Session: ${Math.round(item.avgSessionDurationSeconds / 60)}min`,
|
this.t.translate('statsUser.pageTurner.tooltipAvgSession', {minutes: Math.round(item.avgSessionDurationSeconds / 60)}),
|
||||||
];
|
];
|
||||||
if (item.personalRating) {
|
if (item.personalRating) {
|
||||||
lines.push(`Rating: ${item.personalRating}/10`);
|
lines.push(this.t.translate('statsUser.pageTurner.tooltipRating', {rating: item.personalRating}));
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
};
|
};
|
||||||
@@ -159,7 +161,7 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
|||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels,
|
labels,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Grip Score',
|
label: this.t.translate('statsUser.pageTurner.gripScore'),
|
||||||
data: values,
|
data: values,
|
||||||
backgroundColor: bgColors,
|
backgroundColor: bgColors,
|
||||||
borderColor: bgColors.map(c => c.replace('0.85', '1')),
|
borderColor: bgColors.map(c => c.replace('0.85', '1')),
|
||||||
@@ -172,14 +174,14 @@ export class PageTurnerChartComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getAccelerationLabel(value: number): string {
|
getAccelerationLabel(value: number): string {
|
||||||
if (value > 5) return 'Increasing';
|
if (value > 5) return this.t.translate('statsUser.pageTurner.increasing');
|
||||||
if (value < -5) return 'Decreasing';
|
if (value < -5) return this.t.translate('statsUser.pageTurner.decreasing');
|
||||||
return 'Steady';
|
return this.t.translate('statsUser.pageTurner.steady');
|
||||||
}
|
}
|
||||||
|
|
||||||
getGapLabel(value: number): string {
|
getGapLabel(value: number): string {
|
||||||
if (value < -2) return 'Shrinking';
|
if (value < -2) return this.t.translate('statsUser.pageTurner.shrinking');
|
||||||
if (value > 2) return 'Growing';
|
if (value > 2) return this.t.translate('statsUser.pageTurner.growing');
|
||||||
return 'Steady';
|
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="peak-hours-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-clock peak-hours-icon"></i>
|
<i class="pi pi-clock peak-hours-icon"></i>
|
||||||
Peak Reading Hours
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Reading activity by hour of the day</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="filter-controls">
|
<div class="filter-controls">
|
||||||
<p-select
|
<p-select
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
(onChange)="onFilterChange()"
|
(onChange)="onFilterChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Year"
|
[placeholder]="t('selectYear')"
|
||||||
[style]="{'min-width': '100px'}">
|
[style]="{'min-width': '100px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
<p-select
|
<p-select
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
(onChange)="onFilterChange()"
|
(onChange)="onFilterChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Month"
|
[placeholder]="t('selectMonth')"
|
||||||
[style]="{'min-width': '130px'}">
|
[style]="{'min-width': '130px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,3 +42,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+20
-25
@@ -8,13 +8,14 @@ import {Select} from 'primeng/select';
|
|||||||
import {Tooltip} from 'primeng/tooltip';
|
import {Tooltip} from 'primeng/tooltip';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type PeakHoursChartData = ChartData<'line', number[], string>;
|
type PeakHoursChartData = ChartData<'line', number[], string>;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-peak-hours-chart',
|
selector: 'app-peak-hours-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './peak-hours-chart.component.html',
|
templateUrl: './peak-hours-chart.component.html',
|
||||||
styleUrls: ['./peak-hours-chart.component.scss']
|
styleUrls: ['./peak-hours-chart.component.scss']
|
||||||
})
|
})
|
||||||
@@ -24,27 +25,14 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
public readonly chartOptions: ChartConfiguration['options'];
|
public readonly chartOptions: ChartConfiguration['options'];
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<PeakHoursChartData>;
|
private readonly chartDataSubject: BehaviorSubject<PeakHoursChartData>;
|
||||||
|
|
||||||
public selectedYear: number | null = null;
|
public selectedYear: number | null = null;
|
||||||
public selectedMonth: number | null = null;
|
public selectedMonth: number | null = null;
|
||||||
public yearOptions: { label: string; value: number | null }[] = [];
|
public yearOptions: { label: string; value: number | null }[] = [];
|
||||||
public monthOptions: { 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}
|
|
||||||
];
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.chartDataSubject = new BehaviorSubject<PeakHoursChartData>({
|
this.chartDataSubject = new BehaviorSubject<PeakHoursChartData>({
|
||||||
@@ -86,10 +74,12 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
label: (context) => {
|
label: (context) => {
|
||||||
const label = context.dataset.label || '';
|
const label = context.dataset.label || '';
|
||||||
const value = context.parsed.y;
|
const value = context.parsed.y;
|
||||||
if (label === 'Sessions') {
|
const sessionsLabel = this.t.translate('statsUser.peakHours.sessions');
|
||||||
return `${label}: ${value} session${value !== 1 ? 's' : ''}`;
|
if (label === sessionsLabel) {
|
||||||
|
const key = value !== 1 ? 'statsUser.peakHours.tooltipSessionsPlural' : 'statsUser.peakHours.tooltipSessions';
|
||||||
|
return this.t.translate(key, {label, value});
|
||||||
} else {
|
} 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: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Hour of Day',
|
text: this.t.translate('statsUser.peakHours.axisHourOfDay'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -123,7 +113,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
position: 'left',
|
position: 'left',
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Sessions',
|
text: this.t.translate('statsUser.peakHours.axisNumberOfSessions'),
|
||||||
color: 'rgba(34, 197, 94, 0.9)',
|
color: 'rgba(34, 197, 94, 0.9)',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -148,7 +138,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
position: 'right',
|
position: 'right',
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Avg Duration (min)',
|
text: this.t.translate('statsUser.peakHours.axisAvgDuration'),
|
||||||
color: 'rgba(251, 191, 36, 0.9)',
|
color: 'rgba(251, 191, 36, 0.9)',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -185,10 +175,15 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private initializeYearOptions(): void {
|
private initializeYearOptions(): void {
|
||||||
const currentYear = new Date().getFullYear();
|
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--) {
|
for (let year = currentYear; year >= currentYear - 10; year--) {
|
||||||
this.yearOptions.push({label: year.toString(), value: 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 {
|
public onFilterChange(): void {
|
||||||
@@ -239,7 +234,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Sessions',
|
label: this.t.translate('statsUser.peakHours.sessions'),
|
||||||
data: sessionCounts,
|
data: sessionCounts,
|
||||||
borderColor: 'rgba(34, 197, 94, 0.9)',
|
borderColor: 'rgba(34, 197, 94, 0.9)',
|
||||||
backgroundColor: 'rgba(34, 197, 94, 0.1)',
|
backgroundColor: 'rgba(34, 197, 94, 0.1)',
|
||||||
@@ -254,7 +249,7 @@ export class PeakHoursChartComponent implements OnInit, OnDestroy {
|
|||||||
yAxisID: 'y'
|
yAxisID: 'y'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Avg Duration (min)',
|
label: this.t.translate('statsUser.peakHours.avgDurationMin'),
|
||||||
data: avgDurations,
|
data: avgDurations,
|
||||||
borderColor: 'rgba(251, 191, 36, 0.9)',
|
borderColor: 'rgba(251, 191, 36, 0.9)',
|
||||||
backgroundColor: 'rgba(251, 191, 36, 0.1)',
|
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="personal-rating-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-star-fill personal-rating-icon"></i>
|
<i class="pi pi-star-fill personal-rating-icon"></i>
|
||||||
Personal Rating Distribution
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Books by your rating (1–10)</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -21,4 +22,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+10
-7
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface RatingStats {
|
interface RatingStats {
|
||||||
ratingRange: string;
|
ratingRange: string;
|
||||||
@@ -53,12 +54,13 @@ type RatingChartData = ChartData<'bar', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-personal-rating-chart',
|
selector: 'app-personal-rating-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './personal-rating-chart.component.html',
|
templateUrl: './personal-rating-chart.component.html',
|
||||||
styleUrls: ['./personal-rating-chart.component.scss']
|
styleUrls: ['./personal-rating-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'bar' as const;
|
public readonly chartType = 'bar' as const;
|
||||||
@@ -84,10 +86,11 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
|||||||
titleFont: {size: 14, weight: 'bold'},
|
titleFont: {size: 14, weight: 'bold'},
|
||||||
bodyFont: {size: 13},
|
bodyFont: {size: 13},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => `Personal Rating: ${context[0].label}`,
|
title: (context) => this.t.translate('statsUser.personalRating.tooltipTitle', {label: context[0].label}),
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const value = context.parsed.y;
|
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: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Personal Rating',
|
text: this.t.translate('statsUser.personalRating.axisPersonalRating'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -117,7 +120,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
|||||||
y: {
|
y: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Number of Books',
|
text: this.t.translate('statsUser.personalRating.axisNumberOfBooks'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -145,7 +148,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
|||||||
private readonly chartDataSubject = new BehaviorSubject<RatingChartData>({
|
private readonly chartDataSubject = new BehaviorSubject<RatingChartData>({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books by Personal Rating',
|
label: this.t.translate('statsUser.personalRating.booksByPersonalRating'),
|
||||||
data: [],
|
data: [],
|
||||||
backgroundColor: [...CHART_COLORS],
|
backgroundColor: [...CHART_COLORS],
|
||||||
...CHART_DEFAULTS
|
...CHART_DEFAULTS
|
||||||
@@ -189,7 +192,7 @@ export class PersonalRatingChartComponent implements OnInit, OnDestroy {
|
|||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels: allLabels,
|
labels: allLabels,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books by Personal Rating',
|
label: this.t.translate('statsUser.personalRating.booksByPersonalRating'),
|
||||||
data: dataValues,
|
data: dataValues,
|
||||||
backgroundColor: colors,
|
backgroundColor: colors,
|
||||||
borderColor: colors.map(color => color),
|
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="rating-taste-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-scatter rating-taste-icon"></i>
|
<i class="pi pi-chart-scatter rating-taste-icon"></i>
|
||||||
Rating Taste Comparison
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Compare your personal ratings against external ratings (Goodreads, Amazon, etc.)</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (totalRatedBooks > 0) {
|
@if (totalRatedBooks > 0) {
|
||||||
<div class="stats-badge">
|
<div class="stats-badge">
|
||||||
<span class="badge-value">{{ totalRatedBooks }}</span>
|
<span class="badge-value">{{ totalRatedBooks }}</span>
|
||||||
<span class="badge-label">books analyzed</span>
|
<span class="badge-label">{{ t('booksAnalyzed') }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -27,28 +28,28 @@
|
|||||||
[type]="chartType">
|
[type]="chartType">
|
||||||
</canvas>
|
</canvas>
|
||||||
<div class="quadrant-labels">
|
<div class="quadrant-labels">
|
||||||
<div class="quadrant-label top-left">Hidden Gems 💎</div>
|
<div class="quadrant-label top-left">{{ t('quadrantHiddenGems') }} 💎</div>
|
||||||
<div class="quadrant-label top-right">Popular Favorites ⭐</div>
|
<div class="quadrant-label top-right">{{ t('quadrantPopularFavorites') }} ⭐</div>
|
||||||
<div class="quadrant-label bottom-left">Agreed Misses 👎</div>
|
<div class="quadrant-label bottom-left">{{ t('quadrantAgreedMisses') }} 👎</div>
|
||||||
<div class="quadrant-label bottom-right">Overrated 📉</div>
|
<div class="quadrant-label bottom-right">{{ t('quadrantOverrated') }} 📉</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (quadrants.length > 0) {
|
@if (quadrants.length > 0) {
|
||||||
<div class="taste-insights">
|
<div class="taste-insights">
|
||||||
<div class="insights-header">
|
<div class="insights-header">
|
||||||
<h4>Your Taste Profile</h4>
|
<h4>{{ t('tasteProfile') }}</h4>
|
||||||
@if (averageDeviation > 0) {
|
@if (averageDeviation > 0) {
|
||||||
<div class="deviation-badge" [class.unique]="averageDeviation > 1" [class.mainstream]="averageDeviation <= 0.5">
|
<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-value">{{ averageDeviation.toFixed(2) }} ★</span>
|
||||||
<span class="deviation-desc">
|
<span class="deviation-desc">
|
||||||
@if (averageDeviation > 1) {
|
@if (averageDeviation > 1) {
|
||||||
(Unique taste)
|
({{ t('uniqueTaste') }})
|
||||||
} @else if (averageDeviation <= 0.5) {
|
} @else if (averageDeviation <= 0.5) {
|
||||||
(Mainstream)
|
({{ t('mainstream') }})
|
||||||
} @else {
|
} @else {
|
||||||
(Balanced)
|
({{ t('balanced') }})
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -76,3 +77,4 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {LibraryFilterService} from '../../../library-stats/service/library-filter.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface TasteQuadrant {
|
interface TasteQuadrant {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -31,13 +32,14 @@ type RatingTasteChartData = ChartData<'scatter', BookDataPoint[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-rating-taste-chart',
|
selector: 'app-rating-taste-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './rating-taste-chart.component.html',
|
templateUrl: './rating-taste-chart.component.html',
|
||||||
styleUrls: ['./rating-taste-chart.component.scss']
|
styleUrls: ['./rating-taste-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'scatter' as const;
|
public readonly chartType = 'scatter' as const;
|
||||||
@@ -57,7 +59,7 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 5,
|
max: 5,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'External Rating (1-5 scale)',
|
text: this.t.translate('statsUser.ratingTaste.axisExternalRating'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -83,7 +85,7 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 5,
|
max: 5,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Your Personal Rating (normalized from 1-10)',
|
text: this.t.translate('statsUser.ratingTaste.axisPersonalRating'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -134,17 +136,17 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => {
|
title: (context) => {
|
||||||
const point = context[0].raw as BookDataPoint;
|
const point = context[0].raw as BookDataPoint;
|
||||||
return point.bookTitle || 'Unknown Book';
|
return point.bookTitle || this.t.translate('statsUser.ratingTaste.tooltipUnknownBook');
|
||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const point = context.raw as BookDataPoint;
|
const point = context.raw as BookDataPoint;
|
||||||
const diff = point.personalRatingNormalized - point.externalRating;
|
const diff = point.personalRatingNormalized - point.externalRating;
|
||||||
const diffText = diff > 0 ? `+${diff.toFixed(1)}` : diff.toFixed(1);
|
const diffText = diff > 0 ? `+${diff.toFixed(1)}` : diff.toFixed(1);
|
||||||
return [
|
return [
|
||||||
`Your Rating: ${point.personalRating}/10 (${point.personalRatingNormalized.toFixed(1)}/5)`,
|
this.t.translate('statsUser.ratingTaste.tooltipYourRating', {rating: point.personalRating, normalized: point.personalRatingNormalized.toFixed(1)}),
|
||||||
`External Rating: ${point.externalRating.toFixed(1)}/5`,
|
this.t.translate('statsUser.ratingTaste.tooltipExternalRating', {rating: point.externalRating.toFixed(1)}),
|
||||||
`Difference: ${diffText} (on 5-point scale)`,
|
this.t.translate('statsUser.ratingTaste.tooltipDifference', {diff: diffText}),
|
||||||
`Category: ${point.quadrant}`
|
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[]> {
|
private categorizeBooks(books: Book[]): Map<string, BookDataPoint[]> {
|
||||||
const categories = new Map<string, BookDataPoint[]>([
|
const categories = new Map<string, BookDataPoint[]>([
|
||||||
['Hidden Gems', []],
|
[this.t.translate('statsUser.ratingTaste.quadrantHiddenGems'), []],
|
||||||
['Popular Favorites', []],
|
[this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites'), []],
|
||||||
['Overrated', []],
|
[this.t.translate('statsUser.ratingTaste.quadrantOverrated'), []],
|
||||||
['Agreed Misses', []]
|
[this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses'), []]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
books.forEach(book => {
|
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
|
// Use normalized rating (3 is midpoint on 1-5 scale) for quadrant calculation
|
||||||
let quadrant: string;
|
let quadrant: string;
|
||||||
if (personalRatingNormalized >= 3 && externalRating >= 3) {
|
if (personalRatingNormalized >= 3 && externalRating >= 3) {
|
||||||
quadrant = 'Popular Favorites';
|
quadrant = this.t.translate('statsUser.ratingTaste.quadrantPopularFavorites');
|
||||||
} else if (personalRatingNormalized >= 3 && externalRating < 3) {
|
} else if (personalRatingNormalized >= 3 && externalRating < 3) {
|
||||||
quadrant = 'Hidden Gems';
|
quadrant = this.t.translate('statsUser.ratingTaste.quadrantHiddenGems');
|
||||||
} else if (personalRatingNormalized < 3 && externalRating >= 3) {
|
} else if (personalRatingNormalized < 3 && externalRating >= 3) {
|
||||||
quadrant = 'Overrated';
|
quadrant = this.t.translate('statsUser.ratingTaste.quadrantOverrated');
|
||||||
} else {
|
} else {
|
||||||
quadrant = 'Agreed Misses';
|
quadrant = this.t.translate('statsUser.ratingTaste.quadrantAgreedMisses');
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataPoint: BookDataPoint = {
|
const dataPoint: BookDataPoint = {
|
||||||
@@ -303,11 +305,15 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateChartData(dataPoints: Map<string, BookDataPoint[]>): void {
|
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 }> = {
|
const quadrantColors: Record<string, { bg: string, border: string }> = {
|
||||||
'Popular Favorites': {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
[pf]: {bg: 'rgba(76, 175, 80, 0.7)', border: '#4caf50'},
|
||||||
'Hidden Gems': {bg: 'rgba(156, 39, 176, 0.7)', border: '#9c27b0'},
|
[hg]: {bg: 'rgba(156, 39, 176, 0.7)', border: '#9c27b0'},
|
||||||
'Overrated': {bg: 'rgba(255, 152, 0, 0.7)', border: '#ff9800'},
|
[or]: {bg: 'rgba(255, 152, 0, 0.7)', border: '#ff9800'},
|
||||||
'Agreed Misses': {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
[am]: {bg: 'rgba(158, 158, 158, 0.7)', border: '#9e9e9e'}
|
||||||
};
|
};
|
||||||
|
|
||||||
const datasets = Array.from(dataPoints.entries())
|
const datasets = Array.from(dataPoints.entries())
|
||||||
@@ -326,24 +332,28 @@ export class RatingTasteChartComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private calculateStatistics(dataPoints: Map<string, BookDataPoint[]>): void {
|
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 }> = {
|
const quadrantInfo: Record<string, { description: string, icon: string, color: string }> = {
|
||||||
'Popular Favorites': {
|
[pfKey]: {
|
||||||
description: 'Books you and the public both love',
|
description: this.t.translate('statsUser.ratingTaste.quadrantDescPopularFavorites'),
|
||||||
icon: '⭐',
|
icon: '⭐',
|
||||||
color: '#4caf50'
|
color: '#4caf50'
|
||||||
},
|
},
|
||||||
'Hidden Gems': {
|
[hgKey]: {
|
||||||
description: 'Books you rate higher than the public',
|
description: this.t.translate('statsUser.ratingTaste.quadrantDescHiddenGems'),
|
||||||
icon: '💎',
|
icon: '💎',
|
||||||
color: '#9c27b0'
|
color: '#9c27b0'
|
||||||
},
|
},
|
||||||
'Overrated': {
|
[orKey]: {
|
||||||
description: 'Popular books that disappointed you',
|
description: this.t.translate('statsUser.ratingTaste.quadrantDescOverrated'),
|
||||||
icon: '📉',
|
icon: '📉',
|
||||||
color: '#ff9800'
|
color: '#ff9800'
|
||||||
},
|
},
|
||||||
'Agreed Misses': {
|
[amKey]: {
|
||||||
description: 'Books neither you nor public enjoyed',
|
description: this.t.translate('statsUser.ratingTaste.quadrantDescAgreedMisses'),
|
||||||
icon: '👎',
|
icon: '👎',
|
||||||
color: '#9e9e9e'
|
color: '#9e9e9e'
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -1,16 +1,17 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsUser.readStatus'">
|
||||||
<div class="read-status-container">
|
<div class="read-status-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-book read-status-icon"></i>
|
<i class="pi pi-book read-status-icon"></i>
|
||||||
Reading Status Distribution
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Books by their reading status</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -21,3 +22,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+36
-34
@@ -3,28 +3,30 @@ import {CommonModule} from '@angular/common';
|
|||||||
import {BaseChartDirective} from 'ng2-charts';
|
import {BaseChartDirective} from 'ng2-charts';
|
||||||
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||||
import {catchError, filter, first, takeUntil} from 'rxjs/operators';
|
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 {Tooltip} from 'primeng/tooltip';
|
||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ReadingStatusStats {
|
interface ReadingStatusStats {
|
||||||
status: string;
|
status: string;
|
||||||
|
rawStatus: ReadStatus;
|
||||||
count: number;
|
count: number;
|
||||||
percentage: number;
|
percentage: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const STATUS_COLOR_MAP: Record<string, string> = {
|
const STATUS_COLOR_MAP: Record<string, string> = {
|
||||||
'Unread': '#6c757d', // Gray
|
[ReadStatus.UNREAD]: '#6c757d',
|
||||||
'Currently Reading': '#17a2b8', // Cyan
|
[ReadStatus.READING]: '#17a2b8',
|
||||||
'Re-reading': '#6f42c1', // Purple
|
[ReadStatus.RE_READING]: '#6f42c1',
|
||||||
'Read': '#28a745', // Green
|
[ReadStatus.READ]: '#28a745',
|
||||||
'Partially Read': '#ffc107', // Yellow
|
[ReadStatus.PARTIALLY_READ]: '#ffc107',
|
||||||
'Paused': '#fd7e14', // Orange
|
[ReadStatus.PAUSED]: '#fd7e14',
|
||||||
"Won't Read": '#dc3545', // Red
|
[ReadStatus.WONT_READ]: '#dc3545',
|
||||||
'Abandoned': '#e74c3c', // Light Red
|
[ReadStatus.ABANDONED]: '#e74c3c',
|
||||||
'No Status': '#343a40' // Dark Gray
|
[ReadStatus.UNSET]: '#343a40'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const CHART_DEFAULTS = {
|
const CHART_DEFAULTS = {
|
||||||
@@ -39,12 +41,13 @@ type StatusChartData = ChartData<'doughnut', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-read-status-chart',
|
selector: 'app-read-status-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './read-status-chart.component.html',
|
templateUrl: './read-status-chart.component.html',
|
||||||
styleUrls: ['./read-status-chart.component.scss']
|
styleUrls: ['./read-status-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'doughnut' as const;
|
public readonly chartType = 'doughnut' as const;
|
||||||
@@ -84,7 +87,15 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
|||||||
bodyFont: {size: 13},
|
bodyFont: {size: 13},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => context[0]?.label || '',
|
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 {
|
try {
|
||||||
const labels = stats.map(s => s.status);
|
const labels = stats.map(s => s.status);
|
||||||
const dataValues = stats.map(s => s.count);
|
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({
|
this.chartDataSubject.next({
|
||||||
labels,
|
labels,
|
||||||
@@ -196,6 +207,7 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
|||||||
return Array.from(statusMap.entries())
|
return Array.from(statusMap.entries())
|
||||||
.map(([status, count]) => ({
|
.map(([status, count]) => ({
|
||||||
status: this.formatReadStatus(status),
|
status: this.formatReadStatus(status),
|
||||||
|
rawStatus: status,
|
||||||
count,
|
count,
|
||||||
percentage: Number(((count / totalBooks) * 100).toFixed(1))
|
percentage: Number(((count / totalBooks) * 100).toFixed(1))
|
||||||
}))
|
}))
|
||||||
@@ -204,19 +216,19 @@ export class ReadStatusChartComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private formatReadStatus(status: ReadStatus | null | undefined): string {
|
private formatReadStatus(status: ReadStatus | null | undefined): string {
|
||||||
const STATUS_MAPPING: Record<string, string> = {
|
const STATUS_MAPPING: Record<string, string> = {
|
||||||
[ReadStatus.UNREAD]: 'Unread',
|
[ReadStatus.UNREAD]: this.t.translate('statsUser.readStatus.unread'),
|
||||||
[ReadStatus.READING]: 'Currently Reading',
|
[ReadStatus.READING]: this.t.translate('statsUser.readStatus.currentlyReading'),
|
||||||
[ReadStatus.RE_READING]: 'Re-reading',
|
[ReadStatus.RE_READING]: this.t.translate('statsUser.readStatus.reReading'),
|
||||||
[ReadStatus.READ]: 'Read',
|
[ReadStatus.READ]: this.t.translate('statsUser.readStatus.read'),
|
||||||
[ReadStatus.PARTIALLY_READ]: 'Partially Read',
|
[ReadStatus.PARTIALLY_READ]: this.t.translate('statsUser.readStatus.partiallyRead'),
|
||||||
[ReadStatus.PAUSED]: 'Paused',
|
[ReadStatus.PAUSED]: this.t.translate('statsUser.readStatus.paused'),
|
||||||
[ReadStatus.WONT_READ]: "Won't Read",
|
[ReadStatus.WONT_READ]: this.t.translate('statsUser.readStatus.wontRead'),
|
||||||
[ReadStatus.ABANDONED]: 'Abandoned',
|
[ReadStatus.ABANDONED]: this.t.translate('statsUser.readStatus.abandoned'),
|
||||||
[ReadStatus.UNSET]: 'No Status'
|
[ReadStatus.UNSET]: this.t.translate('statsUser.readStatus.noStatus')
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!status) return 'No Status';
|
if (!status) return this.t.translate('statsUser.readStatus.noStatus');
|
||||||
return STATUS_MAPPING[status] ?? 'No Status';
|
return STATUS_MAPPING[status] ?? this.t.translate('statsUser.readStatus.noStatus');
|
||||||
}
|
}
|
||||||
|
|
||||||
private generateLegendLabels(chart: Chart) {
|
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="reading-clock-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-clock reading-clock-icon"></i>
|
<i class="pi pi-clock reading-clock-icon"></i>
|
||||||
Reading Clock
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">When do you read throughout the day</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -18,15 +19,15 @@
|
|||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card peak">
|
<div class="stat-card peak">
|
||||||
<span class="stat-value">{{ peakHour }}</span>
|
<span class="stat-value">{{ peakHour }}</span>
|
||||||
<span class="stat-label">Peak Hour</span>
|
<span class="stat-label">{{ t('peakHour') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card total">
|
<div class="stat-card total">
|
||||||
<span class="stat-value">{{ totalHoursRead }}h</span>
|
<span class="stat-value">{{ totalHoursRead }}h</span>
|
||||||
<span class="stat-label">Total Read</span>
|
<span class="stat-label">{{ t('totalRead') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card type">
|
<div class="stat-card type">
|
||||||
<span class="stat-value">{{ readerType }}</span>
|
<span class="stat-value">{{ readerType }}</span>
|
||||||
<span class="stat-label">Reader Type</span>
|
<span class="stat-label">{{ t('readerType') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -42,8 +43,9 @@
|
|||||||
@if (!hasData) {
|
@if (!hasData) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No reading session data found.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
<small>Track your reading sessions to see your reading clock.</small>
|
<small>{{ t('noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+8
-6
@@ -6,6 +6,7 @@ import {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
|||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {ChartConfiguration, ChartData} from 'chart.js';
|
import {ChartConfiguration, ChartData} from 'chart.js';
|
||||||
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {PeakHoursResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type ClockChartData = ChartData<'polarArea', number[], string>;
|
type ClockChartData = ChartData<'polarArea', number[], string>;
|
||||||
|
|
||||||
@@ -19,12 +20,13 @@ const HOUR_LABELS = [
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-clock-chart',
|
selector: 'app-reading-clock-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-clock-chart.component.html',
|
templateUrl: './reading-clock-chart.component.html',
|
||||||
styleUrls: ['./reading-clock-chart.component.scss']
|
styleUrls: ['./reading-clock-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'polarArea' as const;
|
public readonly chartType = 'polarArea' as const;
|
||||||
@@ -59,9 +61,9 @@ export class ReadingClockChartComponent implements OnInit, OnDestroy {
|
|||||||
if (minutes >= 60) {
|
if (minutes >= 60) {
|
||||||
const hrs = Math.floor(minutes / 60);
|
const hrs = Math.floor(minutes / 60);
|
||||||
const mins = Math.round(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);
|
const morningTotal = morningHours.reduce((sum, h) => sum + hourMinutes[h], 0);
|
||||||
|
|
||||||
if (nightTotal > morningTotal * 1.2) {
|
if (nightTotal > morningTotal * 1.2) {
|
||||||
this.readerType = 'Night Owl';
|
this.readerType = this.t.translate('statsUser.readingClock.nightOwl');
|
||||||
} else if (morningTotal > nightTotal * 1.2) {
|
} else if (morningTotal > nightTotal * 1.2) {
|
||||||
this.readerType = 'Early Bird';
|
this.readerType = this.t.translate('statsUser.readingClock.earlyBird');
|
||||||
} else {
|
} else {
|
||||||
this.readerType = 'Balanced';
|
this.readerType = this.t.translate('statsUser.readingClock.balanced');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate colors: cool blues for low, warm oranges for peak
|
// 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="reading-dna-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-line reading-dna-icon"></i>
|
<i class="pi pi-chart-line reading-dna-icon"></i>
|
||||||
Reading DNA Profile
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Your unique reading personality across 8 dimensions</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (personalityInsights.length > 0) {
|
@if (personalityInsights.length > 0) {
|
||||||
<div class="personality-insights">
|
<div class="personality-insights">
|
||||||
<h4>Your Reading Personality Traits</h4>
|
<h4>{{ t('personalityTraits') }}</h4>
|
||||||
<div class="insights-grid">
|
<div class="insights-grid">
|
||||||
@for (insight of personalityInsights; track insight.trait) {
|
@for (insight of personalityInsights; track insight.trait) {
|
||||||
<div class="insight-card">
|
<div class="insight-card">
|
||||||
@@ -40,3 +41,4 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+28
-90
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ReadingDNAProfile {
|
interface ReadingDNAProfile {
|
||||||
adventurous: number;
|
adventurous: number;
|
||||||
@@ -32,12 +33,13 @@ type ReadingDNAChartData = ChartData<'radar', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-dna-chart',
|
selector: 'app-reading-dna-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-dna-chart.component.html',
|
templateUrl: './reading-dna-chart.component.html',
|
||||||
styleUrls: ['./reading-dna-chart.component.scss']
|
styleUrls: ['./reading-dna-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'radar' as const;
|
public readonly chartType = 'radar' as const;
|
||||||
@@ -77,18 +79,12 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
|||||||
size: 12
|
size: 12
|
||||||
},
|
},
|
||||||
padding: 25,
|
padding: 25,
|
||||||
callback: function (label: string) {
|
callback: (label: string) => {
|
||||||
const icons: Record<string, string> = {
|
const traitKeys = ['adventurous', 'perfectionist', 'intellectual', 'emotional', 'patient', 'social', 'nostalgic', 'ambitious'];
|
||||||
'Adventurous': '🌟',
|
const icons = ['🌟', '💎', '🧠', '💖', '🕰️', '👥', '📚', '🚀'];
|
||||||
'Perfectionist': '💎',
|
const translatedLabels = traitKeys.map(k => this.t.translate(`statsUser.readingDna.traits.${k}`));
|
||||||
'Intellectual': '🧠',
|
const idx = translatedLabels.indexOf(label);
|
||||||
'Emotional': '💖',
|
return [idx >= 0 ? icons[idx] : '', label];
|
||||||
'Patient': '🕰️',
|
|
||||||
'Social': '👥',
|
|
||||||
'Nostalgic': '📚',
|
|
||||||
'Ambitious': '🚀'
|
|
||||||
};
|
|
||||||
return [icons[label] || '', label];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,16 +107,16 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => {
|
title: (context) => {
|
||||||
const label = context[0]?.label || '';
|
const label = context[0]?.label || '';
|
||||||
return `${label} Personality`;
|
return this.t.translate('statsUser.readingDna.tooltipPersonality', {label});
|
||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const score = context.parsed.r;
|
const score = context.parsed.r;
|
||||||
const insight = this.personalityInsights.find(i => i.trait === context.label);
|
const insight = this.personalityInsights.find(i => i.trait === context.label);
|
||||||
|
|
||||||
return [
|
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>({
|
private readonly chartDataSubject = new BehaviorSubject<ReadingDNAChartData>({
|
||||||
labels: [
|
labels: [],
|
||||||
'Adventurous', 'Perfectionist', 'Intellectual', 'Emotional',
|
|
||||||
'Patient', 'Social', 'Nostalgic', 'Ambitious'
|
|
||||||
],
|
|
||||||
datasets: []
|
datasets: []
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -200,13 +195,12 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
|||||||
'#9c27b0', '#3f51b5', '#673ab7', '#009688'
|
'#9c27b0', '#3f51b5', '#673ab7', '#009688'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const translatedLabels = this.traitKeys.map(k => this.t.translate(`statsUser.readingDna.traits.${k}`));
|
||||||
|
|
||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels: [
|
labels: translatedLabels,
|
||||||
'Adventurous', 'Perfectionist', 'Intellectual', 'Emotional',
|
|
||||||
'Patient', 'Social', 'Nostalgic', 'Ambitious'
|
|
||||||
],
|
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Reading DNA Profile',
|
label: this.t.translate('statsUser.readingDna.readingDnaProfile'),
|
||||||
data,
|
data,
|
||||||
backgroundColor: 'rgba(233, 30, 99, 0.2)',
|
backgroundColor: 'rgba(233, 30, 99, 0.2)',
|
||||||
borderColor: '#e91e63',
|
borderColor: '#e91e63',
|
||||||
@@ -441,75 +435,19 @@ export class ReadingDNAChartComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTraitDescription(trait: string, score: number): string {
|
private getTraitDescription(traitKey: string, score: number): string {
|
||||||
const descriptions: Record<string, [string, string, string]> = {
|
const level = score < 33 ? 'low' : score < 67 ? 'mid' : 'high';
|
||||||
'Adventurous': [
|
return this.t.translate(`statsUser.readingDna.descriptions.${traitKey}.${level}`);
|
||||||
'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 buildPersonalityInsights(profile: ReadingDNAProfile): PersonalityInsight[] {
|
private buildPersonalityInsights(profile: ReadingDNAProfile): PersonalityInsight[] {
|
||||||
const traits: { key: keyof ReadingDNAProfile; trait: string; color: string }[] = [
|
const traitColors = ['#e91e63', '#2196f3', '#00bcd4', '#ff9800', '#9c27b0', '#3f51b5', '#673ab7', '#009688'];
|
||||||
{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'}
|
|
||||||
];
|
|
||||||
|
|
||||||
return traits.map(({key, trait, color}) => ({
|
return this.traitKeys.map((key, i) => ({
|
||||||
trait,
|
trait: this.t.translate(`statsUser.readingDna.traits.${key}`),
|
||||||
score: profile[key],
|
score: profile[key as keyof ReadingDNAProfile],
|
||||||
description: this.getTraitDescription(trait, profile[key]),
|
description: this.getTraitDescription(key, profile[key as keyof ReadingDNAProfile]),
|
||||||
color
|
color: traitColors[i]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-4
@@ -1,16 +1,17 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsUser.readingHabits'">
|
||||||
<div class="reading-habits-container">
|
<div class="reading-habits-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-line reading-habits-icon"></i>
|
<i class="pi pi-chart-line reading-habits-icon"></i>
|
||||||
Reading Habits Analysis
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Your behavioral reading patterns across 8 dimensions</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (habitInsights.length > 0) {
|
@if (habitInsights.length > 0) {
|
||||||
<div class="habit-insights">
|
<div class="habit-insights">
|
||||||
<h4>Your Reading Habit Patterns</h4>
|
<h4>{{ t('habitPatterns') }}</h4>
|
||||||
<div class="insights-grid">
|
<div class="insights-grid">
|
||||||
@for (insight of habitInsights; track insight.habit) {
|
@for (insight of habitInsights; track insight.habit) {
|
||||||
<div class="insight-card">
|
<div class="insight-card">
|
||||||
@@ -40,3 +41,4 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+27
-90
@@ -8,6 +8,7 @@ import {Tooltip} from 'primeng/tooltip';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ReadingHabitsProfile {
|
interface ReadingHabitsProfile {
|
||||||
consistency: number;
|
consistency: number;
|
||||||
@@ -32,14 +33,17 @@ type ReadingHabitsChartData = ChartData<'radar', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-habits-chart',
|
selector: 'app-reading-habits-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-habits-chart.component.html',
|
templateUrl: './reading-habits-chart.component.html',
|
||||||
styleUrls: ['./reading-habits-chart.component.scss']
|
styleUrls: ['./reading-habits-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
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 chartType = 'radar' as const;
|
||||||
|
|
||||||
public readonly chartOptions: ChartConfiguration<'radar'>['options'] = {
|
public readonly chartOptions: ChartConfiguration<'radar'>['options'] = {
|
||||||
@@ -77,18 +81,11 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
|||||||
size: 12
|
size: 12
|
||||||
},
|
},
|
||||||
padding: 25,
|
padding: 25,
|
||||||
callback: function (label: string) {
|
callback: (label: string) => {
|
||||||
const icons: Record<string, string> = {
|
const icons = ['📅', '📚', '✅', '🔍', '📋', '⚡', '🎯', '🔥'];
|
||||||
'Consistency': '📅',
|
const translatedLabels = this.habitKeys.map(k => this.t.translate(`statsUser.readingHabits.habits.${k}`));
|
||||||
'Multitasking': '📚',
|
const idx = translatedLabels.indexOf(label);
|
||||||
'Completionism': '✅',
|
return [idx >= 0 ? icons[idx] : '', label];
|
||||||
'Exploration': '🔍',
|
|
||||||
'Organization': '📋',
|
|
||||||
'Intensity': '⚡',
|
|
||||||
'Methodology': '🎯',
|
|
||||||
'Momentum': '🔥'
|
|
||||||
};
|
|
||||||
return [icons[label] || '', label];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,16 +108,16 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
|||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => {
|
title: (context) => {
|
||||||
const label = context[0]?.label || '';
|
const label = context[0]?.label || '';
|
||||||
return `${label} Habit`;
|
return this.t.translate('statsUser.readingHabits.tooltipHabit', {label});
|
||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const score = context.parsed.r;
|
const score = context.parsed.r;
|
||||||
const insight = this.habitInsights.find(i => i.habit === context.label);
|
const insight = this.habitInsights.find(i => i.habit === context.label);
|
||||||
|
|
||||||
return [
|
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>({
|
private readonly chartDataSubject = new BehaviorSubject<ReadingHabitsChartData>({
|
||||||
labels: [
|
labels: [],
|
||||||
'Consistency', 'Multitasking', 'Completionism', 'Exploration',
|
|
||||||
'Organization', 'Intensity', 'Methodology', 'Momentum'
|
|
||||||
],
|
|
||||||
datasets: []
|
datasets: []
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -200,13 +194,12 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
|||||||
'#ffc107', '#4caf50', '#2196f3', '#673ab7'
|
'#ffc107', '#4caf50', '#2196f3', '#673ab7'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const translatedLabels = this.habitKeys.map(k => this.t.translate(`statsUser.readingHabits.habits.${k}`));
|
||||||
|
|
||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels: [
|
labels: translatedLabels,
|
||||||
'Consistency', 'Multitasking', 'Completionism', 'Exploration',
|
|
||||||
'Organization', 'Intensity', 'Methodology', 'Momentum'
|
|
||||||
],
|
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Reading Habits Profile',
|
label: this.t.translate('statsUser.readingHabits.readingHabitsProfile'),
|
||||||
data,
|
data,
|
||||||
backgroundColor: 'rgba(156, 39, 176, 0.2)',
|
backgroundColor: 'rgba(156, 39, 176, 0.2)',
|
||||||
borderColor: '#9c27b0',
|
borderColor: '#9c27b0',
|
||||||
@@ -509,75 +502,19 @@ export class ReadingHabitsChartComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getHabitDescription(habit: string, score: number): string {
|
private getHabitDescription(habitKey: string, score: number): string {
|
||||||
const descriptions: Record<string, [string, string, string]> = {
|
const level = score < 33 ? 'low' : score < 67 ? 'mid' : 'high';
|
||||||
'Consistency': [
|
return this.t.translate(`statsUser.readingHabits.descriptions.${habitKey}.${level}`);
|
||||||
'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 buildHabitInsights(profile: ReadingHabitsProfile): HabitInsight[] {
|
private buildHabitInsights(profile: ReadingHabitsProfile): HabitInsight[] {
|
||||||
const habits: { key: keyof ReadingHabitsProfile; habit: string; color: string }[] = [
|
const habitColors = ['#9c27b0', '#e91e63', '#ff5722', '#ff9800', '#ffc107', '#4caf50', '#2196f3', '#673ab7'];
|
||||||
{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'}
|
|
||||||
];
|
|
||||||
|
|
||||||
return habits.map(({key, habit, color}) => ({
|
return this.habitKeys.map((key, i) => ({
|
||||||
habit,
|
habit: this.t.translate(`statsUser.readingHabits.habits.${key}`),
|
||||||
score: profile[key],
|
score: profile[key as keyof ReadingHabitsProfile],
|
||||||
description: this.getHabitDescription(habit, profile[key]),
|
description: this.getHabitDescription(key, profile[key as keyof ReadingHabitsProfile]),
|
||||||
color
|
color: habitColors[i]
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-4
@@ -1,16 +1,17 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsUser.readingHeatmap'">
|
||||||
<div class="reading-heatmap-container">
|
<div class="reading-heatmap-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-calendar reading-heatmap-icon"></i>
|
<i class="pi pi-calendar reading-heatmap-icon"></i>
|
||||||
Reading Activity Heatmap
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Monthly reading activity over the past 10 years</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -21,4 +22,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+7
-4
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface MatrixDataPoint {
|
interface MatrixDataPoint {
|
||||||
x: number; // month (0-11)
|
x: number; // month (0-11)
|
||||||
@@ -28,12 +29,13 @@ type HeatmapChartData = ChartData<'matrix', MatrixDataPoint[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-heatmap-chart',
|
selector: 'app-reading-heatmap-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-heatmap-chart.component.html',
|
templateUrl: './reading-heatmap-chart.component.html',
|
||||||
styleUrls: ['./reading-heatmap-chart.component.scss']
|
styleUrls: ['./reading-heatmap-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'matrix' as const;
|
public readonly chartType = 'matrix' as const;
|
||||||
@@ -72,7 +74,8 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const point = context.raw as MatrixDataPoint;
|
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>({
|
private readonly chartDataSubject = new BehaviorSubject<HeatmapChartData>({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books Read',
|
label: this.t.translate('statsUser.readingHeatmap.booksRead'),
|
||||||
data: []
|
data: []
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
@@ -178,7 +181,7 @@ export class ReadingHeatmapChartComponent implements OnInit, OnDestroy {
|
|||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books Read',
|
label: this.t.translate('statsUser.readingHeatmap.booksRead'),
|
||||||
data: heatmapData,
|
data: heatmapData,
|
||||||
backgroundColor: (context) => {
|
backgroundColor: (context) => {
|
||||||
const point = context.raw as MatrixDataPoint;
|
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="reading-progress-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-bar reading-progress-icon"></i>
|
<i class="pi pi-chart-bar reading-progress-icon"></i>
|
||||||
Reading Progress Distribution
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Books by reading completion status</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="chart-wrapper">
|
<div class="chart-wrapper">
|
||||||
@@ -21,3 +22,4 @@
|
|||||||
</canvas>
|
</canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+13
-5
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ReadingProgressStats {
|
interface ReadingProgressStats {
|
||||||
progressRange: string;
|
progressRange: string;
|
||||||
@@ -45,12 +46,13 @@ type ProgressChartData = ChartData<'doughnut', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-progress-chart',
|
selector: 'app-reading-progress-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-progress-chart.component.html',
|
templateUrl: './reading-progress-chart.component.html',
|
||||||
styleUrls: ['./reading-progress-chart.component.scss']
|
styleUrls: ['./reading-progress-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'doughnut' as const;
|
public readonly chartType = 'doughnut' as const;
|
||||||
@@ -118,8 +120,14 @@ export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
const percentage = ((value / total) * 100).toFixed(1);
|
const percentage = ((value / total) * 100).toFixed(1);
|
||||||
const label = context.label;
|
const label = context.label;
|
||||||
const rangeInfo = PROGRESS_RANGES.find(r => r.range === label);
|
const rangeInfo = PROGRESS_RANGES.find(r => r.range === label);
|
||||||
const description = rangeInfo ? ` (${rangeInfo.desc})` : '';
|
const descKeys: Record<string, string> = {
|
||||||
return `${value} book${value === 1 ? '' : 's'}${description} - ${percentage}%`;
|
'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>({
|
private readonly chartDataSubject = new BehaviorSubject<ProgressChartData>({
|
||||||
labels: [],
|
labels: [],
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books by Progress',
|
label: this.t.translate('statsUser.readingProgress.booksByProgress'),
|
||||||
data: [],
|
data: [],
|
||||||
backgroundColor: [...CHART_COLORS],
|
backgroundColor: [...CHART_COLORS],
|
||||||
...CHART_DEFAULTS
|
...CHART_DEFAULTS
|
||||||
@@ -173,7 +181,7 @@ export class ReadingProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels,
|
labels,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Books by Progress',
|
label: this.t.translate('statsUser.readingProgress.booksByProgress'),
|
||||||
data: dataValues,
|
data: dataValues,
|
||||||
backgroundColor: [...CHART_COLORS],
|
backgroundColor: [...CHART_COLORS],
|
||||||
borderColor: '#ffffff',
|
borderColor: '#ffffff',
|
||||||
|
|||||||
+11
-9
@@ -1,29 +1,30 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsUser.sessionHeatmap'">
|
||||||
<div class="reading-session-heatmap-container">
|
<div class="reading-session-heatmap-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-calendar heatmap-title-icon"></i>
|
<i class="pi pi-calendar heatmap-title-icon"></i>
|
||||||
Reading Session Activity
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Daily overview of your reading sessions across the year</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="year-selector">
|
<div class="year-selector">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(-1)"
|
(click)="changeYear(-1)"
|
||||||
title="Previous year">
|
[title]="t('previousYear')">
|
||||||
<i class="pi pi-chevron-left"></i>
|
<i class="pi pi-chevron-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="current-year">{{ currentYear }}</span>
|
<span class="current-year">{{ currentYear }}</span>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="year-nav-btn"
|
class="year-nav-btn"
|
||||||
(click)="changeYear(1)"
|
(click)="changeYear(1)"
|
||||||
title="Next year">
|
[title]="t('nextYear')">
|
||||||
<i class="pi pi-chevron-right"></i>
|
<i class="pi pi-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,16 +43,16 @@
|
|||||||
<div class="chart-footer">
|
<div class="chart-footer">
|
||||||
<div class="footer-pills left">
|
<div class="footer-pills left">
|
||||||
<span class="pill current">
|
<span class="pill current">
|
||||||
<span class="pill-value">{{ currentStreak }}</span> Current Streak
|
<span class="pill-value">{{ currentStreak }}</span> {{ t('currentStreak') }}
|
||||||
</span>
|
</span>
|
||||||
<span class="pill longest">
|
<span class="pill longest">
|
||||||
<span class="pill-value">{{ longestStreak }}</span> Longest Streak
|
<span class="pill-value">{{ longestStreak }}</span> {{ t('longestStreak') }}
|
||||||
</span>
|
</span>
|
||||||
<span class="pill total">
|
<span class="pill total">
|
||||||
<span class="pill-value">{{ totalReadingDays }}</span> Total Days
|
<span class="pill-value">{{ totalReadingDays }}</span> {{ t('totalDays') }}
|
||||||
</span>
|
</span>
|
||||||
<span class="pill consistency">
|
<span class="pill consistency">
|
||||||
<span class="pill-value">{{ consistencyPercent }}%</span> Consistency
|
<span class="pill-value">{{ consistencyPercent }}%</span> {{ t('consistency') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@if (milestones.length > 0) {
|
@if (milestones.length > 0) {
|
||||||
@@ -66,3 +67,4 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BehaviorSubject, EMPTY, Observable, Subject} from 'rxjs';
|
||||||
import {catchError, takeUntil} from 'rxjs/operators';
|
import {catchError, takeUntil} from 'rxjs/operators';
|
||||||
import {ReadingSessionHeatmapResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
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 DAY_NAMES = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||||
const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
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({
|
@Component({
|
||||||
selector: 'app-reading-session-heatmap',
|
selector: 'app-reading-session-heatmap',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-session-heatmap.component.html',
|
templateUrl: './reading-session-heatmap.component.html',
|
||||||
styleUrls: ['./reading-session-heatmap.component.scss']
|
styleUrls: ['./reading-session-heatmap.component.scss']
|
||||||
})
|
})
|
||||||
@@ -51,6 +52,7 @@ export class ReadingSessionHeatmapComponent implements OnInit, OnDestroy {
|
|||||||
public hasStreakData = false;
|
public hasStreakData = false;
|
||||||
|
|
||||||
private readonly userStatsService = inject(UserStatsService);
|
private readonly userStatsService = inject(UserStatsService);
|
||||||
|
private readonly translocoService = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
private readonly chartDataSubject: BehaviorSubject<SessionHeatmapChartData>;
|
private readonly chartDataSubject: BehaviorSubject<SessionHeatmapChartData>;
|
||||||
private maxSessionCount = 1;
|
private maxSessionCount = 1;
|
||||||
@@ -95,7 +97,9 @@ export class ReadingSessionHeatmapComponent implements OnInit, OnDestroy {
|
|||||||
},
|
},
|
||||||
label: (context) => {
|
label: (context) => {
|
||||||
const point = context.raw as MatrixDataPoint;
|
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
|
// Milestones
|
||||||
this.milestones = [
|
this.milestones = [
|
||||||
{label: '7-Day Streak', icon: '\uD83D\uDD25', requirement: 7, type: 'streak', unlocked: this.longestStreak >= 7},
|
{label: this.translocoService.translate('statsUser.sessionHeatmap.milestone7DayStreak'), 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: this.translocoService.translate('statsUser.sessionHeatmap.milestone30DayStreak'), 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: this.translocoService.translate('statsUser.sessionHeatmap.milestone100ReadingDays'), 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: this.translocoService.translate('statsUser.sessionHeatmap.milestone365ReadingDays'), 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.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-container">
|
||||||
<div class="timeline-header">
|
<div class="timeline-header">
|
||||||
<div class="header-title">
|
<div class="header-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-clock timeline-title-icon"></i>
|
<i class="pi pi-clock timeline-title-icon"></i>
|
||||||
Reading Session Timeline
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="timeline-subtitle">Weekly overview of your reading sessions and patterns</p>
|
<p class="timeline-subtitle">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="week-info">
|
<div class="week-info">
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="week-nav-btn"
|
class="week-nav-btn"
|
||||||
(click)="changeWeek(-1)"
|
(click)="changeWeek(-1)"
|
||||||
title="Previous week">
|
[title]="t('previousWeek')">
|
||||||
<i class="pi pi-chevron-left"></i>
|
<i class="pi pi-chevron-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<div class="week-display">
|
<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>
|
<span class="week-dates">{{ getWeekDateRange() }}</span>
|
||||||
</div>
|
</div>
|
||||||
<button type="button"
|
<button type="button"
|
||||||
class="week-nav-btn"
|
class="week-nav-btn"
|
||||||
(click)="changeWeek(1)"
|
(click)="changeWeek(1)"
|
||||||
title="Next week">
|
[title]="t('nextWeek')">
|
||||||
<i class="pi pi-chevron-right"></i>
|
<i class="pi pi-chevron-right"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
(onChange)="onYearChange()"
|
(onChange)="onYearChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Year"
|
[placeholder]="t('selectYear')"
|
||||||
[style]="{'min-width': '120px'}">
|
[style]="{'min-width': '120px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
<p-select
|
<p-select
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
(onChange)="onWeekChange()"
|
(onChange)="onWeekChange()"
|
||||||
optionLabel="label"
|
optionLabel="label"
|
||||||
optionValue="value"
|
optionValue="value"
|
||||||
placeholder="Select Week"
|
[placeholder]="t('selectWeek')"
|
||||||
[style]="{'min-width': '120px'}">
|
[style]="{'min-width': '120px'}">
|
||||||
</p-select>
|
</p-select>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,3 +108,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+9
-7
@@ -18,6 +18,7 @@ import {
|
|||||||
import {BookType} from '../../../../../book/model/book.model';
|
import {BookType} from '../../../../../book/model/book.model';
|
||||||
import {ReadingSessionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
import {ReadingSessionTimelineResponse, UserStatsService} from '../../../../../settings/user-management/user-stats.service';
|
||||||
import {UrlHelperService} from '../../../../../../shared/service/url-helper.service';
|
import {UrlHelperService} from '../../../../../../shared/service/url-helper.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface ReadingSession {
|
interface ReadingSession {
|
||||||
startTime: Date;
|
startTime: Date;
|
||||||
@@ -52,7 +53,7 @@ interface DayTimeline {
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-session-timeline',
|
selector: 'app-reading-session-timeline',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, Select, FormsModule, Tooltip],
|
imports: [CommonModule, Select, FormsModule, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-session-timeline.component.html',
|
templateUrl: './reading-session-timeline.component.html',
|
||||||
styleUrls: ['./reading-session-timeline.component.scss']
|
styleUrls: ['./reading-session-timeline.component.scss']
|
||||||
})
|
})
|
||||||
@@ -62,6 +63,7 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
|||||||
|
|
||||||
private userStatsService = inject(UserStatsService);
|
private userStatsService = inject(UserStatsService);
|
||||||
private urlHelperService = inject(UrlHelperService);
|
private urlHelperService = inject(UrlHelperService);
|
||||||
|
private translocoService = inject(TranslocoService);
|
||||||
|
|
||||||
public daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
public daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
|
||||||
public hourLabels: string[] = [];
|
public hourLabels: string[] = [];
|
||||||
@@ -96,7 +98,7 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
|||||||
const weeksInYear = getISOWeeksInYear(this.currentDate);
|
const weeksInYear = getISOWeeksInYear(this.currentDate);
|
||||||
this.weekOptions = [];
|
this.weekOptions = [];
|
||||||
for (let week = 1; week <= weeksInYear; week++) {
|
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-details">
|
||||||
<div class="session-tooltip-header">
|
<div class="session-tooltip-header">
|
||||||
<i class="pi pi-book"></i>
|
<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>
|
||||||
<div class="session-tooltip-divider"></div>
|
<div class="session-tooltip-divider"></div>
|
||||||
<div class="session-tooltip-body">
|
<div class="session-tooltip-body">
|
||||||
<div class="session-tooltip-row">
|
<div class="session-tooltip-row">
|
||||||
<i class="pi pi-clock"></i>
|
<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">
|
<span class="session-tooltip-value">
|
||||||
${this.formatTime(session.startHour, session.startMinute)} - ${this.formatTime(session.endHour, session.endMinute)}
|
${this.formatTime(session.startHour, session.startMinute)} - ${this.formatTime(session.endHour, session.endMinute)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="session-tooltip-row">
|
<div class="session-tooltip-row">
|
||||||
<i class="pi pi-hourglass"></i>
|
<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>
|
<span class="session-tooltip-value">${this.formatDuration(session.duration)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="session-tooltip-row">
|
<div class="session-tooltip-row">
|
||||||
<i class="pi pi-file"></i>
|
<i class="pi pi-file"></i>
|
||||||
<span class="session-tooltip-label">Format:</span>
|
<span class="session-tooltip-label">${this.translocoService.translate('statsUser.sessionTimeline.tooltipFormat')}</span>
|
||||||
<span class="session-tooltip-value">${session.bookType || 'Unknown'}</span>
|
<span class="session-tooltip-value">${session.bookType || this.translocoService.translate('statsUser.sessionTimeline.unknown')}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+11
-9
@@ -1,16 +1,17 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'statsUser.readingSurvival'">
|
||||||
<div class="reading-survival-container">
|
<div class="reading-survival-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-chart-line reading-survival-icon"></i>
|
<i class="pi pi-chart-line reading-survival-icon"></i>
|
||||||
Reading Survival Curve
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Of books started, what percentage reached each progress threshold</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -18,20 +19,20 @@
|
|||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ totalStarted }}</span>
|
<span class="stat-value">{{ totalStarted }}</span>
|
||||||
<span class="stat-label">Started</span>
|
<span class="stat-label">{{ t('started') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ completionRate }}%</span>
|
<span class="stat-value">{{ completionRate }}%</span>
|
||||||
<span class="stat-label">Completion Rate</span>
|
<span class="stat-label">{{ t('completionRate') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-value">{{ medianDropout }}</span>
|
<span class="stat-value">{{ medianDropout }}</span>
|
||||||
<span class="stat-label">Median Dropout</span>
|
<span class="stat-label">{{ t('medianDropout') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card danger">
|
<div class="stat-card danger">
|
||||||
<span class="stat-value">{{ dangerZoneRange }}</span>
|
<span class="stat-value">{{ dangerZoneRange }}</span>
|
||||||
<span class="stat-subtitle">{{ dangerZoneDrop }}</span>
|
<span class="stat-subtitle">{{ dangerZoneDrop }}</span>
|
||||||
<span class="stat-label">Danger Zone</span>
|
<span class="stat-label">{{ t('dangerZone') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -47,8 +48,9 @@
|
|||||||
@if (totalStarted === 0) {
|
@if (totalStarted === 0) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No books with reading progress found.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
<small>Start reading some books to see your survival curve.</small>
|
<small>{{ t('noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+8
-6
@@ -8,6 +8,7 @@ import {ChartConfiguration, ChartData} from 'chart.js';
|
|||||||
import {BookService} from '../../../../../book/service/book.service';
|
import {BookService} from '../../../../../book/service/book.service';
|
||||||
import {BookState} from '../../../../../book/model/state/book-state.model';
|
import {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book} from '../../../../../book/model/book.model';
|
import {Book} from '../../../../../book/model/book.model';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
type SurvivalChartData = ChartData<'line', number[], string>;
|
type SurvivalChartData = ChartData<'line', number[], string>;
|
||||||
|
|
||||||
@@ -16,12 +17,13 @@ const THRESHOLDS = [0, 10, 25, 50, 75, 90, 100];
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-reading-survival-chart',
|
selector: 'app-reading-survival-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './reading-survival-chart.component.html',
|
templateUrl: './reading-survival-chart.component.html',
|
||||||
styleUrls: ['./reading-survival-chart.component.scss']
|
styleUrls: ['./reading-survival-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'line' as const;
|
public readonly chartType = 'line' as const;
|
||||||
@@ -51,8 +53,8 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
|||||||
titleFont: {size: 13, weight: 'bold'},
|
titleFont: {size: 13, weight: 'bold'},
|
||||||
bodyFont: {size: 12},
|
bodyFont: {size: 12},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
title: (context) => `${context[0].label} progress`,
|
title: (context) => this.t.translate('statsUser.readingSurvival.tooltipProgress', {label: context[0].label}),
|
||||||
label: (context) => `${(context.parsed.y ?? 0).toFixed(1)}% of books reached this point`
|
label: (context) => this.t.translate('statsUser.readingSurvival.tooltipSurvival', {value: (context.parsed.y ?? 0).toFixed(1)})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
datalabels: {display: false}
|
datalabels: {display: false}
|
||||||
@@ -61,7 +63,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
|||||||
x: {
|
x: {
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Progress Threshold',
|
text: this.t.translate('statsUser.readingSurvival.axisProgressThreshold'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -77,7 +79,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 100,
|
max: 100,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: '% of Books Surviving',
|
text: this.t.translate('statsUser.readingSurvival.axisBooksSurviving'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
font: {family: "'Inter', sans-serif", size: 12, weight: 'bold'}
|
||||||
},
|
},
|
||||||
@@ -164,7 +166,7 @@ export class ReadingSurvivalChartComponent implements OnInit, OnDestroy {
|
|||||||
this.chartDataSubject.next({
|
this.chartDataSubject.next({
|
||||||
labels,
|
labels,
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: 'Survival Rate',
|
label: this.t.translate('statsUser.readingSurvival.survivalRate'),
|
||||||
data: survivalValues,
|
data: survivalValues,
|
||||||
borderColor: '#e91e63',
|
borderColor: '#e91e63',
|
||||||
backgroundColor: 'rgba(233, 30, 99, 0.15)',
|
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="series-progress-container">
|
||||||
<div class="chart-header">
|
<div class="chart-header">
|
||||||
<div class="chart-title">
|
<div class="chart-title">
|
||||||
<h3>
|
<h3>
|
||||||
<i class="pi pi-list series-icon"></i>
|
<i class="pi pi-list series-icon"></i>
|
||||||
Series Progress Tracker
|
{{ t('title') }}
|
||||||
<i class="pi pi-question-circle chart-info-icon"
|
<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"
|
tooltipPosition="bottom"
|
||||||
tooltipStyleClass="chart-info-tooltip"
|
tooltipStyleClass="chart-info-tooltip"
|
||||||
[appendTo]="'body'"></i>
|
[appendTo]="'body'"></i>
|
||||||
</h3>
|
</h3>
|
||||||
<p class="chart-description">Track your reading progress across book series</p>
|
<p class="chart-description">{{ t('description') }}</p>
|
||||||
</div>
|
</div>
|
||||||
@if (stats) {
|
@if (stats) {
|
||||||
<div class="series-summary">
|
<div class="series-summary">
|
||||||
@@ -34,16 +35,16 @@
|
|||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-pill">
|
<div class="stat-pill">
|
||||||
<span class="pill-value">{{ stats.totalSeries }}</span>
|
<span class="pill-value">{{ stats.totalSeries }}</span>
|
||||||
<span class="pill-label">Series</span>
|
<span class="pill-label">{{ t('series') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-pill">
|
<div class="stat-pill">
|
||||||
<span class="pill-value">{{ stats.avgSeriesCompletion }}%</span>
|
<span class="pill-value">{{ stats.avgSeriesCompletion }}%</span>
|
||||||
<span class="pill-label">Avg. Completion</span>
|
<span class="pill-label">{{ t('avgCompletion') }}</span>
|
||||||
</div>
|
</div>
|
||||||
@if (stats.highestRatedSeries) {
|
@if (stats.highestRatedSeries) {
|
||||||
<div class="stat-pill highlight">
|
<div class="stat-pill highlight">
|
||||||
<span class="pill-value">{{ stats.highestRatedSeries.avgPersonalRating?.toFixed(1) }}</span>
|
<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>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -60,8 +61,8 @@
|
|||||||
@if (seriesList.length > 0) {
|
@if (seriesList.length > 0) {
|
||||||
<div class="series-details">
|
<div class="series-details">
|
||||||
<div class="details-header">
|
<div class="details-header">
|
||||||
<h4>Series Breakdown</h4>
|
<h4>{{ t('seriesBreakdown') }}</h4>
|
||||||
<span class="series-count">{{ filteredSeriesList.length }} of {{ seriesList.length }}</span>
|
<span class="series-count">{{ t('ofTotal', { filtered: filteredSeriesList.length, total: seriesList.length }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="controls-row">
|
<div class="controls-row">
|
||||||
@@ -69,7 +70,7 @@
|
|||||||
<i class="pi pi-search"></i>
|
<i class="pi pi-search"></i>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Search series..."
|
[placeholder]="t('searchSeries')"
|
||||||
[value]="searchTerm"
|
[value]="searchTerm"
|
||||||
(input)="onSearchChange($any($event.target).value)"
|
(input)="onSearchChange($any($event.target).value)"
|
||||||
/>
|
/>
|
||||||
@@ -77,17 +78,17 @@
|
|||||||
|
|
||||||
<div class="filter-controls">
|
<div class="filter-controls">
|
||||||
<select class="filter-select" [value]="filterStatus" (change)="onFilterChange($any($event.target).value)">
|
<select class="filter-select" [value]="filterStatus" (change)="onFilterChange($any($event.target).value)">
|
||||||
<option value="all">All Status</option>
|
<option value="all">{{ t('allStatus') }}</option>
|
||||||
<option value="in-progress">In Progress</option>
|
<option value="in-progress">{{ t('inProgress') }}</option>
|
||||||
<option value="completed">Completed</option>
|
<option value="completed">{{ t('completed') }}</option>
|
||||||
<option value="not-started">Not Started</option>
|
<option value="not-started">{{ t('notStarted') }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select class="sort-select" [value]="sortBy" (change)="onSortChange($any($event.target).value)">
|
<select class="sort-select" [value]="sortBy" (change)="onSortChange($any($event.target).value)">
|
||||||
<option value="progress">Sort by Progress</option>
|
<option value="progress">{{ t('sortByProgress') }}</option>
|
||||||
<option value="rating">Sort by Rating</option>
|
<option value="rating">{{ t('sortByRating') }}</option>
|
||||||
<option value="books">Sort by Books</option>
|
<option value="books">{{ t('sortByBooks') }}</option>
|
||||||
<option value="name">Sort by Name</option>
|
<option value="name">{{ t('sortByName') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -103,9 +104,9 @@
|
|||||||
<span class="series-name">{{ series.name }}</span>
|
<span class="series-name">{{ series.name }}</span>
|
||||||
<div class="series-meta">
|
<div class="series-meta">
|
||||||
<span class="books-count">
|
<span class="books-count">
|
||||||
{{ series.booksRead }}/{{ series.booksOwned }} read
|
{{ t('booksRead', { read: series.booksRead, owned: series.booksOwned }) }}
|
||||||
@if (series.totalInSeries) {
|
@if (series.totalInSeries) {
|
||||||
<span class="total-hint">({{ series.totalInSeries }} in series)</span>
|
<span class="total-hint">{{ t('inSeriesHint', { total: series.totalInSeries }) }}</span>
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
@if (series.avgPersonalRating) {
|
@if (series.avgPersonalRating) {
|
||||||
@@ -131,7 +132,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (series.nextUnread && series.status !== 'completed') {
|
@if (series.nextUnread && series.status !== 'completed') {
|
||||||
<div class="next-up">
|
<div class="next-up">
|
||||||
<span class="next-label">Next:</span>
|
<span class="next-label">{{ t('next') }}</span>
|
||||||
<span class="next-title">{{ series.nextUnread }}</span>
|
<span class="next-title">{{ series.nextUnread }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,7 @@
|
|||||||
@if (filteredSeriesList.length === 0 && searchTerm) {
|
@if (filteredSeriesList.length === 0 && searchTerm) {
|
||||||
<div class="no-results">
|
<div class="no-results">
|
||||||
<i class="pi pi-search"></i>
|
<i class="pi pi-search"></i>
|
||||||
<span>No series matching "{{ searchTerm }}"</span>
|
<span>{{ t('noMatchingSearch', { term: searchTerm }) }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -155,7 +156,7 @@
|
|||||||
<i class="pi pi-chevron-left"></i>
|
<i class="pi pi-chevron-left"></i>
|
||||||
</button>
|
</button>
|
||||||
<span class="page-info">
|
<span class="page-info">
|
||||||
Page {{ currentPage + 1 }} of {{ getTotalPages() }}
|
{{ t('pageInfo', { current: currentPage + 1, total: getTotalPages() }) }}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
class="page-btn"
|
class="page-btn"
|
||||||
@@ -171,8 +172,9 @@
|
|||||||
@if (!stats) {
|
@if (!stats) {
|
||||||
<div class="no-data-message">
|
<div class="no-data-message">
|
||||||
<i class="pi pi-info-circle"></i>
|
<i class="pi pi-info-circle"></i>
|
||||||
<p>No series found in your library.</p>
|
<p>{{ t('noData') }}</p>
|
||||||
<small>Books need series metadata to appear here.</small>
|
<small>{{ t('noDataHint') }}</small>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</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 {BookState} from '../../../../../book/model/state/book-state.model';
|
||||||
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
import {Book, ReadStatus} from '../../../../../book/model/book.model';
|
||||||
import {LibraryFilterService} from '../../../library-stats/service/library-filter.service';
|
import {LibraryFilterService} from '../../../library-stats/service/library-filter.service';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
interface SeriesInfo {
|
interface SeriesInfo {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -43,13 +44,14 @@ type SeriesChartData = ChartData<'bar', number[], string>;
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-series-progress-chart',
|
selector: 'app-series-progress-chart',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, BaseChartDirective, Tooltip],
|
imports: [CommonModule, BaseChartDirective, Tooltip, TranslocoDirective],
|
||||||
templateUrl: './series-progress-chart.component.html',
|
templateUrl: './series-progress-chart.component.html',
|
||||||
styleUrls: ['./series-progress-chart.component.scss']
|
styleUrls: ['./series-progress-chart.component.scss']
|
||||||
})
|
})
|
||||||
export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
||||||
private readonly bookService = inject(BookService);
|
private readonly bookService = inject(BookService);
|
||||||
private readonly libraryFilterService = inject(LibraryFilterService);
|
private readonly libraryFilterService = inject(LibraryFilterService);
|
||||||
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly destroy$ = new Subject<void>();
|
private readonly destroy$ = new Subject<void>();
|
||||||
|
|
||||||
public readonly chartType = 'bar' as const;
|
public readonly chartType = 'bar' as const;
|
||||||
@@ -80,7 +82,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
max: 100,
|
max: 100,
|
||||||
title: {
|
title: {
|
||||||
display: true,
|
display: true,
|
||||||
text: 'Completion %',
|
text: this.t.translate('statsUser.seriesProgress.axisCompletion'),
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
font: {
|
font: {
|
||||||
family: "'Inter', sans-serif",
|
family: "'Inter', sans-serif",
|
||||||
@@ -149,13 +151,13 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
const series = this.chartSeries[context[0].dataIndex];
|
const series = this.chartSeries[context[0].dataIndex];
|
||||||
if (!series) return [];
|
if (!series) return [];
|
||||||
const lines = [
|
const lines = [
|
||||||
`Read: ${series.booksRead}/${series.booksOwned} owned`
|
this.t.translate('statsUser.seriesProgress.tooltipRead', {read: series.booksRead, owned: series.booksOwned})
|
||||||
];
|
];
|
||||||
if (series.totalInSeries) {
|
if (series.totalInSeries) {
|
||||||
lines.push(`Series total: ${series.totalInSeries} books`);
|
lines.push(this.t.translate('statsUser.seriesProgress.tooltipSeriesTotal', {total: series.totalInSeries}));
|
||||||
}
|
}
|
||||||
if (series.avgPersonalRating) {
|
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;
|
return lines;
|
||||||
}
|
}
|
||||||
@@ -563,7 +565,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
labels,
|
labels,
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: 'Read',
|
label: this.t.translate('statsUser.seriesProgress.read'),
|
||||||
data: readPercentages,
|
data: readPercentages,
|
||||||
backgroundColor: 'rgba(76, 175, 80, 0.85)',
|
backgroundColor: 'rgba(76, 175, 80, 0.85)',
|
||||||
borderColor: '#4caf50',
|
borderColor: '#4caf50',
|
||||||
@@ -571,7 +573,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Reading',
|
label: this.t.translate('statsUser.seriesProgress.reading'),
|
||||||
data: readingPercentages,
|
data: readingPercentages,
|
||||||
backgroundColor: 'rgba(255, 193, 7, 0.85)',
|
backgroundColor: 'rgba(255, 193, 7, 0.85)',
|
||||||
borderColor: '#ffc107',
|
borderColor: '#ffc107',
|
||||||
@@ -579,7 +581,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Partially Read',
|
label: this.t.translate('statsUser.seriesProgress.partiallyRead'),
|
||||||
data: partiallyReadPercentages,
|
data: partiallyReadPercentages,
|
||||||
backgroundColor: 'rgba(255, 152, 0, 0.85)',
|
backgroundColor: 'rgba(255, 152, 0, 0.85)',
|
||||||
borderColor: '#ff9800',
|
borderColor: '#ff9800',
|
||||||
@@ -587,7 +589,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Paused',
|
label: this.t.translate('statsUser.seriesProgress.paused'),
|
||||||
data: pausedPercentages,
|
data: pausedPercentages,
|
||||||
backgroundColor: 'rgba(33, 150, 243, 0.85)',
|
backgroundColor: 'rgba(33, 150, 243, 0.85)',
|
||||||
borderColor: '#2196f3',
|
borderColor: '#2196f3',
|
||||||
@@ -595,7 +597,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Abandoned',
|
label: this.t.translate('statsUser.seriesProgress.abandoned'),
|
||||||
data: abandonedPercentages,
|
data: abandonedPercentages,
|
||||||
backgroundColor: 'rgba(239, 83, 80, 0.85)',
|
backgroundColor: 'rgba(239, 83, 80, 0.85)',
|
||||||
borderColor: '#ef5350',
|
borderColor: '#ef5350',
|
||||||
@@ -603,7 +605,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Won\'t Read',
|
label: this.t.translate('statsUser.seriesProgress.wontRead'),
|
||||||
data: wontReadPercentages,
|
data: wontReadPercentages,
|
||||||
backgroundColor: 'rgba(158, 158, 158, 0.6)',
|
backgroundColor: 'rgba(158, 158, 158, 0.6)',
|
||||||
borderColor: '#9e9e9e',
|
borderColor: '#9e9e9e',
|
||||||
@@ -611,7 +613,7 @@ export class SeriesProgressChartComponent implements OnInit, OnDestroy {
|
|||||||
borderRadius: 2
|
borderRadius: 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Unread',
|
label: this.t.translate('statsUser.seriesProgress.unread'),
|
||||||
data: unreadPercentages,
|
data: unreadPercentages,
|
||||||
backgroundColor: 'rgba(158, 158, 158, 0.3)',
|
backgroundColor: 'rgba(158, 158, 158, 0.3)',
|
||||||
borderColor: '#9e9e9e',
|
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 {BehaviorSubject, Observable} from 'rxjs';
|
||||||
|
import {TranslocoService} from '@jsverse/transloco';
|
||||||
import {ReadingSessionHeatmapComponent} from '../charts/reading-session-heatmap/reading-session-heatmap.component';
|
import {ReadingSessionHeatmapComponent} from '../charts/reading-session-heatmap/reading-session-heatmap.component';
|
||||||
import {FavoriteDaysChartComponent} from '../charts/favorite-days-chart/favorite-days-chart.component';
|
import {FavoriteDaysChartComponent} from '../charts/favorite-days-chart/favorite-days-chart.component';
|
||||||
import {PeakHoursChartComponent} from '../charts/peak-hours-chart/peak-hours-chart.component';
|
import {PeakHoursChartComponent} from '../charts/peak-hours-chart/peak-hours-chart.component';
|
||||||
@@ -34,6 +35,29 @@ export interface UserChartConfig {
|
|||||||
})
|
})
|
||||||
export class UserChartConfigService {
|
export class UserChartConfigService {
|
||||||
private readonly STORAGE_KEY = 'userStatsChartConfig';
|
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[] = [
|
private readonly defaultCharts: UserChartConfig[] = [
|
||||||
{id: 'heatmap', title: 'Reading Session Heatmap', component: ReadingSessionHeatmapComponent, enabled: true, sizeClass: 'chart-full', order: 0},
|
{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());
|
private chartsSubject = new BehaviorSubject<UserChartConfig[]>(this.loadChartConfig());
|
||||||
public charts$: Observable<UserChartConfig[]> = this.chartsSubject.asObservable();
|
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[] {
|
getVisibleCharts(): UserChartConfig[] {
|
||||||
return this.chartsSubject.value.filter(chart => chart.enabled);
|
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="user-stats-container">
|
||||||
<div class="header-section">
|
<div class="header-section">
|
||||||
<div class="header-content">
|
<div class="header-content">
|
||||||
<div class="greeting">
|
<div class="greeting">
|
||||||
<i class="pi pi-chart-line"></i>
|
<i class="pi pi-chart-line"></i>
|
||||||
<h2>{{ userName }}'s Reading Statistics</h2>
|
<h2>{{ t('main.title', { name: userName }) }}</h2>
|
||||||
</div>
|
</div>
|
||||||
<button class="config-toggle-btn" (click)="toggleConfigPanel()">
|
<button class="config-toggle-btn" (click)="toggleConfigPanel()">
|
||||||
<i class="pi pi-cog"></i>
|
<i class="pi pi-cog"></i>
|
||||||
<span>Customize Layout</span>
|
<span>{{ t('main.customizeLayout') }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
[resizable]="false"
|
[resizable]="false"
|
||||||
[style]="{width: '600px', maxWidth: '90vw'}"
|
[style]="{width: '600px', maxWidth: '90vw'}"
|
||||||
class="config-dialog"
|
class="config-dialog"
|
||||||
header="Chart Configuration">
|
[header]="t('main.chartConfig')">
|
||||||
|
|
||||||
<div class="config-dialog-content">
|
<div class="config-dialog-content">
|
||||||
<div class="config-list" cdkDropList (cdkDropListDropped)="drop($event)">
|
<div class="config-list" cdkDropList (cdkDropListDropped)="drop($event)">
|
||||||
@@ -43,18 +44,18 @@
|
|||||||
<ng-template pTemplate="footer">
|
<ng-template pTemplate="footer">
|
||||||
<p-button class="reset-btn" (click)="resetLayout()" severity="danger">
|
<p-button class="reset-btn" (click)="resetLayout()" severity="danger">
|
||||||
<i class="pi pi-refresh"></i>
|
<i class="pi pi-refresh"></i>
|
||||||
<span>Reset Layout</span>
|
<span>{{ t('main.resetLayout') }}</span>
|
||||||
</p-button>
|
</p-button>
|
||||||
<p-button class="hide-all-btn" (click)="hideAllCharts()" severity="secondary">
|
<p-button class="hide-all-btn" (click)="hideAllCharts()" severity="secondary">
|
||||||
<i class="pi pi-eye-slash"></i>
|
<i class="pi pi-eye-slash"></i>
|
||||||
<span>Hide All</span>
|
<span>{{ t('main.hideAll') }}</span>
|
||||||
</p-button>
|
</p-button>
|
||||||
<p-button class="show-all-btn" (click)="showAllCharts()" severity="secondary">
|
<p-button class="show-all-btn" (click)="showAllCharts()" severity="secondary">
|
||||||
<i class="pi pi-eye"></i>
|
<i class="pi pi-eye"></i>
|
||||||
<span>Show All</span>
|
<span>{{ t('main.showAll') }}</span>
|
||||||
</p-button>
|
</p-button>
|
||||||
<p-button class="close-btn" (click)="toggleConfigPanel()" severity="secondary">
|
<p-button class="close-btn" (click)="toggleConfigPanel()" severity="secondary">
|
||||||
<span>Close</span>
|
<span>{{ t('main.close') }}</span>
|
||||||
</p-button>
|
</p-button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-dialog>
|
</p-dialog>
|
||||||
@@ -130,3 +131,4 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {DialogModule} from 'primeng/dialog';
|
|||||||
import {ButtonModule} from 'primeng/button';
|
import {ButtonModule} from 'primeng/button';
|
||||||
import {UserService} from '../../../settings/user-management/user.service';
|
import {UserService} from '../../../settings/user-management/user.service';
|
||||||
import {takeUntil} from 'rxjs/operators';
|
import {takeUntil} from 'rxjs/operators';
|
||||||
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
import {PeakHoursChartComponent} from './charts/peak-hours-chart/peak-hours-chart.component';
|
import {PeakHoursChartComponent} from './charts/peak-hours-chart/peak-hours-chart.component';
|
||||||
import {FavoriteDaysChartComponent} from './charts/favorite-days-chart/favorite-days-chart.component';
|
import {FavoriteDaysChartComponent} from './charts/favorite-days-chart/favorite-days-chart.component';
|
||||||
import {ReadingDNAChartComponent} from './charts/reading-dna-chart/reading-dna-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,
|
CompletionRaceChartComponent,
|
||||||
ReadingSurvivalChartComponent,
|
ReadingSurvivalChartComponent,
|
||||||
ReadingClockChartComponent,
|
ReadingClockChartComponent,
|
||||||
BookLengthChartComponent
|
BookLengthChartComponent,
|
||||||
|
TranslocoDirective
|
||||||
],
|
],
|
||||||
templateUrl: './user-stats.component.html',
|
templateUrl: './user-stats.component.html',
|
||||||
styleUrls: ['./user-stats.component.scss']
|
styleUrls: ['./user-stats.component.scss']
|
||||||
|
|||||||
+11
-11
@@ -1,3 +1,4 @@
|
|||||||
|
<ng-container *transloco="let t; prefix: 'shared.metadataProgress'">
|
||||||
<div class="task-border">
|
<div class="task-border">
|
||||||
@if (Object.keys(activeTasks).length > 0) {
|
@if (Object.keys(activeTasks).length > 0) {
|
||||||
@for (task of activeTasks | keyvalue; track task; let idx = $index) {
|
@for (task of activeTasks | keyvalue; track task; let idx = $index) {
|
||||||
@@ -5,18 +6,18 @@
|
|||||||
|
|
||||||
<div class="task-header-row">
|
<div class="task-header-row">
|
||||||
<div class="task-title-group">
|
<div class="task-title-group">
|
||||||
<p class="task-title">Metadata Fetch Task</p>
|
<p class="task-title">{{ t('taskTitle') }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="task-tags">
|
<div class="task-tags">
|
||||||
@if (task.value.review) {
|
@if (task.value.review) {
|
||||||
<p-tag
|
<p-tag
|
||||||
value="Review"
|
[value]="t('tagReview')"
|
||||||
severity="warn"
|
severity="warn"
|
||||||
class="task-tag">
|
class="task-tag">
|
||||||
</p-tag>
|
</p-tag>
|
||||||
} @else {
|
} @else {
|
||||||
<p-tag
|
<p-tag
|
||||||
value="Auto"
|
[value]="t('tagAuto')"
|
||||||
severity="success"
|
severity="success"
|
||||||
class="task-tag">
|
class="task-tag">
|
||||||
</p-tag>
|
</p-tag>
|
||||||
@@ -33,9 +34,7 @@
|
|||||||
{{ task.value.message }}
|
{{ task.value.message }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="task-progress-info">
|
<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 })">
|
||||||
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>
|
</div>
|
||||||
|
|
||||||
<p-progressBar
|
<p-progressBar
|
||||||
@@ -48,7 +47,7 @@
|
|||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
@if (task.value.review) {
|
@if (task.value.review) {
|
||||||
<p-button
|
<p-button
|
||||||
label="Review"
|
[label]="t('reviewBtn')"
|
||||||
severity="info"
|
severity="info"
|
||||||
icon="pi pi-search"
|
icon="pi pi-search"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -58,11 +57,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
<p-button
|
<p-button
|
||||||
[label]="task.value.review ? 'Discard' : 'Dismiss'"
|
[label]="task.value.review ? t('discardBtn') : t('dismissBtn')"
|
||||||
icon="pi pi-times"
|
icon="pi pi-times"
|
||||||
[severity]="task.value.review ? 'danger' : 'secondary'"
|
[severity]="task.value.review ? 'danger' : 'secondary'"
|
||||||
size="small"
|
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"
|
[tooltipPosition]="task.value.review ? 'top' : undefined"
|
||||||
outlined
|
outlined
|
||||||
(click)="clearTask(task.key)">
|
(click)="clearTask(task.key)">
|
||||||
@@ -71,11 +70,11 @@
|
|||||||
} @else if (task.value.status === 'IN_PROGRESS') {
|
} @else if (task.value.status === 'IN_PROGRESS') {
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<p-button
|
<p-button
|
||||||
label="Cancel"
|
[label]="t('cancelBtn')"
|
||||||
icon="pi pi-stop"
|
icon="pi pi-stop"
|
||||||
severity="danger"
|
severity="danger"
|
||||||
size="small"
|
size="small"
|
||||||
pTooltip="Cancel this task"
|
[pTooltip]="t('cancelTooltip')"
|
||||||
tooltipPosition="top"
|
tooltipPosition="top"
|
||||||
outlined
|
outlined
|
||||||
(click)="cancelTask(task.key)">
|
(click)="cancelTask(task.key)">
|
||||||
@@ -91,3 +90,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
|||||||
+12
-4
@@ -7,9 +7,9 @@ import {ButtonModule} from 'primeng/button';
|
|||||||
import {Divider} from 'primeng/divider';
|
import {Divider} from 'primeng/divider';
|
||||||
import {Tooltip} from 'primeng/tooltip';
|
import {Tooltip} from 'primeng/tooltip';
|
||||||
import {MessageService} from 'primeng/api';
|
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 {MetadataProgressService} from '../../service/metadata-progress.service';
|
||||||
import {MetadataTaskService} from '../../../features/book/service/metadata-task';
|
import {MetadataTaskService} from '../../../features/book/service/metadata-task';
|
||||||
import {Tag} from 'primeng/tag';
|
import {Tag} from 'primeng/tag';
|
||||||
@@ -21,7 +21,7 @@ import {DialogLauncherService} from '../../services/dialog-launcher.service';
|
|||||||
templateUrl: './metadata-progress-widget-component.html',
|
templateUrl: './metadata-progress-widget-component.html',
|
||||||
styleUrls: ['./metadata-progress-widget-component.scss'],
|
styleUrls: ['./metadata-progress-widget-component.scss'],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag]
|
imports: [KeyValuePipe, ProgressBarModule, ButtonModule, Divider, Tooltip, Tag, TranslocoDirective]
|
||||||
})
|
})
|
||||||
export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
export class MetadataProgressWidgetComponent implements OnInit, OnDestroy {
|
||||||
activeTasks: Record<string, MetadataBatchProgressNotification> = {};
|
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 {
|
getStatusLabel(status: MetadataBatchStatus): string {
|
||||||
return MetadataBatchStatusLabels[status] ?? status;
|
const key = this.statusLabelKeys[status];
|
||||||
|
return key ? this.t.translate(key) : status;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly Object = Object;
|
protected readonly Object = Object;
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
[ngStyle]="{ color: iconColor }"
|
[ngStyle]="{ color: iconColor }"
|
||||||
style="font-size: 1.25rem"
|
style="font-size: 1.25rem"
|
||||||
[class.pulsating]="iconPulsating"
|
[class.pulsating]="iconPulsating"
|
||||||
aria-label="Unified Notification Icon"
|
[attr.aria-label]="t('notificationAriaLabel')"
|
||||||
></i>
|
></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|||||||
@@ -451,7 +451,97 @@
|
|||||||
"filter": {
|
"filter": {
|
||||||
"title": "Filters",
|
"title": "Filters",
|
||||||
"showingFirst100": "Showing first 100 items",
|
"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": {
|
"shelfAssigner": {
|
||||||
"title": "Assign Books to Shelves",
|
"title": "Assign Books to Shelves",
|
||||||
@@ -552,7 +642,37 @@
|
|||||||
"addSortFieldPlaceholder": "Add sort field...",
|
"addSortFieldPlaceholder": "Add sort field...",
|
||||||
"saveAsDefault": "Save as Default",
|
"saveAsDefault": "Save as Default",
|
||||||
"ascendingTooltip": "Ascending - click to change",
|
"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": {
|
"fileAttacher": {
|
||||||
"title": "Attach File to Another Book",
|
"title": "Attach File to Another Book",
|
||||||
|
|||||||
@@ -16,5 +16,10 @@
|
|||||||
"next": "Next",
|
"next": "Next",
|
||||||
"submit": "Submit",
|
"submit": "Submit",
|
||||||
"remove": "Remove",
|
"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 readerAudiobook from './reader-audiobook.json';
|
||||||
import readerCbx from './reader-cbx.json';
|
import readerCbx from './reader-cbx.json';
|
||||||
import readerEbook from './reader-ebook.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.
|
// 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.
|
// 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;
|
export default translations;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"logout": "Logout",
|
"logout": "Logout",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
"supportBookLore": "Support BookLore",
|
"supportBookLore": "Support BookLore",
|
||||||
|
"notificationAriaLabel": "Unified Notification Icon",
|
||||||
"createLibrary": "Create Library",
|
"createLibrary": "Create Library",
|
||||||
"stats": "Stats",
|
"stats": "Stats",
|
||||||
"libraryStats": "Library 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",
|
"contentRatingAdult": "Adult",
|
||||||
"contentRatingExplicit": "Explicit",
|
"contentRatingExplicit": "Explicit",
|
||||||
"ageRatingAllAges": "All Ages",
|
"ageRatingAllAges": "All Ages",
|
||||||
|
"selectPlaceholder": "Select",
|
||||||
"toast": {
|
"toast": {
|
||||||
"successSummary": "Success",
|
"successSummary": "Success",
|
||||||
"metadataUpdated": "Book metadata updated",
|
"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",
|
"cancellationScheduledSummary": "Cancellation Scheduled",
|
||||||
"cancellationScheduledDetail": "Task cancellation has been successfully scheduled",
|
"cancellationScheduledDetail": "Task cancellation has been successfully scheduled",
|
||||||
"cancelFailedSummary": "Cancel Failed",
|
"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": {
|
"reader": {
|
||||||
"failedToLoadPages": "Failed to load pages",
|
"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": {
|
"filter": {
|
||||||
"title": "Filtros",
|
"title": "Filtros",
|
||||||
"showingFirst100": "Mostrando los primeros 100 elementos",
|
"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": {
|
"shelfAssigner": {
|
||||||
"title": "Asignar libros a estantes",
|
"title": "Asignar libros a estantes",
|
||||||
@@ -552,7 +642,37 @@
|
|||||||
"addSortFieldPlaceholder": "Agregar campo de orden...",
|
"addSortFieldPlaceholder": "Agregar campo de orden...",
|
||||||
"saveAsDefault": "Guardar como predeterminado",
|
"saveAsDefault": "Guardar como predeterminado",
|
||||||
"ascendingTooltip": "Ascendente - clic para cambiar",
|
"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": {
|
"fileAttacher": {
|
||||||
"title": "Adjuntar archivo a otro libro",
|
"title": "Adjuntar archivo a otro libro",
|
||||||
|
|||||||
@@ -16,5 +16,10 @@
|
|||||||
"next": "Siguiente",
|
"next": "Siguiente",
|
||||||
"submit": "Enviar",
|
"submit": "Enviar",
|
||||||
"remove": "Eliminar",
|
"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 readerAudiobook from './reader-audiobook.json';
|
||||||
import readerCbx from './reader-cbx.json';
|
import readerCbx from './reader-cbx.json';
|
||||||
import readerEbook from './reader-ebook.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.
|
// 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.
|
// 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;
|
export default translations;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"logout": "Cerrar sesión",
|
"logout": "Cerrar sesión",
|
||||||
"language": "Idioma",
|
"language": "Idioma",
|
||||||
"supportBookLore": "Apoyar BookLore",
|
"supportBookLore": "Apoyar BookLore",
|
||||||
|
"notificationAriaLabel": "Icono de notificación unificado",
|
||||||
"createLibrary": "Crear biblioteca",
|
"createLibrary": "Crear biblioteca",
|
||||||
"stats": "Estadísticas",
|
"stats": "Estadísticas",
|
||||||
"libraryStats": "Estadísticas de biblioteca",
|
"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",
|
"contentRatingAdult": "Adulto",
|
||||||
"contentRatingExplicit": "Explícito",
|
"contentRatingExplicit": "Explícito",
|
||||||
"ageRatingAllAges": "Todas las edades",
|
"ageRatingAllAges": "Todas las edades",
|
||||||
|
"selectPlaceholder": "Seleccionar",
|
||||||
"toast": {
|
"toast": {
|
||||||
"successSummary": "Éxito",
|
"successSummary": "Éxito",
|
||||||
"metadataUpdated": "Metadatos del libro actualizados",
|
"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",
|
"cancellationScheduledSummary": "Cancelación programada",
|
||||||
"cancellationScheduledDetail": "La cancelación de la tarea se ha programado correctamente",
|
"cancellationScheduledDetail": "La cancelación de la tarea se ha programado correctamente",
|
||||||
"cancelFailedSummary": "Error al cancelar",
|
"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": {
|
"reader": {
|
||||||
"failedToLoadPages": "Error al cargar las páginas",
|
"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