feat: add day/week/month period toggle for dashboard line charts

Add a period selector (day, week, month) to the reading activity and
books added charts. The API now accepts a ?period= query param and
returns gap-filled data using generate_series so all time slots appear
even with zero values. Labels are locale-aware (short month, weekday).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 10:27:24 +01:00
parent 6f663eaee7
commit cf1953d11f
6 changed files with 259 additions and 57 deletions

View File

@@ -70,7 +70,10 @@ const en: Record<TranslationKey, string> = {
"dashboard.readingStatus": "Reading status",
"dashboard.byFormat": "By format",
"dashboard.byLibrary": "By library",
"dashboard.booksAdded": "Books added (last 12 months)",
"dashboard.booksAdded": "Books added",
"dashboard.periodDay": "Day",
"dashboard.periodWeek": "Week",
"dashboard.periodMonth": "Month",
"dashboard.popularSeries": "Popular series",
"dashboard.noSeries": "No series yet",
"dashboard.unknown": "Unknown",
@@ -84,7 +87,7 @@ const en: Record<TranslationKey, string> = {
"dashboard.withIsbn": "With ISBN",
"dashboard.currentlyReading": "Currently reading",
"dashboard.recentlyRead": "Recently read",
"dashboard.readingActivity": "Reading activity (last 12 months)",
"dashboard.readingActivity": "Reading activity",
"dashboard.pageProgress": "p. {{current}} / {{total}}",
"dashboard.noCurrentlyReading": "No books in progress",
"dashboard.noRecentlyRead": "No books read recently",

View File

@@ -68,7 +68,10 @@ const fr = {
"dashboard.readingStatus": "Statut de lecture",
"dashboard.byFormat": "Par format",
"dashboard.byLibrary": "Par bibliothèque",
"dashboard.booksAdded": "Livres ajoutés (12 derniers mois)",
"dashboard.booksAdded": "Livres ajoutés",
"dashboard.periodDay": "Jour",
"dashboard.periodWeek": "Semaine",
"dashboard.periodMonth": "Mois",
"dashboard.popularSeries": "Séries populaires",
"dashboard.noSeries": "Aucune série pour le moment",
"dashboard.unknown": "Inconnu",
@@ -82,7 +85,7 @@ const fr = {
"dashboard.withIsbn": "Avec ISBN",
"dashboard.currentlyReading": "En cours de lecture",
"dashboard.recentlyRead": "Derniers livres lus",
"dashboard.readingActivity": "Activité de lecture (12 derniers mois)",
"dashboard.readingActivity": "Activité de lecture",
"dashboard.pageProgress": "p. {{current}} / {{total}}",
"dashboard.noCurrentlyReading": "Aucun livre en cours",
"dashboard.noRecentlyRead": "Aucun livre lu récemment",