diff --git a/src/App.tsx b/src/App.tsx index c19c1e6..6d07a8e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -90,7 +90,7 @@ export default function App() { {error &&

{error}

} {route === 'home' && setRoulette(true)} onCalendar={() => setCalendar(true)} />} {route === 'catalog' && } - {route === 'stats' && } + {route === 'stats' && } {route === 'settings' && go('admin')} />} {route === 'admin' && go('settings')} />} {route === 'notfound' && go('home')} />} diff --git a/src/components/stats/Charts.tsx b/src/components/stats/Charts.tsx new file mode 100644 index 0000000..47cd6c0 --- /dev/null +++ b/src/components/stats/Charts.tsx @@ -0,0 +1,98 @@ +import type { ReactNode } from 'react' +import { cx } from '../../lib/utils' + +/** + * Petites briques de graphiques, sans bibliothèque. + * Une seule série par graphique → une seule couleur (l'accent du thème), valeurs écrites en encre (jamais en couleur), + * grille et axes discrets, survol / focus qui affiche la valeur exacte. + */ + +/** Grand chiffre + libellé (pas besoin d'un graphique pour une seule valeur). */ +export function StatTile({ label, value, hint }: { label: string; value: ReactNode; hint?: ReactNode }) { + return ( +
+

{label}

+

{value}

+ {hint &&

{hint}

} +
+ ) +} + +/** Barres horizontales triées (classements : genres, pays, types…). Valeur écrite au bout de chaque barre. */ +export function BarList({ rows, format = String }: { rows: { key: string; label: ReactNode; value: number; sub?: string }[]; format?: (n: number) => string }) { + const max = Math.max(1, ...rows.map((r) => r.value)) + return ( +
    + {rows.map((r) => ( +
  • +
    + {r.label} + + {format(r.value)} + {r.sub && {r.sub}} + +
    +
  • + ))} +
+ ) +} + +/** + * Colonnes verticales (évolution dans le temps, répartition des notes). + * Chaque colonne est focalisable : survol / clavier → bulle avec la valeur exacte. + */ +export function Columns({ + bars, + height = 140, + label, +}: { + bars: { key: string; axis: string; value: number; tip: string; highlight?: boolean }[] + height?: number + /** Nom du graphique (lecteurs d'écran) */ + label: string +}) { + const max = Math.max(1, ...bars.map((b) => b.value)) + return ( +
+
+ {/* Repère discret à mi-hauteur */} +
+ ) +} + +/** Bloc titré de la page. */ +export function Panel({ title, action, children, className }: { title: string; action?: ReactNode; children: ReactNode; className?: string }) { + return ( +
+
+

{title}

+ {action} +
+ {children} +
+ ) +} diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 1e850b3..b9db6a4 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -1536,6 +1536,18 @@ const dict: Translations = { 'person.job.composer': "موسيقى", 'person.job.dop': "تصوير", 'person.job.editor': "مونتاج", + // — Statistiques (refonte) — + 'stats.tabAll': "عام", + 'stats.tabOther': "أخرى", + 'stats.period': "الفترة", + 'stats.allYears': "كل السنوات", + 'stats.timeSpent': "الوقت المستغرق", + 'stats.finished': "المكتملة", + 'stats.filmsSeen': "الأفلام المشاهدة", + 'stats.rewatched': "أعيدت مشاهدتها", + 'stats.avgLength': "متوسط المدة", + 'stats.episodesSeen': "الحلقات المشاهدة", + 'stats.decades': "عقود الإصدار", } export default dict diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 145ed9a..84d9be5 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Musik", 'person.job.dop': "Kamera", 'person.job.editor': "Schnitt", + // — Statistiques (refonte) — + 'stats.tabAll': "Überblick", + 'stats.tabOther': "Andere", + 'stats.period': "Zeitraum", + 'stats.allYears': "Alle Jahre", + 'stats.timeSpent': "Verbrachte Zeit", + 'stats.finished': "Beendet", + 'stats.filmsSeen': "Gesehene Filme", + 'stats.rewatched': "erneut gesehen", + 'stats.avgLength': "Durchschnittliche Länge", + 'stats.episodesSeen': "Gesehene Folgen", + 'stats.decades': "Erscheinungsjahrzehnte", } export default dict diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index b10b566..d447ceb 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Composer", 'person.job.dop': "Cinematography", 'person.job.editor': "Editor", + // — Statistiques (refonte) — + 'stats.tabAll': "Overview", + 'stats.tabOther': "Other", + 'stats.period': "Period", + 'stats.allYears': "All years", + 'stats.timeSpent': "Time spent", + 'stats.finished': "Finished", + 'stats.filmsSeen': "Movies watched", + 'stats.rewatched': "rewatched", + 'stats.avgLength': "Average length", + 'stats.episodesSeen': "Episodes watched", + 'stats.decades': "Release decades", } export default dict diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 0dbd3c4..efa4afe 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Música", 'person.job.dop': "Fotografía", 'person.job.editor': "Montaje", + // — Statistiques (refonte) — + 'stats.tabAll': "General", + 'stats.tabOther': "Otros", + 'stats.period': "Periodo", + 'stats.allYears': "Todos los años", + 'stats.timeSpent': "Tiempo dedicado", + 'stats.finished': "Terminados", + 'stats.filmsSeen': "Películas vistas", + 'stats.rewatched': "revistas", + 'stats.avgLength': "Duración media", + 'stats.episodesSeen': "Episodios vistos", + 'stats.decades': "Décadas de estreno", } export default dict diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index c82bcfc..7305d05 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -1315,6 +1315,18 @@ const dict = { 'person.job.composer': "Musique", 'person.job.dop': "Image", 'person.job.editor': "Montage", + // — Statistiques (refonte) — + 'stats.tabAll': "Général", + 'stats.tabOther': "Autres", + 'stats.period': "Période", + 'stats.allYears': "Toutes les années", + 'stats.timeSpent': "Temps passé", + 'stats.finished': "Terminés", + 'stats.filmsSeen': "Films vus", + 'stats.rewatched': "revus", + 'stats.avgLength': "Durée moyenne", + 'stats.episodesSeen': "Épisodes vus", + 'stats.decades': "Décennies de sortie", } export default dict diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 3d36684..7911600 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "संगीत", 'person.job.dop': "छायांकन", 'person.job.editor': "संपादन", + // — Statistiques (refonte) — + 'stats.tabAll': "सामान्य", + 'stats.tabOther': "अन्य", + 'stats.period': "अवधि", + 'stats.allYears': "सभी वर्ष", + 'stats.timeSpent': "बिताया समय", + 'stats.finished': "पूरे किए", + 'stats.filmsSeen': "देखी गई फ़िल्में", + 'stats.rewatched': "दोबारा देखी", + 'stats.avgLength': "औसत अवधि", + 'stats.episodesSeen': "देखे गए एपिसोड", + 'stats.decades': "रिलीज़ के दशक", } export default dict diff --git a/src/i18n/locales/id.ts b/src/i18n/locales/id.ts index 526c401..ff76e77 100644 --- a/src/i18n/locales/id.ts +++ b/src/i18n/locales/id.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Musik", 'person.job.dop': "Sinematografi", 'person.job.editor': "Penyunting", + // — Statistiques (refonte) — + 'stats.tabAll': "Umum", + 'stats.tabOther': "Lainnya", + 'stats.period': "Periode", + 'stats.allYears': "Semua tahun", + 'stats.timeSpent': "Waktu yang dihabiskan", + 'stats.finished': "Selesai", + 'stats.filmsSeen': "Film ditonton", + 'stats.rewatched': "ditonton ulang", + 'stats.avgLength': "Durasi rata-rata", + 'stats.episodesSeen': "Episode ditonton", + 'stats.decades': "Dekade rilis", } export default dict diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index eae81d2..a265bd8 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Musiche", 'person.job.dop': "Fotografia", 'person.job.editor': "Montaggio", + // — Statistiques (refonte) — + 'stats.tabAll': "Generale", + 'stats.tabOther': "Altro", + 'stats.period': "Periodo", + 'stats.allYears': "Tutti gli anni", + 'stats.timeSpent': "Tempo trascorso", + 'stats.finished': "Finiti", + 'stats.filmsSeen': "Film visti", + 'stats.rewatched': "rivisti", + 'stats.avgLength': "Durata media", + 'stats.episodesSeen': "Episodi visti", + 'stats.decades': "Decenni di uscita", } export default dict diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index a623eb1..cee2988 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "音楽", 'person.job.dop': "撮影", 'person.job.editor': "編集", + // — Statistiques (refonte) — + 'stats.tabAll': "全体", + 'stats.tabOther': "その他", + 'stats.period': "期間", + 'stats.allYears': "すべての年", + 'stats.timeSpent': "視聴時間", + 'stats.finished': "完了", + 'stats.filmsSeen': "観た映画", + 'stats.rewatched': "再視聴", + 'stats.avgLength': "平均の長さ", + 'stats.episodesSeen': "観たエピソード", + 'stats.decades': "公開年代", } export default dict diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 7e0256f..a45b983 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "음악", 'person.job.dop': "촬영", 'person.job.editor': "편집", + // — Statistiques (refonte) — + 'stats.tabAll': "전체", + 'stats.tabOther': "기타", + 'stats.period': "기간", + 'stats.allYears': "모든 연도", + 'stats.timeSpent': "시청 시간", + 'stats.finished': "완료", + 'stats.filmsSeen': "본 영화", + 'stats.rewatched': "다시 봄", + 'stats.avgLength': "평균 길이", + 'stats.episodesSeen': "본 에피소드", + 'stats.decades': "개봉 연대", } export default dict diff --git a/src/i18n/locales/nl.ts b/src/i18n/locales/nl.ts index dd2a85c..281d73f 100644 --- a/src/i18n/locales/nl.ts +++ b/src/i18n/locales/nl.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Muziek", 'person.job.dop': "Camera", 'person.job.editor': "Montage", + // — Statistiques (refonte) — + 'stats.tabAll': "Overzicht", + 'stats.tabOther': "Overig", + 'stats.period': "Periode", + 'stats.allYears': "Alle jaren", + 'stats.timeSpent': "Bestede tijd", + 'stats.finished': "Afgerond", + 'stats.filmsSeen': "Geziene films", + 'stats.rewatched': "opnieuw gezien", + 'stats.avgLength': "Gemiddelde duur", + 'stats.episodesSeen': "Geziene afleveringen", + 'stats.decades': "Decennia van uitgave", } export default dict diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index bb45524..52b533d 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -1453,6 +1453,18 @@ const dict: Translations = { 'person.job.composer': "Muzyka", 'person.job.dop': "Zdjęcia", 'person.job.editor': "Montaż", + // — Statistiques (refonte) — + 'stats.tabAll': "Ogólne", + 'stats.tabOther': "Inne", + 'stats.period': "Okres", + 'stats.allYears': "Wszystkie lata", + 'stats.timeSpent': "Spędzony czas", + 'stats.finished': "Ukończone", + 'stats.filmsSeen': "Obejrzane filmy", + 'stats.rewatched': "obejrzane ponownie", + 'stats.avgLength': "Średnia długość", + 'stats.episodesSeen': "Obejrzane odcinki", + 'stats.decades': "Dekady premiery", } export default dict diff --git a/src/i18n/locales/pt.ts b/src/i18n/locales/pt.ts index 2b3a3c0..a6c083a 100644 --- a/src/i18n/locales/pt.ts +++ b/src/i18n/locales/pt.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Música", 'person.job.dop': "Fotografia", 'person.job.editor': "Montagem", + // — Statistiques (refonte) — + 'stats.tabAll': "Geral", + 'stats.tabOther': "Outros", + 'stats.period': "Período", + 'stats.allYears': "Todos os anos", + 'stats.timeSpent': "Tempo passado", + 'stats.finished': "Terminados", + 'stats.filmsSeen': "Filmes vistos", + 'stats.rewatched': "revistos", + 'stats.avgLength': "Duração média", + 'stats.episodesSeen': "Episódios vistos", + 'stats.decades': "Décadas de estreia", } export default dict diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index ea9f130..954569f 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -1453,6 +1453,18 @@ const dict: Translations = { 'person.job.composer': "Композитор", 'person.job.dop': "Оператор", 'person.job.editor': "Монтаж", + // — Statistiques (refonte) — + 'stats.tabAll': "Общее", + 'stats.tabOther': "Другое", + 'stats.period': "Период", + 'stats.allYears': "Все годы", + 'stats.timeSpent': "Затраченное время", + 'stats.finished': "Завершено", + 'stats.filmsSeen': "Просмотрено фильмов", + 'stats.rewatched': "пересмотрено", + 'stats.avgLength': "Средняя длительность", + 'stats.episodesSeen': "Просмотрено серий", + 'stats.decades': "Десятилетия выхода", } export default dict diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index 9a392d4..1913999 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "ดนตรี", 'person.job.dop': "กำกับภาพ", 'person.job.editor': "ตัดต่อ", + // — Statistiques (refonte) — + 'stats.tabAll': "ภาพรวม", + 'stats.tabOther': "อื่น ๆ", + 'stats.period': "ช่วงเวลา", + 'stats.allYears': "ทุกปี", + 'stats.timeSpent': "เวลาที่ใช้", + 'stats.finished': "ดูจบ", + 'stats.filmsSeen': "ภาพยนตร์ที่ดู", + 'stats.rewatched': "ดูซ้ำ", + 'stats.avgLength': "ความยาวเฉลี่ย", + 'stats.episodesSeen': "ตอนที่ดู", + 'stats.decades': "ทศวรรษที่ออกฉาย", } export default dict diff --git a/src/i18n/locales/tr.ts b/src/i18n/locales/tr.ts index 9921753..a1def1f 100644 --- a/src/i18n/locales/tr.ts +++ b/src/i18n/locales/tr.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Müzik", 'person.job.dop': "Görüntü yönetmeni", 'person.job.editor': "Kurgu", + // — Statistiques (refonte) — + 'stats.tabAll': "Genel", + 'stats.tabOther': "Diğer", + 'stats.period': "Dönem", + 'stats.allYears': "Tüm yıllar", + 'stats.timeSpent': "Harcanan süre", + 'stats.finished': "Bitenler", + 'stats.filmsSeen': "İzlenen filmler", + 'stats.rewatched': "yeniden izlenen", + 'stats.avgLength': "Ortalama süre", + 'stats.episodesSeen': "İzlenen bölümler", + 'stats.decades': "Yayın on yılları", } export default dict diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index 2ce9d70..80f99b5 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "Âm nhạc", 'person.job.dop': "Quay phim", 'person.job.editor': "Dựng phim", + // — Statistiques (refonte) — + 'stats.tabAll': "Tổng quan", + 'stats.tabOther': "Khác", + 'stats.period': "Thời gian", + 'stats.allYears': "Tất cả các năm", + 'stats.timeSpent': "Thời gian đã xem", + 'stats.finished': "Đã xong", + 'stats.filmsSeen': "Phim đã xem", + 'stats.rewatched': "xem lại", + 'stats.avgLength': "Thời lượng trung bình", + 'stats.episodesSeen': "Tập đã xem", + 'stats.decades': "Thập niên phát hành", } export default dict diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index eefd8e9..ce11802 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -1313,6 +1313,18 @@ const dict: Translations = { 'person.job.composer': "配乐", 'person.job.dop': "摄影", 'person.job.editor': "剪辑", + // — Statistiques (refonte) — + 'stats.tabAll': "总览", + 'stats.tabOther': "其他", + 'stats.period': "时间段", + 'stats.allYears': "所有年份", + 'stats.timeSpent': "观看时长", + 'stats.finished': "已看完", + 'stats.filmsSeen': "看过的电影", + 'stats.rewatched': "重看", + 'stats.avgLength': "平均时长", + 'stats.episodesSeen': "看过的集数", + 'stats.decades': "上映年代", } export default dict diff --git a/src/pages/StatsPage.tsx b/src/pages/StatsPage.tsx index 52df023..05f3c6d 100644 --- a/src/pages/StatsPage.tsx +++ b/src/pages/StatsPage.tsx @@ -1,14 +1,248 @@ +import { useMemo, useState } from 'react' import { t } from '../i18n' -import { PageHeader } from '../components/ui' +import { BarList, Columns, Panel, StatTile } from '../components/stats/Charts' +import Poster from '../components/Poster' +import { EmptyState, PageHeader } from '../components/ui' +import { STATUSES, TYPE_BY_VALUE } from '../lib/constants' +import { genreLabel } from '../lib/genres' +import { availableYears, computeStats, countries, itemsForPeriod, monthly, records, watchMinutes } from '../lib/stats' +import { cx, formatDuration, formatRating } from '../lib/utils' +import { useMedia } from '../store' +import type { MediaItem, MediaType } from '../types' + +/** Onglets : tout, puis un par grande famille (les dramas coréens / chinois vont avec les séries). */ +type Scope = 'all' | 'film' | 'series' | 'anime' | 'other' +const SCOPE_TYPES: Record, MediaType[]> = { + film: ['film'], + series: ['serie', 'kdrama', 'cdrama'], + anime: ['anime'], + other: ['autre'], +} +const scopeLabel = (s: Scope) => + s === 'all' ? t('stats.tabAll') : s === 'film' ? t('typePlural.film') : s === 'series' ? t('typePlural.serie') : s === 'anime' ? t('typePlural.anime') : t('stats.tabOther') + +/** Statistiques : vue générale, puis films, séries, animes et autres formats. */ +export default function StatsPage({ onOpen }: { onOpen: (item: MediaItem) => void }) { + const { items, settings } = useMedia() + const [scope, setScope] = useState('all') + const [year, setYear] = useState('') + + const scoped = useMemo(() => (scope === 'all' ? items : items.filter((i) => SCOPE_TYPES[scope].includes(i.type))), [items, scope]) + const years = useMemo(() => availableYears(scoped), [scoped]) + const period = year && years.includes(year) ? year : '' + const list = useMemo(() => itemsForPeriod(scoped, period), [scoped, period]) + + // Onglets : « Général », « Films », « Séries » toujours ; les autres seulement s'ils ont des titres + const scopes: Scope[] = (['all', 'film', 'series', 'anime', 'other'] as Scope[]).filter( + (s) => s === 'all' || s === 'film' || s === 'series' || items.some((i) => SCOPE_TYPES[s].includes(i.type)), + ) -/** Statistiques : en cours de refonte complète. */ -export default function StatsPage() { return ( <> - -
-

Soon

+ + + {/* Filtres : une seule rangée (catégorie + période) */} +
+
+ {scopes.map((s) => ( + + ))} +
+
+ + {list.length === 0 ? ( + + ) : ( + + )} ) } + +function StatsBody({ scope, items, year, scale, onOpen }: { scope: Scope; items: MediaItem[]; year: string; scale: '5' | '10'; onOpen: (item: MediaItem) => void }) { + const s = useMemo(() => computeStats(items), [items]) + const months = useMemo(() => monthly(items, year), [items, year]) + const rec = useMemo(() => records(items), [items]) + const geo = useMemo(() => countries(items), [items]) + const isFilm = scope === 'film' + const episodic = scope !== 'all' && scope !== 'film' + + const films = useMemo(() => items.filter((i) => i.type === 'film' && i.status === 'termine'), [items]) + const avgFilm = films.length ? films.reduce((n, f) => n + watchMinutes(f) / (1 + (f.rewatchDates?.length ?? 0)), 0) / films.length : 0 + const rewatches = items.reduce((n, i) => n + (i.rewatchDates?.length ?? 0), 0) + + // Décennies de sortie des titres vus + const decades = useMemo(() => { + const m = new Map() + for (const i of items) if (i.status !== 'a_voir' && i.year && i.year > 1870) m.set(Math.floor(i.year / 10) * 10, (m.get(Math.floor(i.year / 10) * 10) ?? 0) + 1) + return [...m.entries()].sort((a, b) => b[0] - a[0]) + }, [items]) + + const days = Math.floor(s.totalMinutes / 1440) + const timeHint = days > 0 ? `${t('stats.nonStopPre')}${t('stats.days', { count: days })}${t('stats.nonStopPost')}` : undefined + // Mois le plus chargé : seulement s'il sort vraiment du lot (pas d'égalité en tête) + const ranked = [...months].sort((a, b) => b.count - a.count) + const busiest = ranked[0] && ranked[0].count > (ranked[1]?.count ?? 0) ? ranked[0] : undefined + + // Répartition des notes : 10 tranches sur /10 (½ étoile par tranche en échelle /5) + const ratingBars = s.ratingBuckets.map((n, k) => { + const v = k + 1 + const shown = formatRating(v, scale) + return { key: String(v), axis: scale === '5' ? (v % 2 === 0 ? shown : '') : shown, value: n, tip: `${t('stats.ratedAs', { count: n, rating: shown })} : ${n}` } + }) + + const typeRows = s.byType + .filter((x) => x.value > 0 && (scope === 'all' || SCOPE_TYPES[scope as Exclude].includes(x.type))) + .sort((a, b) => b.minutes - a.minutes) + .map((x) => ({ key: x.type, label: TYPE_BY_VALUE[x.type].label, value: x.minutes, sub: t('stats.finishedN', { count: x.completed }) })) + + return ( +
+ {/* Les chiffres clés */} +
+ + + {isFilm ? ( + + ) : ( + + )} + +
+ +
+ {/* Activité mois par mois */} + + ({ + key: m.key, + axis: m.initial, + value: m.count, + highlight: m === busiest, + tip: `${m.label} : ${t('stats.monthFinished', { count: m.count })}${m.minutes ? ` · ${formatDuration(m.minutes)}` : ''}`, + }))} + /> + {busiest && busiest.count > 0 && ( +

+ {t('stats.busiest')} {busiest.label} · {t('stats.monthFinished', { count: busiest.count })} +

+ )} +
+ + {/* Temps par type (vue générale, et séries quand il y a plusieurs formats) */} + {typeRows.length > 1 && ( + + + + )} + + + {s.ratedCount ? :

{t('stats.noRatings')}

} +
+ + + {s.topGenres.length ? ( + ({ key: g.label, label: genreLabel(g.label), value: g.value }))} /> + ) : ( +

{t('stats.noGenres')}

+ )} +
+ + {geo.list.length > 0 && ( + + ({ + key: c.code, + label: ( + <> + {c.name} + + ), + value: c.count, + }))} + /> + + )} + + {decades.length > 1 && ( + + ({ key: String(d), label: `${d} – ${d + 9}`, value: n }))} /> + + )} + + + x.value > 0).map((x) => ({ key: x.status, label: x.label, value: x.value }))} /> + + + {s.topPlatforms.length > 0 && ( + + ({ key: p.label, label: p.label, value: p.value }))} /> + + )} + + {/* Records */} + {(rec.marathon && (episodic || scope === 'all')) || (rec.longestFilm && (isFilm || scope === 'all')) ? ( + +
+ {rec.marathon && (episodic || scope === 'all') && ( + + )} + {rec.longestFilm && (isFilm || scope === 'all') && ( + + )} +
+
+ ) : null} +
+ + {/* Mes mieux notés */} + {rec.bestRated && rec.bestRated.length > 0 && ( + +
    + {rec.bestRated.map((i) => ( +
  • + +
  • + ))} +
+
+ )} + +

{t('stats.footnote')}

+
+ ) +} + +function RecordRow({ label, item, value, onOpen }: { label: string; item: MediaItem; value: string; onOpen: (item: MediaItem) => void }) { + return ( + + ) +}