feat: add books/pages metric toggle on reading activity chart

Allow switching between number of books and number of pages on the
dashboard reading activity chart. Adds pages_read to the stats API
response and a MetricToggle component alongside the existing PeriodToggle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 21:12:43 +01:00
parent 4049c94fc0
commit 2febab2c39
6 changed files with 96 additions and 15 deletions

View File

@@ -699,12 +699,14 @@ export type RecentlyReadItem = {
export type MonthlyReading = {
month: string;
books_read: number;
pages_read: number;
};
export type UserMonthlyReading = {
month: string;
username: string;
books_read: number;
pages_read: number;
};
export type JobTimePoint = {

View File

@@ -80,6 +80,8 @@ const en: Record<TranslationKey, string> = {
"dashboard.periodDay": "Day",
"dashboard.periodWeek": "Week",
"dashboard.periodMonth": "Month",
"dashboard.metricBooks": "Books",
"dashboard.metricPages": "Pages",
"dashboard.popularSeries": "Popular series",
"dashboard.noSeries": "No series yet",
"dashboard.unknown": "Unknown",

View File

@@ -78,6 +78,8 @@ const fr = {
"dashboard.periodDay": "Jour",
"dashboard.periodWeek": "Semaine",
"dashboard.periodMonth": "Mois",
"dashboard.metricBooks": "Livres",
"dashboard.metricPages": "Pages",
"dashboard.popularSeries": "Séries populaires",
"dashboard.noSeries": "Aucune série pour le moment",
"dashboard.unknown": "Inconnu",