Bilan de l'année façon story : couleurs, animations, arrivée le 1er décembre
deploy / deploy (push) Successful in 1m3s

- Le bilan d'une année arrive le 1er décembre : avant, plus de bouton
  dans les stats (juste « Ton bilan arrive le 1er décembre » quand
  l'année en cours est choisie). Carte d'accueil et bouton par défaut
  en décembre et janvier ; les années passées restent consultables en
  choisissant l'année dans les stats.
- Les mois masqués dans les réglages des stats ne comptent plus dans
  le bilan, et la première page le dit. Le texte d'aide des réglages
  est corrigé dans les 18 langues.
- Nouvelle interface : une couleur par page, pages qui avancent seules
  (doigt posé ou bouton pour mettre en pause), chiffres qui tournent
  comme un compteur, entrées en cascade, affiches distribuées en
  podium, barres qui poussent, pellicule et halos en fond, confettis
  sur la dernière page. Rien ne bouge ni n'avance seul si l'appareil
  demande moins d'animations.
- L'image à partager reprend le même style.
- Skills d'animation ajoutés après lecture : frontend-design
  (Anthropic), animate et choreograph (Emil Kowalski), motion-design
  (LottieFiles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
Claude committed 2026-12-02 12:09:47 +00:00
1 parent 95acfca460
commit d99d6fe0f0
43 files changed
+3366 -177

No files matched your search

+8 -4
View File
@@ -2,6 +2,7 @@ import { Sparkles, X } from 'lucide-react'
import { lazy, Suspense, useMemo, useState } from 'react'
import { t } from '../i18n'
import { finishedInYear, recapSeasonYear, yearRecap } from '../lib/recap'
import { useMedia } from '../store'
import type { MediaItem } from '../types'
// Les pages du bilan ne sont chargées qu'à l'ouverture
@@ -9,7 +10,8 @@ const YearRecap = lazy(() => import('./YearRecap'))
/** Ouvre le bilan d'une année (chargé à la demande). */
function RecapViewer({ items, year, onClose, onSeeStats }: { items: MediaItem[]; year: string; onClose: () => void; onSeeStats?: () => void }) {
const recap = useMemo(() => yearRecap(items, year), [items, year])
const hiddenMonths = useMedia().settings.statsHiddenMonths
const recap = useMemo(() => yearRecap(items, year, hiddenMonths), [items, year, hiddenMonths])
return (
<Suspense fallback={null}>
<YearRecap recap={recap} onClose={onClose} onSeeStats={onSeeStats} />
@@ -17,10 +19,11 @@ function RecapViewer({ items, year, onClose, onSeeStats }: { items: MediaItem[];
)
}
/** Bouton « Mon année 2026 » de la page Stats (si l'année a au moins un titre terminé). */
/** Bouton « Mon année 2026 » de la page Stats (si l'année a au moins un titre terminé, mois masqués exclus). */
export function RecapButton({ items, year }: { items: MediaItem[]; year: string }) {
const [open, setOpen] = useState(false)
const finished = useMemo(() => finishedInYear(items, year), [items, year])
const hiddenMonths = useMedia().settings.statsHiddenMonths
const finished = useMemo(() => finishedInYear(items, year, hiddenMonths), [items, year, hiddenMonths])
if (!finished) return null
return (
<>
@@ -41,7 +44,8 @@ const hiddenKey = (year: string) => `azuucine:recap-hint-${year}`
*/
export function RecapHint({ items, onSeeStats }: { items: MediaItem[]; onSeeStats: () => void }) {
const year = recapSeasonYear()
const finished = useMemo(() => (year ? finishedInYear(items, year) : 0), [items, year])
const hiddenMonths = useMedia().settings.statsHiddenMonths
const finished = useMemo(() => (year ? finishedInYear(items, year, hiddenMonths) : 0), [items, year, hiddenMonths])
const [hidden, setHidden] = useState(() => {
try {
return !!year && localStorage.getItem(hiddenKey(year)) === '1'
+454
View File
@@ -0,0 +1,454 @@
/*
* Bilan de l'année : le seul endroit de l'app où l'on se permet de la couleur et du mouvement (une fois par an).
* Chaque page a sa couleur ; la pellicule et les halos bougent doucement derrière ; les chiffres tournent
* comme un compteur ; le contenu arrive en cascade, du plus important au moins important.
* Chargé seulement à l'ouverture du bilan (avec YearRecap.tsx).
*
* Courbes : --recap-out pour les entrées (forte décélération), --recap-in-out pour ce qui se déplace à l'écran,
* --recap-pop pour l'unique dépassement (le n°1 des mieux notés, les confettis).
*/
.recap-stage {
--recap-out: cubic-bezier(0.23, 1, 0.32, 1);
--recap-in-out: cubic-bezier(0.77, 0, 0.175, 1);
--recap-pop: cubic-bezier(0.175, 0.885, 0.32, 1.275);
/* Page par défaut (intro) : vert d'eau profond, couleur de Bobinoo poussée au maximum */
--scene-bg: #0c3a36;
--scene-ink: #f6f3ea;
--scene-soft: rgb(246 243 234 / 0.72);
--scene-pop: #8ce6db;
--scene-blob-a: #1c8a80;
--scene-blob-b: #e7b54d;
--scene-on-pop: #062b28;
position: fixed;
inset: 0;
z-index: 60;
display: flex;
flex-direction: column;
overflow: hidden;
overscroll-behavior: none;
background-color: var(--scene-bg);
color: var(--scene-ink);
transition:
background-color 600ms var(--recap-out),
color 400ms ease;
animation: recap-open 420ms var(--recap-out) both;
}
.recap-stage[data-scene='time'] {
--scene-bg: #0b0b0c;
--scene-ink: #f6f3ea;
--scene-soft: rgb(246 243 234 / 0.7);
--scene-pop: #53bfb6;
--scene-blob-a: #12524c;
--scene-blob-b: #6b2d1f;
--scene-on-pop: #062b28;
}
.recap-stage[data-scene='types'] {
--scene-bg: #ef6a4b;
--scene-ink: #1b0905;
--scene-soft: rgb(27 9 5 / 0.72);
--scene-pop: #1b0905;
--scene-blob-a: #ff9c70;
--scene-blob-b: #c4432a;
--scene-on-pop: #ef6a4b;
}
.recap-stage[data-scene='genres'] {
--scene-bg: #f2c548;
--scene-ink: #1d1503;
--scene-soft: rgb(29 21 3 / 0.7);
--scene-pop: #1d1503;
--scene-blob-a: #ffe28f;
--scene-blob-b: #e0952a;
--scene-on-pop: #f2c548;
}
.recap-stage[data-scene='best'] {
--scene-bg: #14225c;
--scene-ink: #f6f3ea;
--scene-soft: rgb(246 243 234 / 0.72);
--scene-pop: #f2c548;
--scene-blob-a: #2b48ba;
--scene-blob-b: #1c8a80;
--scene-on-pop: #14225c;
}
.recap-stage[data-scene='month'] {
--scene-bg: #53bfb6;
--scene-ink: #062b28;
--scene-soft: rgb(6 43 40 / 0.72);
--scene-pop: #062b28;
--scene-blob-a: #93eadf;
--scene-blob-b: #2b8a82;
--scene-on-pop: #53bfb6;
}
.recap-stage[data-scene='end'] {
--scene-bg: #0b0b0c;
--scene-ink: #f6f3ea;
--scene-soft: rgb(246 243 234 / 0.7);
--scene-pop: #53bfb6;
--scene-blob-a: #14225c;
--scene-blob-b: #0c3a36;
--scene-on-pop: #062b28;
}
/* Couleurs du contenu, tirées de la page en cours */
.recap-pop {
color: var(--scene-pop);
}
.recap-soft {
color: var(--scene-soft);
}
.recap-track {
background: color-mix(in srgb, var(--scene-ink) 16%, transparent);
}
.recap-bar-ink {
background: var(--scene-ink);
}
.recap-col-on {
background: var(--scene-ink);
}
.recap-col-off {
background: color-mix(in srgb, var(--scene-ink) 28%, transparent);
}
.recap-poster {
overflow: hidden;
border-radius: 4px;
box-shadow: 0 18px 40px rgb(0 0 0 / 0.4);
}
/* Confettis : les couleurs des autres pages */
.recap-c0 {
background: #ef6a4b;
}
.recap-c1 {
background: #f2c548;
}
.recap-c2 {
background: #4f6fe0;
}
.recap-c3 {
background: #53bfb6;
}
@keyframes recap-open {
from {
opacity: 0;
transform: scale(0.97);
}
}
/* ─── Ambiance : deux halos qui flottent et une bande de pellicule qui défile ─── */
.recap-ambient {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
}
.recap-blob {
position: absolute;
width: 85vmax;
height: 85vmax;
border-radius: 9999px;
opacity: 0.55;
transition: background 600ms ease;
}
.recap-blob-a {
top: -38vmax;
inset-inline-end: -30vmax;
background: radial-gradient(circle at center, var(--scene-blob-a) 0%, transparent 62%);
animation: recap-float-a 11s ease-in-out infinite alternate;
}
.recap-blob-b {
bottom: -45vmax;
inset-inline-start: -35vmax;
background: radial-gradient(circle at center, var(--scene-blob-b) 0%, transparent 60%);
opacity: 0.4;
animation: recap-float-b 15s ease-in-out infinite alternate;
}
@keyframes recap-float-a {
to {
transform: translate(-6vmax, 5vmax) scale(1.08);
}
}
@keyframes recap-float-b {
to {
transform: translate(7vmax, -4vmax) scale(1.12);
}
}
/* Pellicule : bande inclinée, perforations de chaque côté, qui défile sans fin (mouvement constant : linéaire) */
.recap-film {
position: absolute;
inset-inline-start: -20%;
width: 140%;
height: 5.5rem;
top: 58%;
rotate: -9deg;
opacity: 0.13;
overflow: hidden;
}
.recap-film > span {
display: block;
width: 200%;
height: 100%;
border-block: 1.5px solid var(--scene-ink);
background:
repeating-linear-gradient(90deg, var(--scene-ink) 0 14px, transparent 14px 32px) top 8px left 0 / 100% 10px no-repeat,
repeating-linear-gradient(90deg, var(--scene-ink) 0 14px, transparent 14px 32px) bottom 8px left 0 / 100% 10px no-repeat,
repeating-linear-gradient(90deg, transparent 0 118px, var(--scene-ink) 118px 120px) center / 100% 46% no-repeat;
animation: recap-film 26s linear infinite;
}
@keyframes recap-film {
to {
transform: translateX(-50%);
}
}
/* Année en contour, géante, le long du bord (même dessin que les chiffres du Top 5) */
.recap-year-outline {
position: absolute;
/* Côté physique : en écriture verticale, « inline-end » désignerait le bas */
right: -0.1em;
bottom: 10%;
font-size: clamp(9rem, 48vw, 22rem);
font-weight: 900;
line-height: 0.8;
letter-spacing: -0.06em;
color: transparent;
-webkit-text-stroke: 2px var(--scene-ink);
opacity: 0.14;
writing-mode: vertical-rl;
rotate: 180deg;
animation: recap-rise 1100ms var(--recap-out) 200ms both;
pointer-events: none;
}
/* ─── Progression (une barre par page) ─── */
.recap-seg {
position: relative;
height: 3px;
flex: 1;
overflow: hidden;
border-radius: 9999px;
background: color-mix(in srgb, var(--scene-ink) 25%, transparent);
}
.recap-seg > i {
position: absolute;
inset: 0;
background: var(--scene-ink);
transform-origin: left;
transform: scaleX(0);
}
:dir(rtl) .recap-seg > i {
transform-origin: right;
}
.recap-seg[data-state='done'] > i {
transform: none;
}
/* Page en cours : la barre se remplit pendant la durée de la page (progression : linéaire) */
.recap-seg[data-state='current'] > i {
animation: recap-fill var(--dur, 7s) linear both;
}
.recap-seg[data-state='current'][data-paused] > i {
animation-play-state: paused;
}
.recap-seg[data-state='full'] > i {
transform: none;
}
@keyframes recap-fill {
from {
transform: scaleX(0);
}
to {
transform: scaleX(1);
}
}
/* Doigt posé : l'interface s'efface pour laisser voir la page */
.recap-chrome {
transition: opacity 200ms ease;
}
.recap-stage[data-held] .recap-chrome {
opacity: 0;
}
/* ─── Entrées du contenu ─── */
/* Le texte qui arrive : monte et apparaît ; --delay règle l'ordre (le plus important d'abord) */
.recap-in {
animation: recap-rise 700ms var(--recap-out) both;
animation-delay: var(--delay, 0ms);
}
@keyframes recap-rise {
from {
opacity: 0;
transform: translateY(var(--rise, 22px));
}
}
/* Gros mots (genre n°1, mois) : sortent d'une fente, comme un titre de générique */
.recap-line {
display: block;
overflow: hidden;
padding-bottom: 0.06em;
}
.recap-line > span {
display: block;
animation: recap-slot 900ms var(--recap-out) both;
animation-delay: var(--delay, 0ms);
}
@keyframes recap-slot {
from {
transform: translateY(105%);
}
}
/* Compteur : chaque chiffre est une colonne 0→9 (deux tours) qui défile jusqu'au bon chiffre */
.recap-odo {
display: inline-flex;
font-variant-numeric: tabular-nums;
line-height: 1;
}
.recap-odo-col {
display: inline-block;
height: 1em;
overflow: hidden;
}
.recap-odo-col > span {
display: flex;
flex-direction: column;
transform: translateY(calc((10 + var(--d)) * -5%));
animation: recap-roll 1300ms var(--recap-out) both;
animation-delay: calc(var(--delay, 0ms) + var(--i, 0) * 70ms);
}
.recap-odo-col > span > span {
display: block;
height: 1em;
}
@keyframes recap-roll {
from {
transform: translateY(0);
}
}
/* Barres (types, mois) : poussent depuis leur base */
.recap-bar {
transform-origin: left;
animation: recap-grow-x 1000ms var(--recap-out) both;
animation-delay: var(--delay, 0ms);
}
:dir(rtl) .recap-bar {
transform-origin: right;
}
@keyframes recap-grow-x {
from {
transform: scaleX(0.02);
}
}
.recap-col {
transform-origin: bottom;
animation: recap-grow-y 800ms var(--recap-out) both;
animation-delay: var(--delay, 0ms);
}
@keyframes recap-grow-y {
from {
transform: scaleY(0.04);
}
}
/* Affiches distribuées comme des cartes : le 3e, puis le 2e, puis le n°1 qui dépasse un peu en arrivant */
.recap-deal {
transform: translateY(var(--ty, 0)) rotate(var(--rot, 0deg));
animation: recap-deal 800ms var(--recap-out) both;
animation-delay: var(--delay, 0ms);
}
.recap-deal[data-first] {
animation-timing-function: var(--recap-pop);
animation-duration: 900ms;
}
@keyframes recap-deal {
from {
opacity: 0;
transform: translate(var(--fx, 0), 48px) rotate(var(--fr, 0deg)) scale(0.9);
}
}
/* Confettis de la dernière page : jaillissent du centre une seule fois, puis restent en décor */
.recap-confetti {
position: absolute;
top: 34%;
left: 50%;
pointer-events: none;
}
.recap-confetti > i {
position: absolute;
display: block;
transform: translate(var(--x), var(--y)) rotate(var(--r));
animation: recap-burst 1000ms var(--recap-pop) both;
animation-delay: var(--delay, 150ms);
}
@keyframes recap-burst {
from {
opacity: 0;
transform: translate(0, 0) rotate(0deg) scale(0.6);
}
}
/* Bouton principal : respire doucement pour inviter à partager */
.recap-cta {
background: var(--scene-pop);
color: var(--scene-on-pop);
animation:
recap-rise 700ms var(--recap-out) both,
recap-breathe 2600ms ease-in-out 1600ms infinite;
animation-delay: var(--delay, 0ms), calc(var(--delay, 0ms) + 1600ms);
}
@keyframes recap-breathe {
50% {
transform: scale(1.03);
}
}
.recap-ghost {
border: 1px solid color-mix(in srgb, var(--scene-ink) 45%, transparent);
color: var(--scene-ink);
}
.recap-cta,
.recap-ghost {
transition: transform 160ms var(--recap-out);
}
.recap-cta:active,
.recap-ghost:active {
transform: scale(0.97);
}
/*
* Moins d'animations demandées par l'appareil : plus aucun déplacement ni boucle ; le contenu apparaît en fondu,
* les chiffres sont affichés directement, les pages n'avancent plus seules (géré dans YearRecap.tsx).
*/
@media (prefers-reduced-motion: reduce) {
.recap-stage {
animation: recap-fade 200ms ease both;
}
.recap-blob,
.recap-film > span {
animation: none;
}
.recap-in,
.recap-year-outline,
.recap-deal,
.recap-confetti > i {
animation: recap-fade 300ms ease both;
}
.recap-line > span,
.recap-odo-col > span,
.recap-bar,
.recap-col {
animation: none;
}
.recap-cta {
animation: recap-fade 300ms ease both;
}
}
@keyframes recap-fade {
from {
opacity: 0;
}
}
+363 -93
View File
@@ -1,5 +1,5 @@
import { BarChart3, Heart, Share2, X } from 'lucide-react'
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import { BarChart3, Heart, Pause, Play, Share2, X } from 'lucide-react'
import { useEffect, useMemo, useRef, useState, type CSSProperties, type PointerEvent, type ReactNode } from 'react'
import { dateFormat, fmtNumber, t } from '../i18n'
import { useBackToClose } from '../lib/backNav'
import { useEscape } from '../lib/escape'
@@ -9,41 +9,158 @@ import { useScrollLock } from '../lib/scrollLock'
import { cx, formatRating } from '../lib/utils'
import Poster from './Poster'
import SharePreview from './SharePreview'
import './YearRecap.css'
/** Une page du bilan = une scène (sa couleur est dans YearRecap.css). */
type Scene = 'intro' | 'time' | 'types' | 'genres' | 'best' | 'month' | 'end'
/** Durée d'une page avant de passer à la suivante (la dernière reste affichée). */
const DURATION: Record<Scene, number> = { intro: 5500, time: 7000, types: 7000, genres: 7000, best: 8000, month: 8000, end: 0 }
/** Style avec variables CSS (--delay, --d…). */
const vars = (v: Record<string, string | number>) => v as CSSProperties
/** Moment d'arrivée d'un élément de la page (ms). */
const at = (ms: number) => vars({ '--delay': `${ms}ms` })
const familyLabel = (f: RecapFamily) => (f === 'autre' ? t('stats.tabOther') : t(`typePlural.${f}`))
/** Grand chiffre d'une page (couleur d'accent). */
function Big({ children }: { children: ReactNode }) {
return <p className="text-[clamp(3.5rem,18vw,7rem)] font-extrabold leading-none tracking-tight text-accent">{children}</p>
/** « 12 titres terminés » → ['', ' titres terminés'] : le nombre s'affiche à part, en grand. */
function splitCount(text: string, n: number): [string, string] {
const num = fmtNumber(n)
const i = text.indexOf(num)
return i < 0 ? ['', text] : [text.slice(0, i), text.slice(i + num.length)]
}
/** L'appareil demande moins d'animations : pas de défilement automatique ni de mouvement. */
function useReducedMotion() {
const [reduce, setReduce] = useState(() => matchMedia('(prefers-reduced-motion: reduce)').matches)
useEffect(() => {
const mq = matchMedia('(prefers-reduced-motion: reduce)')
const on = () => setReduce(mq.matches)
mq.addEventListener('change', on)
return () => mq.removeEventListener('change', on)
}, [])
return reduce
}
/** Onglet caché (autre appli, écran verrouillé) : la page en cours attend. */
function usePageHidden() {
const [hidden, setHidden] = useState(() => document.visibilityState === 'hidden')
useEffect(() => {
const on = () => setHidden(document.visibilityState === 'hidden')
document.addEventListener('visibilitychange', on)
return () => document.removeEventListener('visibilitychange', on)
}, [])
return hidden
}
/** Nombre qui s'affiche comme un compteur : chaque chiffre tourne jusqu'à sa valeur. */
function Odometer({ value, delay = 0 }: { value: number; delay?: number }) {
const text = fmtNumber(value)
// Chiffres de la langue (0 à 9), pour les langues qui n'utilisent pas les chiffres latins
const digits = useMemo(() => Array.from({ length: 10 }, (_, d) => fmtNumber(d)), [])
return (
<span className="recap-odo">
<span className="sr-only">{text}</span>
{[...text].map((ch, k) => {
const d = digits.indexOf(ch)
if (d < 0)
return (
<span key={k} aria-hidden>
{ch}
</span>
)
return (
<span key={k} className="recap-odo-col" aria-hidden style={vars({ '--d': d, '--i': k, '--delay': `${delay}ms` })}>
<span>
{[...digits, ...digits].map((x, j) => (
<span key={j}>{x}</span>
))}
</span>
</span>
)
})}
</span>
)
}
/** Ligne qui sort d'une fente (titres, gros mots). */
function Line({ children, delay = 0, className }: { children: ReactNode; delay?: number; className?: string }) {
return (
<span className={cx('recap-line', className)}>
<span style={at(delay)}>{children}</span>
</span>
)
}
/** Gros nombre suivi de son libellé (« 86 h », « 123 épisodes »), alignés en bas. */
function Figure({ value, text, delay = 0, className, unitClass }: { value: number; text: string; delay?: number; className?: string; unitClass?: string }) {
const [pre, post] = splitCount(text, value)
return (
<span className={cx('inline-flex items-end', className)}>
{pre && <span className={cx('whitespace-pre leading-none', unitClass)}>{pre}</span>}
<Odometer value={value} delay={delay} />
{post && <span className={cx('whitespace-pre leading-none', unitClass)}>{post}</span>}
</span>
)
}
// Confettis de la dernière page : positions fixes (pas de hasard d'un affichage à l'autre)
const CONFETTI = Array.from({ length: 18 }, (_, k) => {
const angle = (k / 18) * Math.PI * 2 + (k % 3) * 0.35
const dist = 130 + ((k * 53) % 110)
return { x: Math.round(Math.cos(angle) * dist * 1.5), y: Math.round(Math.sin(angle) * dist), r: (k * 67) % 360, shape: k % 3, color: k % 4, delay: 120 + (k % 6) * 30 }
})
/**
* Bilan de l'année, page par page comme une story : toucher à droite pour avancer, à gauche pour revenir,
* glisser, ou les flèches du clavier. La dernière page propose de partager le bilan en image.
* Bilan de l'année, page par page comme une story : les pages avancent seules (doigt posé = pause),
* toucher à droite pour avancer, à gauche pour revenir, glisser, ou les flèches du clavier.
* La dernière page propose de partager le bilan en image.
*/
export default function YearRecap({ recap, onClose, onSeeStats }: { recap: Recap; onClose: () => void; onSeeStats?: () => void }) {
useScrollLock()
useEscape(onClose)
useBackToClose(onClose)
const reduce = useReducedMotion()
const pageHidden = usePageHidden()
const [page, setPage] = useState(0)
const [share, setShare] = useState<Blob>()
const [busy, setBusy] = useState(false)
const down = useRef<number | null>(null)
const [paused, setPaused] = useState(false)
const [held, setHeld] = useState(false)
const press = useRef<{ x: number; y: number; timer: number; held: boolean } | null>(null)
const hours = Math.round(recap.minutes / 60)
const days = Math.floor(recap.minutes / 1440)
const maxFamily = Math.max(1, ...recap.families.map((f) => f.count))
const monthName = recap.busiest ? dateFormat({ month: 'long' }).format(new Date(`${recap.busiest.key}-15T12:00:00`)) : ''
const maxMonth = Math.max(1, ...recap.months.map((m) => m.count))
const monthName = (key: string) => {
const s = dateFormat({ month: 'long' }).format(new Date(`${key}-15T12:00:00`))
return s.charAt(0).toUpperCase() + s.slice(1)
}
const hiddenNote = recap.hiddenMonths.length
? t('recap.hiddenNote', { months: new Intl.ListFormat(document.documentElement.lang || undefined, { type: 'conjunction' }).format(recap.hiddenMonths.map(monthName)) })
: undefined
// Pages : seulement celles qui ont quelque chose à montrer
const pages = useMemo(() => {
const list: { key: string; title: string; body: ReactNode }[] = [
const list: { key: Scene; body: ReactNode }[] = [
{
key: 'intro',
title: t('recap.introTitle', { year: recap.year }),
body: (
<>
<Big>{fmtNumber(recap.finished)}</Big>
<p className="mt-3 text-xl font-semibold">{t('recap.finished', { count: recap.finished })}</p>
<Line className="text-2xl font-semibold">{t('recap.introTitle', { year: recap.year })}</Line>
<p className="recap-pop mt-3 text-[clamp(6rem,36vw,13rem)] font-extrabold leading-none tracking-[-0.05em]">
<Odometer value={recap.finished} delay={250} />
</p>
<p className="recap-in mt-3 text-2xl font-bold" style={at(650)}>
{splitCount(t('recap.finished', { count: recap.finished }), recap.finished)[1].trim()}
</p>
{hiddenNote && (
<p className="recap-in recap-soft mt-10 max-w-xs text-sm leading-relaxed" style={at(900)}>
{hiddenNote}
</p>
)}
</>
),
},
@@ -51,98 +168,170 @@ export default function YearRecap({ recap, onClose, onSeeStats }: { recap: Recap
if (recap.minutes > 0)
list.push({
key: 'time',
title: t('recap.timeTitle'),
body: (
<>
<Big>{t('common.hours', { h: fmtNumber(Math.round(recap.minutes / 60)) })}</Big>
{days > 0 && <p className="mt-3 text-lg text-ink-2">{`${t('stats.nonStopPre')}${t('stats.days', { count: days })}${t('stats.nonStopPost')}`}</p>}
{recap.episodes > 0 && <p className="mt-6 text-xl font-semibold">{t('stats.episodesN', { count: recap.episodes })}</p>}
<Line className="text-2xl font-semibold">{t('recap.timeTitle')}</Line>
<p className="recap-pop mt-3 text-[clamp(5rem,30vw,11rem)] font-extrabold leading-none tracking-[-0.045em]">
<Figure value={hours} text={t('common.hours', { h: fmtNumber(hours) })} delay={200} unitClass="text-[0.42em] tracking-normal" />
</p>
{days > 0 && (
<p className="recap-in mt-4 text-xl font-semibold" style={at(700)}>
{`${t('stats.nonStopPre')}${t('stats.days', { count: days })}${t('stats.nonStopPost')}`}
</p>
)}
{recap.episodes > 0 && (
<p className="recap-in mt-10 text-5xl font-extrabold tracking-[-0.03em]" style={at(950)}>
<Figure value={recap.episodes} text={t('stats.episodesN', { count: recap.episodes })} delay={950} unitClass="text-[0.42em] font-semibold tracking-normal" />
</p>
)}
</>
),
})
if (recap.families.length)
list.push({
key: 'types',
title: t('recap.typesTitle'),
body: (
<ul className="w-full max-w-sm space-y-5 text-start">
{recap.families.map((f) => (
<li key={f.family}>
<div className="flex items-baseline justify-between gap-3">
<span className="text-lg font-semibold">{familyLabel(f.family)}</span>
<span className="text-2xl font-extrabold tabular-nums text-accent">{fmtNumber(f.count)}</span>
</div>
<div className="mt-1.5 h-2 overflow-hidden rounded-full bg-surface-2">
<div className="h-full rounded-full bg-accent-fill" style={{ width: `${(f.count / maxFamily) * 100}%` }} />
</div>
</li>
))}
</ul>
<>
<Line className="text-2xl font-semibold">{t('recap.typesTitle')}</Line>
<ul className="mt-8 space-y-6">
{recap.families.map((f, k) => {
// Décalages qui se resserrent : la liste arrive comme une vague, pas comme un métronome
const delay = 150 + [0, 110, 190, 240][k]
return (
<li key={f.family} className="recap-in" style={at(delay)}>
<div className="flex items-end justify-between gap-3">
<span className="text-2xl font-bold">{familyLabel(f.family)}</span>
<span className="text-5xl font-extrabold tracking-[-0.03em]">
<Odometer value={f.count} delay={delay + 150} />
</span>
</div>
<div className="recap-track mt-2 h-3 overflow-hidden rounded-full">
<div className="recap-bar recap-bar-ink h-full rounded-full" style={vars({ width: `${(f.count / maxFamily) * 100}%`, '--delay': `${delay + 120}ms` })} />
</div>
</li>
)
})}
</ul>
</>
),
})
if (recap.genres.length)
list.push({
key: 'genres',
title: t('recap.genresTitle'),
body: (
<>
<ol className="space-y-3">
{recap.genres.map((g, k) => (
<li key={g.label} className={cx('font-extrabold leading-tight', k === 0 ? 'text-5xl text-accent' : 'text-3xl')}>
{genreLabel(g.label)}
</li>
))}
<Line className="text-2xl font-semibold">{t('recap.genresTitle')}</Line>
<ol className="mt-5">
{recap.genres.map((g, k) =>
k === 0 ? (
<li key={g.label}>
<Line delay={180} className="text-[clamp(3.2rem,16vw,6.5rem)] font-extrabold leading-[0.95] tracking-[-0.035em]">
{genreLabel(g.label)}
</Line>
</li>
) : (
<li key={g.label} className="recap-in mt-3 flex items-baseline gap-3 text-3xl font-bold" style={at(480 + (k - 1) * 120)}>
<span className="recap-soft text-lg tabular-nums">{k + 1}</span>
{genreLabel(g.label)}
</li>
),
)}
</ol>
{recap.country && (
<p className="mt-10 text-base text-ink-2">
{t('recap.topCountry')} · <span aria-hidden="true">{recap.country.flag}</span> <span className="font-semibold text-ink">{recap.country.name}</span>
</p>
<div className="recap-in mt-12" style={at(850)}>
<p className="recap-soft text-sm">{t('recap.topCountry')}</p>
<p className="mt-1 flex items-center gap-3 text-2xl font-bold">
<span className="text-4xl" aria-hidden="true">
{recap.country.flag}
</span>
{recap.country.name}
</p>
</div>
)}
</>
),
})
if (recap.best.length)
if (recap.best.length) {
// Podium : le 2e à gauche, le n°1 au centre (plus grand, plus haut), le 3e à droite ;
// distribués comme des cartes, du 3e au n°1 (le meilleur arrive en dernier)
const slots = [
{ k: 1, delay: 330, rot: '-5deg', ty: '0px', fx: '40%', fr: '9deg' },
{ k: 0, delay: 580, rot: '0deg', ty: '-18px', fx: '0%', fr: '-5deg' },
{ k: 2, delay: 150, rot: '5deg', ty: '0px', fx: '-40%', fr: '-9deg' },
].filter((s) => recap.best[s.k])
list.push({
key: 'best',
title: t('recap.bestTitle'),
body: (
<>
<div className="grid w-full max-w-md grid-cols-3 gap-3">
{recap.best.map((i) => (
<figure key={i.id} className="min-w-0">
<Poster src={i.poster} title={i.title} />
<figcaption className="mt-2 truncate text-sm font-semibold">{i.title}</figcaption>
<p className="text-sm font-bold text-accent">{formatRating(i.rating)} ★</p>
</figure>
))}
<Line className="text-2xl font-semibold">{t('recap.bestTitle')}</Line>
<div className={cx('mt-10 grid items-end gap-3', slots.length === 3 ? 'grid-cols-[1fr_1.25fr_1fr]' : slots.length === 2 ? 'grid-cols-[1fr_1.25fr]' : 'mx-auto max-w-[45%] grid-cols-1')}>
{slots.map((s) => {
const item = recap.best[s.k]
return (
<figure
key={item.id}
className="recap-deal min-w-0"
data-first={s.k === 0 || undefined}
style={vars({ '--delay': `${s.delay}ms`, '--rot': s.rot, '--ty': s.ty, '--fx': s.fx, '--fr': s.fr })}
>
<div className="recap-poster">
<Poster src={item.poster} title={item.title} />
</div>
<figcaption className="mt-3 truncate text-center text-sm font-semibold">{item.title}</figcaption>
<p className="recap-pop text-center text-sm font-bold">{formatRating(item.rating)} ★</p>
</figure>
)
})}
</div>
{recap.favorites > 0 && (
<p className="mt-8 flex items-center gap-2 text-lg font-semibold">
<Heart size={18} className="fill-accent text-accent" aria-hidden /> {t('recap.favorites', { count: recap.favorites })}
<p className="recap-in mt-10 flex items-center gap-2 text-lg font-semibold" style={at(1000)}>
<Heart size={20} className="recap-pop shrink-0" fill="currentColor" aria-hidden />
{t('recap.favorites', { count: recap.favorites })}
</p>
)}
</>
),
})
}
if (recap.busiest || recap.first)
list.push({
key: 'month',
title: recap.busiest ? t('recap.monthTitle') : t('recap.firstTitle'),
body: (
<>
<Line className="text-2xl font-semibold">{recap.busiest ? t('recap.monthTitle') : t('recap.firstTitle')}</Line>
{recap.busiest && (
<>
<Big>{monthName.charAt(0).toUpperCase() + monthName.slice(1)}</Big>
<p className="mt-3 text-xl font-semibold">{t('stats.monthFinished', { count: recap.busiest.count })}</p>
<Line delay={150} className="mt-2 text-[clamp(3.4rem,18vw,7.5rem)] font-extrabold leading-[0.95] tracking-[-0.04em]">
{monthName(recap.busiest.key)}
</Line>
<p className="mt-3 text-4xl font-extrabold tracking-[-0.03em]">
<Figure value={recap.busiest.count} text={t('stats.monthFinished', { count: recap.busiest.count })} delay={350} unitClass="text-[0.5em] font-semibold tracking-normal" />
</p>
{/* Les 12 mois : les barres poussent en vague, le mois le plus chargé ressort */}
<div className="mt-8 flex h-28 items-end gap-1.5" role="img" aria-label={t('stats.monthByMonth', { year: recap.year })}>
{recap.months.map((m, k) => (
<div key={m.key} className="flex h-full min-w-0 flex-1 flex-col items-center justify-end gap-1.5">
<div className="flex w-full flex-1 items-end">
<div
className={cx('recap-col w-full rounded-t-sm', m.key === recap.busiest!.key ? 'recap-col-on' : 'recap-col-off')}
style={vars({ height: `${Math.max(4, (m.count / maxMonth) * 100)}%`, '--delay': `${450 + k * 35}ms` })}
/>
</div>
<span className="recap-soft text-[11px] font-semibold" aria-hidden>
{m.initial}
</span>
</div>
))}
</div>
</>
)}
{recap.first && (
<div className={cx('flex items-center gap-4 text-start', recap.busiest && 'mt-10')}>
<div className="w-20 shrink-0">
<div className="recap-in mt-10 flex items-center gap-4" style={at(recap.busiest ? 950 : 200)}>
<div className="recap-poster w-16 shrink-0">
<Poster src={recap.first.poster} title={recap.first.title} />
</div>
<div className="min-w-0">
{recap.busiest && <p className="text-sm text-ink-3">{t('recap.firstTitle')}</p>}
{recap.busiest && <p className="recap-soft text-sm">{t('recap.firstTitle')}</p>}
<p className="text-xl font-bold">{recap.first.title}</p>
</div>
</div>
@@ -150,29 +339,52 @@ export default function YearRecap({ recap, onClose, onSeeStats }: { recap: Recap
</>
),
})
const topGenre = recap.genres[0] ? genreLabel(recap.genres[0].label) : undefined
const summary: { label: string; value: ReactNode }[] = [
{ label: t('stats.finished'), value: <Odometer value={recap.finished} delay={300} /> },
...(hours > 0 ? [{ label: t('stats.timeSpent'), value: <Figure value={hours} text={t('common.hours', { h: fmtNumber(hours) })} delay={380} unitClass="text-[0.6em]" /> }] : []),
...(topGenre ? [{ label: t('recap.topGenre'), value: topGenre }] : []),
...(recap.best[0] ? [{ label: t('recap.topRated'), value: recap.best[0].title }] : []),
]
list.push({
key: 'end',
title: t('recap.introTitle', { year: recap.year }),
body: (
<div className="flex w-full max-w-xs flex-col gap-3">
<button type="button" onClick={(e) => (e.stopPropagation(), void makeShare())} disabled={busy} className="btn btn-primary py-3">
<Share2 size={18} /> {t('recap.share')}
</button>
{onSeeStats && (
<button type="button" onClick={(e) => (e.stopPropagation(), onSeeStats())} className="btn btn-ghost py-3">
<BarChart3 size={18} /> {t('recap.seeStats')}
<>
<Line className="text-[clamp(2.4rem,11vw,4.25rem)] font-extrabold leading-[1.02] tracking-[-0.03em]">{t('recap.endTitle', { year: recap.year })}</Line>
<dl className="mt-8 grid grid-cols-2 gap-x-6 gap-y-6">
{summary.map((s, k) => (
<div key={s.label} className="recap-in min-w-0" style={at(250 + [0, 80, 140, 180][k])}>
<dt className="recap-soft text-sm">{s.label}</dt>
<dd className="mt-1 line-clamp-2 text-2xl font-extrabold leading-tight">{s.value}</dd>
</div>
))}
</dl>
<div className="mt-10 flex flex-col gap-3">
<button type="button" onClick={() => void makeShare()} disabled={busy} className="recap-cta btn py-3.5" style={at(650)}>
<Share2 size={18} /> {t('recap.share')}
</button>
)}
</div>
{onSeeStats && (
<button type="button" onClick={onSeeStats} className="recap-in recap-ghost btn py-3.5" style={at(750)}>
<BarChart3 size={18} /> {t('recap.seeStats')}
</button>
)}
</div>
</>
),
})
return list
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [recap, busy])
}, [recap, busy, hiddenNote])
const last = pages.length - 1
const current = pages[Math.min(page, last)]
const go = (d: number) => setPage((p) => Math.min(last, Math.max(0, p + d)))
// Défilement automatique : arrêté si l'appareil demande moins d'animations ; en pause au doigt,
// pendant l'aperçu de l'image, onglet caché ou bouton pause
const autoplay = !reduce
const running = autoplay && !paused && !held && !share && !pageHidden
useEffect(() => {
// Aperçu de l'image ouvert par-dessus : les flèches ne tournent pas les pages derrière
if (share) return
@@ -195,50 +407,108 @@ export default function YearRecap({ recap, onClose, onSeeStats }: { recap: Recap
}
}
// Toucher : moitié de fin = suivant, début = précédent ; glisser = changer de page
const onPointerDown = (e: React.PointerEvent) => {
down.current = e.clientX
// Toucher : début de l'écran = précédent, le reste = suivant ; glisser = changer de page ;
// doigt posé plus d'un instant = pause (la page reprend quand on le lève)
const endPress = () => {
const p = press.current
press.current = null
if (p) clearTimeout(p.timer)
if (p?.held) setHeld(false)
return p
}
const onPointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
if (down.current == null) return
const dx = e.clientX - down.current
down.current = null
const onPointerDown = (e: PointerEvent<HTMLDivElement>) => {
if ((e.target as Element).closest('button, a')) return
endPress()
const p = { x: e.clientX, y: e.clientY, timer: 0, held: false }
p.timer = window.setTimeout(() => {
p.held = true
setHeld(true)
}, 220)
press.current = p
}
const onPointerMove = (e: PointerEvent<HTMLDivElement>) => {
const p = press.current
// Le doigt glisse : c'est un geste, pas une pause
if (p && !p.held && Math.hypot(e.clientX - p.x, e.clientY - p.y) > 12) clearTimeout(p.timer)
}
const onPointerUp = (e: PointerEvent<HTMLDivElement>) => {
const p = endPress()
if (!p || p.held) return
const dx = e.clientX - p.x
const dy = e.clientY - p.y
const rtl = document.dir === 'rtl'
if (Math.abs(dx) > 50) return go((dx < 0) !== rtl ? 1 : -1)
if (Math.abs(dx) > 50 && Math.abs(dx) > Math.abs(dy)) return go((dx < 0) !== rtl ? 1 : -1)
if (Math.hypot(dx, dy) > 12) return
const r = e.currentTarget.getBoundingClientRect()
const atStart = rtl ? e.clientX > r.left + r.width * 0.7 : e.clientX < r.left + r.width * 0.3
go(atStart ? -1 : 1)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => () => void endPress(), [])
const current = pages[page]
return (
<div className="sheet-in fixed inset-0 z-[60] flex flex-col bg-bg text-ink" role="dialog" aria-modal="true" aria-label={t('recap.introTitle', { year: recap.year })}>
<div className="safe-top px-3 pt-2.5">
<div className="recap-stage" data-scene={current.key} data-held={held || undefined} role="dialog" aria-modal="true" aria-label={t('recap.introTitle', { year: recap.year })}>
{/* Ambiance : halos, pellicule, année en contour (et confettis sur la dernière page) */}
<div className="recap-ambient" aria-hidden>
<span className="recap-blob recap-blob-a" />
<span className="recap-blob recap-blob-b" />
{(current.key === 'intro' || current.key === 'time' || current.key === 'best') && (
<span className="recap-film">
<span />
</span>
)}
{current.key === 'intro' && <span className="recap-year-outline">{recap.year}</span>}
{current.key === 'end' && (
<span className="recap-confetti">
{CONFETTI.map((c, k) => (
<i
key={k}
className={cx(`recap-c${c.color}`, c.shape === 0 ? 'size-2.5 rounded-full' : c.shape === 1 ? 'size-2.5' : 'h-1.5 w-4')}
style={vars({ '--x': `${c.x}px`, '--y': `${c.y}px`, '--r': `${c.r}deg`, '--delay': `${c.delay}ms` })}
/>
))}
</span>
)}
</div>
<div className="recap-chrome safe-top relative z-10 px-3 pt-2.5">
<div className="flex gap-1" aria-hidden>
{pages.map((p, k) => (
<span key={p.key} className={cx('h-1 flex-1 rounded-full transition-colors', k <= page ? 'bg-ink' : 'bg-line')} />
))}
{pages.map((p, k) => {
const state = k < page ? 'done' : k > page ? 'todo' : k === last || !autoplay ? 'full' : 'current'
return (
<span key={p.key} className="recap-seg" data-state={state} data-paused={(state === 'current' && !running) || undefined} style={vars({ '--dur': `${DURATION[p.key]}ms` })}>
<i key={state === 'current' ? `run-${page}` : state} onAnimationEnd={state === 'current' ? () => go(1) : undefined} />
</span>
)
})}
</div>
<div className="mt-2 flex items-center justify-between">
<span className="ps-1 text-sm font-bold">
Bobin<span className="text-accent">oo</span> · {recap.year}
Bobin<span className="recap-pop">oo</span> {recap.year}
</span>
<button onClick={onClose} className="grid size-10 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}>
<X size={22} />
</button>
<div className="flex items-center">
{autoplay && page < last && (
<button onClick={() => setPaused((v) => !v)} className="grid size-10 place-items-center rounded-full" aria-label={paused ? t('recap.play') : t('recap.pause')}>
{paused ? <Play size={19} /> : <Pause size={19} />}
</button>
)}
<button onClick={onClose} className="grid size-10 place-items-center rounded-full" aria-label={t('common.close')}>
<X size={22} />
</button>
</div>
</div>
</div>
<div
className="relative flex min-h-0 flex-1 cursor-pointer touch-pan-y select-none flex-col items-center justify-center px-6 pb-[calc(2rem+env(safe-area-inset-bottom))] text-center"
className="no-scrollbar relative z-10 flex min-h-0 flex-1 cursor-pointer touch-pan-y select-none flex-col overflow-y-auto px-6 pb-[calc(2.5rem+env(safe-area-inset-bottom))]"
onPointerDown={onPointerDown}
onPointerMove={onPointerMove}
onPointerUp={onPointerUp}
onPointerCancel={() => void endPress()}
onPointerLeave={() => void endPress()}
aria-live="polite"
>
<h2 key={current.key + '-t'} className="sheet-in mb-8 text-lg font-semibold text-ink-2">
{current.title}
</h2>
<div key={current.key} className="sheet-in flex w-full flex-col items-center">
<div key={current.key} className="mx-auto my-auto w-full max-w-[30rem] py-6">
{current.body}
</div>
</div>
+8 -1
View File
@@ -1122,7 +1122,7 @@ const dict: Translations = {
'stats.decades': "عقود الإصدار",
'stats.settings': "إعدادات الإحصاءات",
'stats.monthHidden': "مخفي",
'stats.hideMonthsHint': "ألغِ تحديد شهر لإزالته من الرسم (مثل الشهر الذي أضفت فيه كل شيء دفعة واحدة). تبقى أعماله محسوبة في كل مكان آخر.",
'stats.hideMonthsHint': "ألغِ تحديد شهر لإزالته من الرسم (مثل الشهر الذي أضفت فيه كل شيء دفعة واحدة). تبقى أعماله محسوبة في باقي الإحصاءات، لكن ليس في ملخص سنتك.",
'stats.showAllMonths': "إظهار الكل من جديد",
// — Mode découverte (sans compte) —
'guest.explore': "استكشف بدون حساب",
@@ -1235,6 +1235,13 @@ const dict: Translations = {
"social.publicJoin": "انضم إلى Bobinoo",
"social.publicCtaTitle": "تريد رؤية مكتبته كاملة؟",
"social.publicCtaText": "أنشئ حسابك لمتابعة {name} ورؤية كل عناوينه وتنظيم قائمتك الخاصة. مجانًا.",
"recap.soon": "ملخص سنتك {year} يصل في 1 ديسمبر.",
"recap.hiddenNote": "الأشهر المخفية في إحصاءاتك غير محسوبة هنا: {months}.",
"recap.pause": "إيقاف مؤقت",
"recap.play": "متابعة",
"recap.endTitle": "هكذا كانت سنتك {year}",
"recap.topGenre": "النوع المفضل",
"recap.topRated": "الأعلى تقييمًا",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Erscheinungsjahrzehnte",
'stats.settings': "Statistik-Einstellungen",
'stats.monthHidden': "ausgeblendet",
'stats.hideMonthsHint': "Entferne den Haken bei einem Monat, um ihn aus dem Diagramm zu nehmen (z. B. den Monat, in dem du alles auf einmal hinzugefügt hast). Die Titel zählen überall sonst weiter.",
'stats.hideMonthsHint': "Entferne den Haken bei einem Monat, um ihn aus dem Diagramm zu nehmen (z. B. den Monat, in dem du alles auf einmal hinzugefügt hast). Die Titel zählen im Rest der Statistiken weiter, aber nicht in deinem Jahresrückblick.",
'stats.showAllMonths': "Alle wieder anzeigen",
// — Mode découverte (sans compte) —
'guest.explore': "Ohne Konto erkunden",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Bobinoo beitreten",
"social.publicCtaTitle": "Lust, die ganze Bibliothek zu sehen?",
"social.publicCtaText": "Erstelle dein Konto, um {name} zu folgen, alle Titel zu sehen und deine eigene Liste zu führen. Es ist kostenlos.",
"recap.soon": "Dein Jahresrückblick {year} kommt am 1. Dezember.",
"recap.hiddenNote": "In deinen Statistiken ausgeblendete Monate zählen hier nicht: {months}.",
"recap.pause": "Pausieren",
"recap.play": "Fortsetzen",
"recap.endTitle": "Das war dein Jahr {year}",
"recap.topGenre": "Lieblingsgenre",
"recap.topRated": "Am besten bewertet",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Release decades",
'stats.settings': "Stats settings",
'stats.monthHidden': "hidden",
'stats.hideMonthsHint': "Uncheck a month to remove it from the chart (for example the month you added everything at once). Its titles still count everywhere else.",
'stats.hideMonthsHint': "Uncheck a month to remove it from the chart (for example the month you added everything at once). Its titles still count in the rest of your stats, but not in your year in review.",
'stats.showAllMonths': "Show all again",
// — Mode découverte (sans compte) —
'guest.explore': "Explore without an account",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Join Bobinoo",
"social.publicCtaTitle": "Want to see their whole library?",
"social.publicCtaText": "Create your account to follow {name}, see all their titles and keep your own list. It’s free.",
"recap.soon": "Your {year} in review arrives on December 1.",
"recap.hiddenNote": "Months hidden in your stats aren't counted here: {months}.",
"recap.pause": "Pause",
"recap.play": "Play",
"recap.endTitle": "That was your {year}",
"recap.topGenre": "Top genre",
"recap.topRated": "Top rated",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Décadas de estreno",
'stats.settings': "Ajustes de estadísticas",
'stats.monthHidden': "oculto",
'stats.hideMonthsHint': "Desmarca un mes para quitarlo del gráfico (por ejemplo, el mes en que lo añadiste todo de golpe). Sus títulos siguen contando en todo lo demás.",
'stats.hideMonthsHint': "Desmarca un mes para quitarlo del gráfico (por ejemplo, el mes en que lo añadiste todo de golpe). Sus títulos siguen contando en el resto de estadísticas, pero no en tu resumen del año.",
'stats.showAllMonths': "Mostrar todo de nuevo",
// — Mode découverte (sans compte) —
'guest.explore': "Explorar sin cuenta",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Unirme a Bobinoo",
"social.publicCtaTitle": "¿Quieres ver toda su biblioteca?",
"social.publicCtaText": "Crea tu cuenta para seguir a {name}, ver todos sus títulos y llevar tu propia lista. Es gratis.",
"recap.soon": "Tu resumen de {year} llega el 1 de diciembre.",
"recap.hiddenNote": "Los meses ocultos en tus estadísticas no cuentan aquí: {months}.",
"recap.pause": "Pausar",
"recap.play": "Reanudar",
"recap.endTitle": "Así fue tu {year}",
"recap.topGenre": "Género favorito",
"recap.topRated": "Mejor valorado",
}
export default dict
+8 -1
View File
@@ -978,7 +978,7 @@ const dict = {
'stats.decades': "Décennies de sortie",
'stats.settings': "Paramètres des stats",
'stats.monthHidden': "masqué",
'stats.hideMonthsHint': "Décoche un mois pour le retirer de la courbe (par exemple le mois où tu as tout ajouté d'un coup). Les titres restent comptés partout ailleurs.",
'stats.hideMonthsHint': "Décoche un mois pour le retirer de la courbe (par exemple le mois où tu as tout ajouté d'un coup). Ses titres restent comptés ailleurs dans les stats, mais pas dans ton bilan de l'année.",
'stats.showAllMonths': "Tout réafficher",
// — Mode découverte (sans compte) —
'guest.explore': "Explorer sans compte",
@@ -1082,6 +1082,13 @@ const dict = {
"social.publicJoin": "Rejoindre Bobinoo",
"social.publicCtaTitle": "Envie de voir toute sa bibliothèque ?",
"social.publicCtaText": "Crée ton compte pour suivre {name}, voir tous ses titres et tenir ta propre liste. C’est gratuit.",
"recap.soon": "Ton bilan {year} arrive le 1er décembre.",
"recap.hiddenNote": "Mois masqués dans tes stats, pas comptés ici\u00a0: {months}.",
"recap.pause": "Mettre en pause",
"recap.play": "Reprendre",
"recap.endTitle": "Voilà ton année {year}",
"recap.topGenre": "Genre n°1",
"recap.topRated": "Le mieux noté",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "रिलीज़ के दशक",
'stats.settings': "आँकड़ों की सेटिंग",
'stats.monthHidden': "छिपा",
'stats.hideMonthsHint': "किसी महीने को ग्राफ़ से हटाने के लिए उसका चिह्न हटाएँ (जैसे वह महीना जब आपने सब कुछ एक साथ जोड़ा)। उसके टाइटल बाकी जगह गिने जाते रहेंगे।",
'stats.hideMonthsHint': "किसी महीने को ग्राफ़ से हटाने के लिए उसका चिह्न हटाएँ (जैसे वह महीना जब आपने सब कुछ एक साथ जोड़ा)। उसके टाइटल बाकी आँकड़ों में गिने जाते रहेंगे, पर साल के सारांश में नहीं।",
'stats.showAllMonths': "सब फिर से दिखाएँ",
// — Mode découverte (sans compte) —
'guest.explore': "बिना खाते के देखें",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Bobinoo से जुड़ें",
"social.publicCtaTitle": "पूरी लाइब्रेरी देखनी है?",
"social.publicCtaText": "{name} को फ़ॉलो करने, सारे टाइटल देखने और अपनी लिस्ट बनाने के लिए अपना अकाउंट बनाएँ। यह मुफ़्त है।",
"recap.soon": "आपका {year} का सारांश 1 दिसंबर को आएगा।",
"recap.hiddenNote": "आँकड़ों में छिपाए गए महीने यहाँ नहीं गिने जाते: {months}।",
"recap.pause": "रोकें",
"recap.play": "जारी रखें",
"recap.endTitle": "ऐसा रहा आपका {year}",
"recap.topGenre": "पसंदीदा जॉनर",
"recap.topRated": "सबसे ऊँची रेटिंग",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Dekade rilis",
'stats.settings': "Pengaturan statistik",
'stats.monthHidden': "disembunyikan",
'stats.hideMonthsHint': "Hapus centang bulan untuk mengeluarkannya dari grafik (misalnya bulan saat kamu menambahkan semuanya sekaligus). Judulnya tetap dihitung di tempat lain.",
'stats.hideMonthsHint': "Hapus centang bulan untuk mengeluarkannya dari grafik (misalnya bulan saat kamu menambahkan semuanya sekaligus). Judulnya tetap dihitung di statistik lain, tapi tidak di rangkuman tahunanmu.",
'stats.showAllMonths': "Tampilkan semua lagi",
// — Mode découverte (sans compte) —
'guest.explore': "Jelajahi tanpa akun",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Gabung ke Bobinoo",
"social.publicCtaTitle": "Mau lihat seluruh koleksinya?",
"social.publicCtaText": "Buat akunmu untuk mengikuti {name}, melihat semua judulnya, dan menyusun daftarmu sendiri. Gratis.",
"recap.soon": "Rangkuman {year}-mu hadir pada 1 Desember.",
"recap.hiddenNote": "Bulan yang kamu sembunyikan di statistik tidak dihitung di sini: {months}.",
"recap.pause": "Jeda",
"recap.play": "Lanjutkan",
"recap.endTitle": "Inilah tahun {year}-mu",
"recap.topGenre": "Genre favorit",
"recap.topRated": "Nilai tertinggi",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Decenni di uscita",
'stats.settings': "Impostazioni statistiche",
'stats.monthHidden': "nascosto",
'stats.hideMonthsHint': "Deseleziona un mese per toglierlo dal grafico (ad esempio il mese in cui hai aggiunto tutto in una volta). I suoi titoli contano comunque altrove.",
'stats.hideMonthsHint': "Deseleziona un mese per toglierlo dal grafico (ad esempio il mese in cui hai aggiunto tutto in una volta). I suoi titoli contano nel resto delle statistiche, ma non nel riepilogo dell'anno.",
'stats.showAllMonths': "Mostra di nuovo tutto",
// — Mode découverte (sans compte) —
'guest.explore': "Esplora senza account",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Unisciti a Bobinoo",
"social.publicCtaTitle": "Vuoi vedere tutta la sua libreria?",
"social.publicCtaText": "Crea il tuo account per seguire {name}, vedere tutti i suoi titoli e tenere la tua lista. È gratis.",
"recap.soon": "Il tuo riepilogo {year} arriva il 1° dicembre.",
"recap.hiddenNote": "I mesi nascosti nelle statistiche non contano qui: {months}.",
"recap.pause": "Metti in pausa",
"recap.play": "Riprendi",
"recap.endTitle": "Questo è stato il tuo {year}",
"recap.topGenre": "Genere preferito",
"recap.topRated": "Il più votato",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "公開年代",
'stats.settings': "統計の設定",
'stats.monthHidden': "非表示",
'stats.hideMonthsHint': "グラフから外したい月のチェックを外してください(例:まとめて追加した月)。その作品はほかの統計では引き続き数えられます。",
'stats.hideMonthsHint': "グラフから外したい月のチェックを外してください(例:まとめて追加した月)。その作品はほかの統計では引き続き数えられますが、年間のまとめには含まれません。",
'stats.showAllMonths': "すべて再表示",
// — Mode découverte (sans compte) —
'guest.explore': "アカウントなしで見る",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Bobinoo に参加",
"social.publicCtaTitle": "ライブラリ全体を見てみる?",
"social.publicCtaText": "アカウントを作ると、{name} さんをフォローして全作品を見たり、自分のリストを作ったりできます。無料です。",
"recap.soon": "{year}年のまとめは12月1日に公開されます。",
"recap.hiddenNote": "統計で非表示にした月はここでは数えません:{months}。",
"recap.pause": "一時停止",
"recap.play": "再生",
"recap.endTitle": "これがあなたの{year}年",
"recap.topGenre": "いちばん見たジャンル",
"recap.topRated": "いちばん高評価",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "개봉 연대",
'stats.settings': "통계 설정",
'stats.monthHidden': "숨김",
'stats.hideMonthsHint': "그래프에서 빼고 싶은 달의 체크를 해제하세요(예: 한꺼번에 추가한 달). 해당 작품은 다른 통계에서는 계속 집계돼요.",
'stats.hideMonthsHint': "그래프에서 빼고 싶은 달의 체크를 해제하세요(예: 한꺼번에 추가한 달). 해당 작품은 다른 통계에서는 계속 집계되지만 연간 결산에는 포함되지 않아요.",
'stats.showAllMonths': "모두 다시 표시",
// — Mode découverte (sans compte) —
'guest.explore': "계정 없이 둘러보기",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Bobinoo 가입하기",
"social.publicCtaTitle": "라이브러리 전체를 보고 싶나요?",
"social.publicCtaText": "계정을 만들면 {name} 님을 팔로우하고, 모든 작품을 보고, 나만의 리스트를 만들 수 있어요. 무료예요.",
"recap.soon": "{year}년 결산은 12월 1일에 공개돼요.",
"recap.hiddenNote": "통계에서 숨긴 달은 여기서 세지 않아요: {months}.",
"recap.pause": "일시정지",
"recap.play": "다시 재생",
"recap.endTitle": "이게 바로 당신의 {year}년",
"recap.topGenre": "가장 많이 본 장르",
"recap.topRated": "최고 평점",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Decennia van uitgave",
'stats.settings': "Statistiekinstellingen",
'stats.monthHidden': "verborgen",
'stats.hideMonthsHint': "Vink een maand uit om hem uit de grafiek te halen (bijvoorbeeld de maand waarin je alles in één keer toevoegde). De titels tellen elders gewoon mee.",
'stats.hideMonthsHint': "Vink een maand uit om hem uit de grafiek te halen (bijvoorbeeld de maand waarin je alles in één keer toevoegde). De titels tellen gewoon mee in de rest van je statistieken, maar niet in je jaaroverzicht.",
'stats.showAllMonths': "Alles weer tonen",
// — Mode découverte (sans compte) —
'guest.explore': "Verkennen zonder account",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Word lid van Bobinoo",
"social.publicCtaTitle": "Zin om de hele bibliotheek te zien?",
"social.publicCtaText": "Maak een account om {name} te volgen, alle titels te zien en je eigen lijst bij te houden. Het is gratis.",
"recap.soon": "Je jaaroverzicht {year} komt op 1 december.",
"recap.hiddenNote": "Maanden die je in je statistieken verbergt, tellen hier niet mee: {months}.",
"recap.pause": "Pauzeren",
"recap.play": "Verder afspelen",
"recap.endTitle": "Dit was jouw {year}",
"recap.topGenre": "Favoriete genre",
"recap.topRated": "Hoogst beoordeeld",
}
export default dict
+8 -1
View File
@@ -1072,7 +1072,7 @@ const dict: Translations = {
'stats.decades': "Dekady premiery",
'stats.settings': "Ustawienia statystyk",
'stats.monthHidden': "ukryty",
'stats.hideMonthsHint': "Odznacz miesiąc, aby usunąć go z wykresu (np. miesiąc, w którym dodałeś wszystko naraz). Tytuły nadal liczą się w pozostałych statystykach.",
'stats.hideMonthsHint': "Odznacz miesiąc, aby usunąć go z wykresu (np. miesiąc, w którym dodałeś wszystko naraz). Tytuły nadal liczą się w pozostałych statystykach, ale nie w podsumowaniu roku.",
'stats.showAllMonths': "Pokaż wszystko",
// — Mode découverte (sans compte) —
'guest.explore': "Przeglądaj bez konta",
@@ -1182,6 +1182,13 @@ const dict: Translations = {
"social.publicJoin": "Dołącz do Bobinoo",
"social.publicCtaTitle": "Chcesz zobaczyć całą bibliotekę?",
"social.publicCtaText": "Załóż konto, aby obserwować {name}, widzieć wszystkie tytuły i prowadzić własną listę. To nic nie kosztuje.",
"recap.soon": "Twoje podsumowanie {year} pojawi się 1 grudnia.",
"recap.hiddenNote": "Miesiące ukryte w statystykach nie są tu liczone: {months}.",
"recap.pause": "Wstrzymaj",
"recap.play": "Wznów",
"recap.endTitle": "Tak wyglądał twój {year}",
"recap.topGenre": "Ulubiony gatunek",
"recap.topRated": "Najwyżej oceniony",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Décadas de estreia",
'stats.settings': "Definições das estatísticas",
'stats.monthHidden': "oculto",
'stats.hideMonthsHint': "Desmarca um mês para o retirar do gráfico (por exemplo, o mês em que adicionaste tudo de uma vez). Os títulos continuam a contar em todo o resto.",
'stats.hideMonthsHint': "Desmarque um mês para tirá-lo do gráfico (por exemplo, o mês em que você adicionou tudo de uma vez). Os títulos continuam contando no resto das estatísticas, mas não na sua retrospectiva do ano.",
'stats.showAllMonths': "Mostrar tudo outra vez",
// — Mode découverte (sans compte) —
'guest.explore': "Explorar sem conta",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Entrar no Bobinoo",
"social.publicCtaTitle": "Quer ver toda a biblioteca?",
"social.publicCtaText": "Crie sua conta para seguir {name}, ver todos os títulos e montar sua própria lista. É grátis.",
"recap.soon": "Sua retrospectiva {year} chega em 1º de dezembro.",
"recap.hiddenNote": "Os meses ocultos nas suas estatísticas não contam aqui: {months}.",
"recap.pause": "Pausar",
"recap.play": "Continuar",
"recap.endTitle": "Esse foi o seu {year}",
"recap.topGenre": "Gênero favorito",
"recap.topRated": "Mais bem avaliado",
}
export default dict
+8 -1
View File
@@ -1072,7 +1072,7 @@ const dict: Translations = {
'stats.decades': "Десятилетия выхода",
'stats.settings': "Настройки статистики",
'stats.monthHidden': "скрыт",
'stats.hideMonthsHint': "Сними отметку с месяца, чтобы убрать его с графика (например, месяц, когда ты добавил всё сразу). Тайтлы по-прежнему учитываются во всём остальном.",
'stats.hideMonthsHint': "Сними отметку с месяца, чтобы убрать его с графика (например, месяц, когда ты добавил всё сразу). Тайтлы по-прежнему учитываются в остальной статистике, но не в итогах года.",
'stats.showAllMonths': "Показать всё снова",
// — Mode découverte (sans compte) —
'guest.explore': "Посмотреть без аккаунта",
@@ -1182,6 +1182,13 @@ const dict: Translations = {
"social.publicJoin": "Присоединиться к Bobinoo",
"social.publicCtaTitle": "Хочешь увидеть всю библиотеку?",
"social.publicCtaText": "Создай аккаунт, чтобы подписаться на {name}, видеть все тайтлы и вести свой список. Это бесплатно.",
"recap.soon": "Твои итоги {year} появятся 1 декабря.",
"recap.hiddenNote": "Месяцы, скрытые в статистике, здесь не учитываются: {months}.",
"recap.pause": "Пауза",
"recap.play": "Продолжить",
"recap.endTitle": "Таким был твой {year} год",
"recap.topGenre": "Любимый жанр",
"recap.topRated": "Лучшая оценка",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "ทศวรรษที่ออกฉาย",
'stats.settings': "ตั้งค่าสถิติ",
'stats.monthHidden': "ซ่อน",
'stats.hideMonthsHint': "ยกเลิกเครื่องหมายเดือนเพื่อเอาออกจากกราฟ (เช่น เดือนที่คุณเพิ่มทุกอย่างพร้อมกัน) เรื่องในเดือนนั้นยังนับในส่วนอื่นตามปกติ",
'stats.hideMonthsHint': "ยกเลิกเครื่องหมายเดือนเพื่อเอาออกจากกราฟ (เช่น เดือนที่คุณเพิ่มทุกอย่างพร้อมกัน) เรื่องในเดือนนั้นยังนับในสถิติส่วนอื่น แต่ไม่นับในสรุปประจำปี",
'stats.showAllMonths': "แสดงทั้งหมดอีกครั้ง",
// — Mode découverte (sans compte) —
'guest.explore': "สำรวจโดยไม่ต้องมีบัญชี",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "เข้าร่วม Bobinoo",
"social.publicCtaTitle": "อยากดูคลังทั้งหมดไหม?",
"social.publicCtaText": "สร้างบัญชีเพื่อติดตาม {name} ดูทุกเรื่อง และจดรายการของคุณเอง ใช้ฟรี",
"recap.soon": "สรุปปี {year} ของคุณจะมาในวันที่ 1 ธันวาคม",
"recap.hiddenNote": "เดือนที่ซ่อนไว้ในสถิติจะไม่ถูกนับที่นี่: {months}",
"recap.pause": "หยุดชั่วคราว",
"recap.play": "เล่นต่อ",
"recap.endTitle": "นี่คือปี {year} ของคุณ",
"recap.topGenre": "แนวที่ชอบที่สุด",
"recap.topRated": "คะแนนสูงสุด",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Yayın on yılları",
'stats.settings': "İstatistik ayarları",
'stats.monthHidden': "gizli",
'stats.hideMonthsHint': "Bir ayı grafikten çıkarmak için işaretini kaldır (örneğin her şeyi bir kerede eklediğin ay). Yapımlar diğer her yerde sayılmaya devam eder.",
'stats.hideMonthsHint': "Bir ayı grafikten çıkarmak için işaretini kaldır (örneğin her şeyi bir kerede eklediğin ay). Yapımlar diğer istatistiklerde sayılmaya devam eder, ama yıllık özetinde sayılmaz.",
'stats.showAllMonths': "Hepsini yeniden göster",
// — Mode découverte (sans compte) —
'guest.explore': "Hesapsız keşfet",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Bobinoo’ya katıl",
"social.publicCtaTitle": "Kütüphanenin tamamını görmek ister misin?",
"social.publicCtaText": "{name} kişisini takip etmek, tüm yapımlarını görmek ve kendi listeni tutmak için hesabını oluştur. Ücretsiz.",
"recap.soon": "{year} özetin 1 Aralık'ta geliyor.",
"recap.hiddenNote": "İstatistiklerinde gizlediğin aylar burada sayılmaz: {months}.",
"recap.pause": "Duraklat",
"recap.play": "Devam et",
"recap.endTitle": "İşte {year} yılın",
"recap.topGenre": "En sevdiğin tür",
"recap.topRated": "En yüksek puanlı",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "Thập niên phát hành",
'stats.settings': "Cài đặt thống kê",
'stats.monthHidden': "đã ẩn",
'stats.hideMonthsHint': "Bỏ chọn một tháng để loại nó khỏi biểu đồ (ví dụ tháng bạn thêm mọi thứ cùng lúc). Các phim vẫn được tính ở mọi nơi khác.",
'stats.hideMonthsHint': "Bỏ chọn một tháng để loại nó khỏi biểu đồ (ví dụ tháng bạn thêm mọi thứ cùng lúc). Các phim vẫn được tính trong phần thống kê khác, nhưng không tính trong tổng kết năm.",
'stats.showAllMonths': "Hiện lại tất cả",
// — Mode découverte (sans compte) —
'guest.explore': "Khám phá không cần tài khoản",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "Tham gia Bobinoo",
"social.publicCtaTitle": "Muốn xem toàn bộ thư viện?",
"social.publicCtaText": "Tạo tài khoản để theo dõi {name}, xem mọi phim và tự lập danh sách của riêng bạn. Miễn phí.",
"recap.soon": "Tổng kết năm {year} của bạn sẽ có vào ngày 1 tháng 12.",
"recap.hiddenNote": "Các tháng bạn ẩn trong thống kê không được tính ở đây: {months}.",
"recap.pause": "Tạm dừng",
"recap.play": "Tiếp tục",
"recap.endTitle": "Đó là năm {year} của bạn",
"recap.topGenre": "Thể loại yêu thích",
"recap.topRated": "Điểm cao nhất",
}
export default dict
+8 -1
View File
@@ -976,7 +976,7 @@ const dict: Translations = {
'stats.decades': "上映年代",
'stats.settings': "统计设置",
'stats.monthHidden': "已隐藏",
'stats.hideMonthsHint': "取消勾选某个月即可将其从图表中移除(例如一次性添加所有内容的那个月)。这些作品在其他统计中仍会计入。",
'stats.hideMonthsHint': "取消勾选某个月即可将其从图表中移除(例如一次性添加所有内容的那个月)。这些作品在其他统计中仍会计入,但不计入年度回顾。",
'stats.showAllMonths': "全部重新显示",
// — Mode découverte (sans compte) —
'guest.explore': "无需账户先逛逛",
@@ -1080,6 +1080,13 @@ const dict: Translations = {
"social.publicJoin": "加入 Bobinoo",
"social.publicCtaTitle": "想看完整片库?",
"social.publicCtaText": "创建账号即可关注 {name}、查看全部作品并管理你自己的片单。免费使用。",
"recap.soon": "你的 {year} 年度回顾将于 12 月 1 日上线。",
"recap.hiddenNote": "在统计中隐藏的月份不计入这里:{months}。",
"recap.pause": "暂停",
"recap.play": "继续播放",
"recap.endTitle": "这就是你的 {year} 年",
"recap.topGenre": "最爱类型",
"recap.topRated": "评分最高",
}
export default dict
+38 -9
View File
@@ -23,13 +23,30 @@ export interface YearRecap {
favorites: number
/** Mois avec le plus de titres terminés (seulement s'il sort du lot) */
busiest?: MonthBucket
/** Les 12 mois de l'année (titres terminés par mois), mois masqués à zéro */
months: MonthBucket[]
/** Premier titre terminé de l'année */
first?: MediaItem
/** Mois de l'année masqués dans les réglages des stats (AAAA-MM) : leurs titres ne sont pas comptés */
hiddenMonths: string[]
}
/** Bilan d'une année à partir de la bibliothèque (rien n'est envoyé : tout est calculé sur l'appareil). */
export function yearRecap(items: MediaItem[], year: string): YearRecap {
/** Mois masqués dans les stats qui tombent dans l'année demandée. */
const hiddenIn = (year: string, hiddenMonths: readonly string[] = []) => new Set(hiddenMonths.filter((m) => m.startsWith(`${year}-`)))
/** Titres de l'année, sans ceux des mois masqués dans les réglages des stats (ex. le mois où tout a été ajouté d'un coup). */
function yearItems(items: MediaItem[], year: string, hidden: Set<string>): MediaItem[] {
const list = itemsForPeriod(items, year)
return hidden.size ? list.filter((i) => !hidden.has(watchDate(i)?.slice(0, 7) ?? '')) : list
}
/**
* Bilan d'une année à partir de la bibliothèque (rien n'est envoyé : tout est calculé sur l'appareil).
* Les mois masqués dans les réglages des stats ne comptent pas.
*/
export function yearRecap(items: MediaItem[], year: string, hiddenMonths?: readonly string[]): YearRecap {
const hidden = hiddenIn(year, hiddenMonths)
const list = yearItems(items, year, hidden)
const done = list.filter((i) => i.status === 'termine')
const stats = computeStats(list)
@@ -42,8 +59,9 @@ export function yearRecap(items: MediaItem[], year: string): YearRecap {
.sort((a, b) => (b.rating ?? 0) - (a.rating ?? 0) || byDate(b).localeCompare(byDate(a)))
.slice(0, 3)
const months = monthly(list, year).sort((a, b) => b.count - a.count)
const busiest = months[0] && months[0].count > (months[1]?.count ?? 0) ? months[0] : undefined
const months = monthly(list, year)
const ranked = [...months].sort((a, b) => b.count - a.count)
const busiest = ranked[0] && ranked[0].count > (ranked[1]?.count ?? 0) ? ranked[0] : undefined
return {
year,
@@ -57,18 +75,29 @@ export function yearRecap(items: MediaItem[], year: string): YearRecap {
best,
favorites: list.filter((i) => i.favorite && i.status !== 'a_voir').length,
busiest,
months,
first: [...done].sort((a, b) => byDate(a).localeCompare(byDate(b)))[0],
hiddenMonths: [...hidden].sort(),
}
}
/** Titres terminés dans l'année : de quoi décider d'afficher le bilan, sans tout calculer. */
export function finishedInYear(items: MediaItem[], year: string): number {
return itemsForPeriod(items, year).filter((i) => i.status === 'termine').length
/** Titres terminés dans l'année (mois masqués exclus) : de quoi décider d'afficher le bilan, sans tout calculer. */
export function finishedInYear(items: MediaItem[], year: string, hiddenMonths?: readonly string[]): number {
return yearItems(items, year, hiddenIn(year, hiddenMonths)).filter((i) => i.status === 'termine').length
}
/**
* Année dont le bilan est mis en avant sur l'accueil : l'année en cours en décembre, l'année passée en janvier.
* Le reste du temps, aucun (le bilan reste accessible depuis les stats).
* Le bilan d'une année arrive le 1er décembre de cette année-là (comme les bilans de fin d'année des applis
* de musique) ; ensuite il reste consultable depuis les stats. Avant, l'année n'est pas finie : pas de bilan.
*/
export function recapUnlocked(year: string, now = new Date()): boolean {
const y = Number(year)
return Number.isInteger(y) && (y < now.getFullYear() || (y === now.getFullYear() && now.getMonth() === 11))
}
/**
* Année dont le bilan est mis en avant (accueil, stats sans année choisie) : l'année en cours à partir du
* 1er décembre, l'année passée en janvier. Le reste du temps, aucune.
*/
export function recapSeasonYear(now = new Date()): string | undefined {
if (now.getMonth() === 11) return String(now.getFullYear())
+115 -49
View File
@@ -167,8 +167,8 @@ function drawRating(ctx: CanvasRenderingContext2D, rating: number, x: number, y:
return 5 * size + 4 * gap
}
function drawBrand(ctx: CanvasRenderingContext2D, y: number) {
const c = colors()
function drawBrand(ctx: CanvasRenderingContext2D, y: number, ink?: string, accent?: string) {
const c = { ...colors(), ...(ink ? { ink } : {}), ...(accent ? { accent } : {}) }
ctx.textBaseline = 'alphabetic'
ctx.textAlign = 'left'
ctx.font = `800 34px ${FONT}`
@@ -429,79 +429,145 @@ export async function renderTopCard(title: string, entries: (MediaItem | undefin
* Bilan de l'année : grande année en couleur, quatre chiffres clés, les trois titres les mieux notés
* (affiches) et les genres préférés.
*/
/** Couleurs de l'image du bilan : celles de la première page du bilan (vert d'eau profond, halos, pellicule). */
const RECAP_CARD = {
bg: '#0c3a36',
ink: '#f6f3ea',
soft: 'rgba(246, 243, 234, 0.72)',
faint: 'rgba(246, 243, 234, 0.13)',
pop: '#8ce6db',
blobA: 'rgba(28, 138, 128, 0.75)',
blobB: 'rgba(231, 181, 77, 0.32)',
}
/** Halo rond qui se fond dans le fond. */
function glow(ctx: CanvasRenderingContext2D, x: number, y: number, r: number, color: string) {
const g = ctx.createRadialGradient(x, y, 0, x, y, r)
g.addColorStop(0, color)
g.addColorStop(1, 'rgba(0, 0, 0, 0)')
ctx.fillStyle = g
ctx.fillRect(x - r, y - r, r * 2, r * 2)
}
/** Bande de pellicule inclinée (perforations en haut et en bas, séparations d'images). */
function filmBand(ctx: CanvasRenderingContext2D, cy: number, color: string) {
ctx.save()
ctx.translate(W / 2, cy)
ctx.rotate((-9 * Math.PI) / 180)
ctx.fillStyle = color
const len = 1700
const h = 96
ctx.fillRect(-len / 2, -h / 2, len, 2)
ctx.fillRect(-len / 2, h / 2 - 2, len, 2)
for (let x = -len / 2; x < len / 2; x += 34) {
ctx.fillRect(x, -h / 2 + 10, 15, 11)
ctx.fillRect(x, h / 2 - 21, 15, 11)
}
for (let x = -len / 2 + 120; x < len / 2; x += 124) ctx.fillRect(x, -h / 2 + 28, 2, h - 56)
ctx.restore()
}
/** Affiche légèrement tournée autour de son centre, avec une ombre portée. */
function tiltedPoster(ctx: CanvasRenderingContext2D, img: HTMLImageElement | null, title: string, x: number, y: number, w: number, h: number, deg: number) {
ctx.save()
ctx.translate(x + w / 2, y + h / 2)
ctx.rotate((deg * Math.PI) / 180)
ctx.shadowColor = 'rgba(0, 0, 0, 0.45)'
ctx.shadowBlur = 40
ctx.shadowOffsetY = 18
ctx.fillStyle = RECAP_CARD.bg
roundRect(ctx, -w / 2, -h / 2, w, h, 14)
ctx.fill()
ctx.shadowColor = 'transparent'
drawPoster(ctx, img, title, -w / 2, -h / 2, w, h, 14)
ctx.restore()
}
export async function renderRecapCard(recap: YearRecap): Promise<Blob> {
const { canvas, ctx } = await newCanvas()
const c = colors()
const c = RECAP_CARD
const imgs = await Promise.all(recap.best.map((i) => loadImage(i.poster)))
const x0 = 90
const width = W - x0 * 2
// « MON ANNÉE » puis l'année en grand
// Décor : fond, deux halos, la pellicule, l'année en contour le long du bord droit
ctx.fillStyle = c.bg
ctx.fillRect(0, 0, W, H)
glow(ctx, W - 80, 120, 760, c.blobA)
glow(ctx, 60, H - 40, 820, c.blobB)
filmBand(ctx, H * 0.6, c.faint)
ctx.save()
ctx.translate(W - 34, H - 150)
ctx.rotate(-Math.PI / 2)
ctx.font = `900 300px ${FONT}`
ctx.lineWidth = 3
ctx.strokeStyle = c.faint
ctx.textAlign = 'left'
ctx.textBaseline = 'alphabetic'
ctx.font = `600 30px ${FONT}`
setTracking(ctx, 3)
ctx.fillStyle = c.ink3
ctx.fillText(t('recap.cardTitle').toUpperCase(), x0, 150)
setTracking(ctx, -6)
ctx.font = `800 210px ${FONT}`
ctx.fillStyle = c.accent
ctx.fillText(recap.year, x0 - 8, 335)
ctx.strokeText(recap.year, 0, 0)
ctx.restore()
// « Mon année » puis l'année en grand
ctx.textAlign = 'left'
ctx.textBaseline = 'alphabetic'
ctx.font = `600 40px ${FONT}`
ctx.fillStyle = c.soft
ctx.fillText(t('recap.cardTitle'), x0, 150)
setTracking(ctx, -8)
ctx.font = `800 230px ${FONT}`
ctx.fillStyle = c.pop
ctx.fillText(recap.year, x0 - 10, 355)
setTracking(ctx, 0)
// Quatre chiffres clés, en grille 2 × 2
const topGenre = recap.genres[0] ? genreLabel(recap.genres[0].label) : '—'
const cells: [string, string][] = [
[fmtNumber(recap.finished), t('stats.finished')],
[t('common.hours', { h: fmtNumber(Math.round(recap.minutes / 60)) }), t('stats.timeSpent')],
[fmtNumber(recap.episodes), t('stats.episodesSeen')],
[recap.avgRating ? `${formatRating(Math.round(recap.avgRating * 10) / 10)} ★` : '—', t('stats.avgRating')],
[topGenre, t('recap.topGenre')],
]
cells.forEach(([value, label], k) => {
const x = x0 + (k % 2) * (width / 2)
const y = 470 + Math.floor(k / 2) * 150
const y = 485 + Math.floor(k / 2) * 150
ctx.fillStyle = c.ink
ctx.font = `800 ${fitSize(ctx, value, 800, 76, 40, width / 2 - 30) ?? 40}px ${FONT}`
ctx.font = `800 ${fitSize(ctx, value, 800, 76, 36, width / 2 - 30) ?? 36}px ${FONT}`
ctx.fillText(value, x, y)
ctx.font = `600 24px ${FONT}`
setTracking(ctx, 1.5)
ctx.fillStyle = c.ink3
ctx.fillText(wrap(ctx, label.toUpperCase(), width / 2 - 30, 1)[0] ?? '', x, y + 44)
setTracking(ctx, 0)
ctx.font = `500 28px ${FONT}`
ctx.fillStyle = c.soft
ctx.fillText(wrap(ctx, label, width / 2 - 30, 1)[0] ?? '', x, y + 44)
})
// Les mieux notés : trois affiches côte à côte
const label = (text: string, ly: number) => {
ctx.font = `600 24px ${FONT}`
setTracking(ctx, 1.5)
ctx.fillStyle = c.ink3
ctx.fillText(text.toUpperCase(), x0, ly)
setTracking(ctx, 0)
}
let y = 730
// Les mieux notés, en podium : le 2e à gauche, le n°1 au centre (plus grand, plus haut), le 3e à droite
if (recap.best.length) {
label(t('recap.bestTitle'), y)
const gap = 30
const pw = (width - gap * 2) / 3
const ph = 320
recap.best.forEach((item, k) => {
const px = x0 + k * (pw + gap)
drawPoster(ctx, imgs[k], item.title, px, y + 26, pw, ph, 18)
ctx.fillStyle = c.ink2
ctx.font = `500 28px ${FONT}`
ctx.fillStyle = c.soft
ctx.fillText(t('recap.bestTitle'), x0, 760)
const slots = [
{ k: 1, w: 200, h: 300, dy: 50, deg: -4 },
{ k: 0, w: 244, h: 366, dy: 0, deg: 0 },
{ k: 2, w: 200, h: 300, dy: 50, deg: 4 },
].filter((sl) => recap.best[sl.k])
const gap = 34
const total = slots.reduce((n, sl) => n + sl.w, 0) + gap * (slots.length - 1)
let x = (W - total) / 2
const top = 790
for (const sl of slots) {
const item = recap.best[sl.k]
tiltedPoster(ctx, imgs[sl.k], item.title, x, top + sl.dy, sl.w, sl.h, sl.deg)
ctx.textAlign = 'center'
ctx.fillStyle = c.ink
ctx.font = `600 24px ${FONT}`
ctx.fillText(wrap(ctx, item.title, pw, 1)[0] ?? '', px, y + 26 + ph + 36)
})
y += 26 + ph + 36 + 60
ctx.fillText(wrap(ctx, item.title, sl.w, 1)[0] ?? '', x + sl.w / 2, top + 366 + 48)
ctx.fillStyle = c.pop
ctx.font = `700 24px ${FONT}`
ctx.fillText(`${formatRating(item.rating)} ★`, x + sl.w / 2, top + 366 + 82)
ctx.textAlign = 'left'
x += sl.w + gap
}
}
// Genres préférés, sur une ligne
if (recap.genres.length) {
label(t('stats.favGenres'), y)
ctx.font = `700 34px ${FONT}`
ctx.fillStyle = c.ink
ctx.fillText(wrap(ctx, recap.genres.map((g) => genreLabel(g.label)).join(' · '), width, 1)[0] ?? '', x0, y + 46)
}
drawBrand(ctx, H - 60)
drawBrand(ctx, H - 52, c.ink, c.pop)
return toBlob(canvas)
}
+13 -3
View File
@@ -1,9 +1,10 @@
import { Settings2 } from 'lucide-react'
import { Settings2, Sparkles } from 'lucide-react'
import { useMemo, useState } from 'react'
import { fmtNumber, t } from '../i18n'
import { BarList, Columns, Panel, StatTile } from '../components/stats/Charts'
import StatsSettings from '../components/stats/StatsSettings'
import { RecapButton } from '../components/RecapEntry'
import { recapSeasonYear, recapUnlocked } from '../lib/recap'
import { EmptyState, PageHeader } from '../components/ui'
import { STATUSES, TYPE_BY_VALUE } from '../lib/constants'
import { genreLabel } from '../lib/genres'
@@ -35,6 +36,8 @@ export default function StatsPage() {
const period = year && years.includes(year) ? year : ''
const thisYear = String(new Date().getFullYear())
const list = useMemo(() => itemsForPeriod(scoped, period), [scoped, period])
// Bilan : celui de l'année choisie s'il est arrivé (1er décembre), sinon celui de la saison (décembre, janvier)
const recapYear = period ? (recapUnlocked(period) ? period : undefined) : recapSeasonYear()
// 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(
@@ -67,8 +70,15 @@ export default function StatsPage() {
</label>
</div>
{/* Bilan de l'année choisie, sinon de l'année en cours (ou de la dernière année avec des titres) */}
<RecapButton items={items} year={period || (years.includes(thisYear) ? thisYear : (years[0] ?? thisYear))} />
{recapYear ? (
<RecapButton items={items} year={recapYear} />
) : (
period === thisYear && (
<p className="mt-4 flex items-center gap-2 text-sm text-ink-3">
<Sparkles size={16} className="shrink-0 text-accent" aria-hidden /> {t('recap.soon', { year: thisYear })}
</p>
)
)}
{list.length === 0 ? (
<EmptyState title={t('stats.emptyTitle')} text={t('stats.emptyText')} />