Stats : paramètres de la courbe, masquer des mois
deploy / deploy (push) Successful in 38s

Bouton ⚙ sur « Mois par mois » : aperçu de la courbe et une case par mois
pour l'afficher ou non (ex. le mois d'un ajout en lot). Les mois masqués
n'apparaissent plus dans la courbe ni dans « mois le plus chargé » mais les
titres restent comptés partout ailleurs. Réglage synchronisé
(statsHiddenMonths), inclus dans la sauvegarde, 18 langues.

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-10-11 13:11:27 +00:00
1 parent 4c93b6a726
commit 0f3cc2e7d6
25 files changed
+239 -14

No files matched your search

+5 -5
View File
@@ -50,12 +50,12 @@ export function Columns({
height = 140,
label,
}: {
bars: { key: string; axis: string; value: number; tip: string; highlight?: boolean }[]
bars: { key: string; axis: string; value: number; tip: string; highlight?: boolean; /** Masquée par l'utilisateur : pas de barre, libellé barré */ hidden?: boolean }[]
height?: number
/** Nom du graphique (lecteurs d'écran) */
label: string
}) {
const max = Math.max(1, ...bars.map((b) => b.value))
const max = Math.max(1, ...bars.filter((b) => !b.hidden).map((b) => b.value))
return (
<figure aria-label={label}>
<div className="relative flex items-end gap-[2px] border-b border-line" style={{ height }}>
@@ -64,8 +64,8 @@ export function Columns({
{bars.map((b) => (
<div key={b.key} tabIndex={0} aria-label={b.tip} className="group relative flex h-full flex-1 items-end justify-center outline-none">
<div
className={cx('w-full max-w-9 rounded-t-[4px] transition-opacity', b.value > 0 ? 'bg-accent-fill' : 'bg-transparent', !b.highlight && 'opacity-80 group-hover:opacity-100 group-focus-visible:opacity-100')}
style={{ height: b.value > 0 ? `${Math.max(3, (b.value / max) * 100)}%` : 0 }}
className={cx('w-full max-w-9 rounded-t-[4px] transition-opacity', b.value > 0 && !b.hidden ? 'bg-accent-fill' : 'bg-transparent', !b.highlight && 'opacity-80 group-hover:opacity-100 group-focus-visible:opacity-100')}
style={{ height: b.value > 0 && !b.hidden ? `${Math.max(3, (b.value / max) * 100)}%` : 0 }}
/>
<span className="pointer-events-none absolute bottom-full z-10 mb-1.5 hidden whitespace-nowrap rounded-lg border border-line bg-surface px-2 py-1 text-xs text-ink shadow-sm group-hover:block group-focus-visible:block">
{b.tip}
@@ -75,7 +75,7 @@ export function Columns({
</div>
<div className="mt-1.5 flex gap-[2px]" aria-hidden="true">
{bars.map((b) => (
<span key={b.key} className={cx('flex-1 truncate text-center text-[10px] text-ink-3', b.highlight && 'font-semibold text-ink')}>
<span key={b.key} className={cx('flex-1 truncate text-center text-[10px] text-ink-3', b.highlight && 'font-semibold text-ink', b.hidden && 'line-through opacity-50')}>
{b.axis}
</span>
))}
+115
View File
@@ -0,0 +1,115 @@
import { Check, X } from 'lucide-react'
import { useMemo, useState } from 'react'
import { locale, t } from '../../i18n'
import { useBackToClose } from '../../lib/backNav'
import { useEscape } from '../../lib/escape'
import { useScrollLock } from '../../lib/scrollLock'
import { availableYears, monthly } from '../../lib/stats'
import { cx, formatDuration } from '../../lib/utils'
import { useMedia } from '../../store'
import { Columns } from './Charts'
/**
* Paramètres des stats : la courbe mois par mois, et en dessous une case par mois pour l'afficher ou non
* (ex. le mois où toute la bibliothèque a été ajoutée d'un coup). Les mois masqués suivent le compte (réglages synchronisés).
*/
export default function StatsSettings({ onClose, initialYear }: { onClose: () => void; initialYear: string }) {
const { items, settings, updateSettings } = useMedia()
useScrollLock()
useEscape(onClose)
useBackToClose(onClose)
const years = useMemo(() => availableYears(items), [items])
const [year, setYear] = useState(initialYear && years.includes(initialYear) ? initialYear : '')
const months = useMemo(() => monthly(items, year), [items, year])
const hidden = new Set(settings.statsHiddenMonths ?? [])
const setShown = (key: string, shown: boolean) => {
const next = new Set(hidden)
if (shown) next.delete(key)
else next.add(key)
updateSettings({ statsHiddenMonths: next.size ? [...next].sort() : undefined })
}
const label = (key: string) => new Date(`${key}-15T12:00:00`).toLocaleDateString(locale(), { month: 'long', year: 'numeric' })
return (
<div className="sheet sheet-in" role="dialog" aria-modal="true" aria-label={t('stats.settings')}>
<header className="safe-top border-b border-line">
<div className="mx-auto flex max-w-2xl items-center gap-2 px-3 py-2.5 lg:max-w-3xl">
<button onClick={onClose} className="grid size-10 shrink-0 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}>
<X size={22} />
</button>
<h2 className="min-w-0 flex-1 truncate text-center text-base font-semibold">{t('stats.settings')}</h2>
<span className="size-10 shrink-0" />
</div>
</header>
<div className="sheet-scroll">
<div className="mx-auto max-w-2xl px-4 pb-[calc(10rem+env(safe-area-inset-bottom))] pt-5 lg:max-w-3xl">
<div className="flex items-center justify-between gap-3">
<h3 className="eyebrow text-ink-2">{year ? t('stats.monthByMonth', { year }) : t('stats.last12')}</h3>
<select value={year} onChange={(e) => setYear(e.target.value)} className="field w-auto py-2 pe-8 text-sm" aria-label={t('stats.period')}>
<option value="">{t('stats.last12')}</option>
{years.map((y) => (
<option key={y} value={y}>
{y}
</option>
))}
</select>
</div>
{/* Aperçu en direct */}
<div className="card mt-4 p-4">
<Columns
label={year ? t('stats.monthByMonth', { year }) : t('stats.last12')}
height={150}
bars={months.map((m) => ({
key: m.key,
axis: m.initial,
value: m.count,
hidden: hidden.has(m.key),
tip: hidden.has(m.key) ? `${m.label} : ${t('stats.monthHidden')}` : `${m.label} : ${t('stats.monthFinished', { count: m.count })}`,
}))}
/>
</div>
<p className="mt-5 text-sm text-ink-2">{t('stats.hideMonthsHint')}</p>
{/* Une case par mois : cochée = affiché dans la courbe */}
<ul className="mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3">
{months.map((m) => {
const shown = !hidden.has(m.key)
return (
<li key={m.key}>
<button
onClick={() => setShown(m.key, !shown)}
role="checkbox"
aria-checked={shown}
className={cx('flex w-full items-center gap-2.5 rounded-xl border px-3 py-2.5 text-start transition-colors', shown ? 'border-line' : 'border-dashed border-line-strong text-ink-3')}
>
<span className={cx('grid size-5 shrink-0 place-items-center rounded-md border', shown ? 'border-accent bg-accent-fill text-on-accent' : 'border-line-strong')}>
{shown && <Check size={13} strokeWidth={2.8} />}
</span>
<span className="min-w-0">
<span className="block truncate text-sm font-medium first-letter:uppercase">{label(m.key)}</span>
<span className="block truncate text-xs text-ink-3">
{t('stats.monthFinished', { count: m.count })}
{m.minutes ? ` · ${formatDuration(m.minutes)}` : ''}
</span>
</span>
</button>
</li>
)
})}
</ul>
{hidden.size > 0 && (
<button onClick={() => updateSettings({ statsHiddenMonths: undefined })} className="mt-5 text-sm font-medium text-ink-2">
{t('stats.showAllMonths')}
</button>
)}
</div>
</div>
</div>
)
}
+4
View File
@@ -1548,6 +1548,10 @@ const dict: Translations = {
'stats.avgLength': "متوسط المدة",
'stats.episodesSeen': "الحلقات المشاهدة",
'stats.decades': "عقود الإصدار",
'stats.settings': "إعدادات الإحصاءات",
'stats.monthHidden': "مخفي",
'stats.hideMonthsHint': "ألغِ تحديد شهر لإزالته من الرسم (مثل الشهر الذي أضفت فيه كل شيء دفعة واحدة). تبقى أعماله محسوبة في كل مكان آخر.",
'stats.showAllMonths': "إظهار الكل من جديد",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Durchschnittliche Länge",
'stats.episodesSeen': "Gesehene Folgen",
'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.showAllMonths': "Alle wieder anzeigen",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Average length",
'stats.episodesSeen': "Episodes watched",
'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.showAllMonths': "Show all again",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Duración media",
'stats.episodesSeen': "Episodios vistos",
'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.showAllMonths': "Mostrar todo de nuevo",
}
export default dict
+4
View File
@@ -1327,6 +1327,10 @@ const dict = {
'stats.avgLength': "Durée moyenne",
'stats.episodesSeen': "Épisodes vus",
'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.showAllMonths': "Tout réafficher",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "औसत अवधि",
'stats.episodesSeen': "देखे गए एपिसोड",
'stats.decades': "रिलीज़ के दशक",
'stats.settings': "आँकड़ों की सेटिंग",
'stats.monthHidden': "छिपा",
'stats.hideMonthsHint': "किसी महीने को ग्राफ़ से हटाने के लिए उसका चिह्न हटाएँ (जैसे वह महीना जब आपने सब कुछ एक साथ जोड़ा)। उसके टाइटल बाकी जगह गिने जाते रहेंगे।",
'stats.showAllMonths': "सब फिर से दिखाएँ",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Durasi rata-rata",
'stats.episodesSeen': "Episode ditonton",
'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.showAllMonths': "Tampilkan semua lagi",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Durata media",
'stats.episodesSeen': "Episodi visti",
'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.showAllMonths': "Mostra di nuovo tutto",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "平均の長さ",
'stats.episodesSeen': "観たエピソード",
'stats.decades': "公開年代",
'stats.settings': "統計の設定",
'stats.monthHidden': "非表示",
'stats.hideMonthsHint': "グラフから外したい月のチェックを外してください(例:まとめて追加した月)。その作品はほかの統計では引き続き数えられます。",
'stats.showAllMonths': "すべて再表示",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "평균 길이",
'stats.episodesSeen': "본 에피소드",
'stats.decades': "개봉 연대",
'stats.settings': "통계 설정",
'stats.monthHidden': "숨김",
'stats.hideMonthsHint': "그래프에서 빼고 싶은 달의 체크를 해제하세요(예: 한꺼번에 추가한 달). 해당 작품은 다른 통계에서는 계속 집계돼요.",
'stats.showAllMonths': "모두 다시 표시",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Gemiddelde duur",
'stats.episodesSeen': "Geziene afleveringen",
'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.showAllMonths': "Alles weer tonen",
}
export default dict
+4
View File
@@ -1465,6 +1465,10 @@ const dict: Translations = {
'stats.avgLength': "Średnia długość",
'stats.episodesSeen': "Obejrzane odcinki",
'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.showAllMonths': "Pokaż wszystko",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Duração média",
'stats.episodesSeen': "Episódios vistos",
'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.showAllMonths': "Mostrar tudo outra vez",
}
export default dict
+4
View File
@@ -1465,6 +1465,10 @@ const dict: Translations = {
'stats.avgLength': "Средняя длительность",
'stats.episodesSeen': "Просмотрено серий",
'stats.decades': "Десятилетия выхода",
'stats.settings': "Настройки статистики",
'stats.monthHidden': "скрыт",
'stats.hideMonthsHint': "Сними отметку с месяца, чтобы убрать его с графика (например, месяц, когда ты добавил всё сразу). Тайтлы по-прежнему учитываются во всём остальном.",
'stats.showAllMonths': "Показать всё снова",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "ความยาวเฉลี่ย",
'stats.episodesSeen': "ตอนที่ดู",
'stats.decades': "ทศวรรษที่ออกฉาย",
'stats.settings': "ตั้งค่าสถิติ",
'stats.monthHidden': "ซ่อน",
'stats.hideMonthsHint': "ยกเลิกเครื่องหมายเดือนเพื่อเอาออกจากกราฟ (เช่น เดือนที่คุณเพิ่มทุกอย่างพร้อมกัน) เรื่องในเดือนนั้นยังนับในส่วนอื่นตามปกติ",
'stats.showAllMonths': "แสดงทั้งหมดอีกครั้ง",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Ortalama süre",
'stats.episodesSeen': "İzlenen bölümler",
'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.showAllMonths': "Hepsini yeniden göster",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "Thời lượng trung bình",
'stats.episodesSeen': "Tập đã xem",
'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.showAllMonths': "Hiện lại tất cả",
}
export default dict
+4
View File
@@ -1325,6 +1325,10 @@ const dict: Translations = {
'stats.avgLength': "平均时长",
'stats.episodesSeen': "看过的集数",
'stats.decades': "上映年代",
'stats.settings': "统计设置",
'stats.monthHidden': "已隐藏",
'stats.hideMonthsHint': "取消勾选某个月即可将其从图表中移除(例如一次性添加所有内容的那个月)。这些作品在其他统计中仍会计入。",
'stats.showAllMonths': "全部重新显示",
}
export default dict
+3
View File
@@ -157,6 +157,9 @@ export function normalizeSettings(raw: unknown): Partial<Settings> | undefined {
}
const challenges = normalizeChallenges(raw.challenges)
if (challenges) out.challenges = challenges
if (Array.isArray(raw.statsHiddenMonths)) {
out.statsHiddenMonths = [...new Set(raw.statsHiddenMonths.filter((m): m is string => typeof m === 'string' && /^\d{4}-(0[1-9]|1[0-2])$/.test(m)))].sort().slice(-600)
}
return out
}
+1 -1
View File
@@ -15,7 +15,7 @@ import { cloudFetch } from './api'
* En cas de conflit, la modification la plus récente gagne (vérifié aussi par la base).
*/
export type SyncedSettings = Pick<Settings, 'ratingScale' | 'topCategories' | 'accentColor' | 'themeMode' | 'notifPrefs' | 'challenges'>
export type SyncedSettings = Pick<Settings, 'ratingScale' | 'topCategories' | 'accentColor' | 'themeMode' | 'notifPrefs' | 'challenges' | 'statsHiddenMonths'>
export interface SyncHooks {
getLists: () => CustomList[]
+38 -5
View File
@@ -1,7 +1,9 @@
import { Settings2 } from 'lucide-react'
import { useMemo, useState } from 'react'
import { t } from '../i18n'
import { BarList, Columns, Panel, StatTile } from '../components/stats/Charts'
import Poster from '../components/Poster'
import StatsSettings from '../components/stats/StatsSettings'
import { EmptyState, PageHeader } from '../components/ui'
import { STATUSES, TYPE_BY_VALUE } from '../lib/constants'
import { genreLabel } from '../lib/genres'
@@ -26,6 +28,7 @@ export default function StatsPage({ onOpen }: { onOpen: (item: MediaItem) => voi
const { items, settings } = useMedia()
const [scope, setScope] = useState<Scope>('all')
const [year, setYear] = useState('')
const [settingsOpen, setSettingsOpen] = useState(false)
const scoped = useMemo(() => (scope === 'all' ? items : items.filter((i) => SCOPE_TYPES[scope].includes(i.type))), [items, scope])
const years = useMemo(() => availableYears(scoped), [scoped])
@@ -66,13 +69,32 @@ export default function StatsPage({ onOpen }: { onOpen: (item: MediaItem) => voi
{list.length === 0 ? (
<EmptyState title={t('stats.emptyTitle')} text={t('stats.emptyText')} />
) : (
<StatsBody key={scope + period} scope={scope} items={list} year={period} scale={settings.ratingScale} onOpen={onOpen} />
<StatsBody key={scope + period} scope={scope} items={list} year={period} scale={settings.ratingScale} hiddenMonths={settings.statsHiddenMonths} onOpen={onOpen} onSettings={() => setSettingsOpen(true)} />
)}
{settingsOpen && <StatsSettings initialYear={period} onClose={() => setSettingsOpen(false)} />}
</>
)
}
function StatsBody({ scope, items, year, scale, onOpen }: { scope: Scope; items: MediaItem[]; year: string; scale: '5' | '10'; onOpen: (item: MediaItem) => void }) {
function StatsBody({
scope,
items,
year,
scale,
hiddenMonths,
onOpen,
onSettings,
}: {
scope: Scope
items: MediaItem[]
year: string
scale: '5' | '10'
/** Mois masqués dans la courbe (paramètres des stats) */
hiddenMonths?: string[]
onOpen: (item: MediaItem) => void
onSettings: () => void
}) {
const hidden = useMemo(() => new Set(hiddenMonths ?? []), [hiddenMonths])
const s = useMemo(() => computeStats(items), [items])
const months = useMemo(() => monthly(items, year), [items, year])
const rec = useMemo(() => records(items), [items])
@@ -94,7 +116,7 @@ function StatsBody({ scope, items, year, scale, onOpen }: { scope: Scope; 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 ranked = months.filter((m) => !hidden.has(m.key)).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)
@@ -125,7 +147,15 @@ function StatsBody({ scope, items, year, scale, onOpen }: { scope: Scope; items:
<div className="grid gap-4 lg:grid-cols-2">
{/* Activité mois par mois */}
<Panel title={year ? t('stats.monthByMonth', { year }) : t('stats.last12')} className="lg:col-span-2">
<Panel
title={year ? t('stats.monthByMonth', { year }) : t('stats.last12')}
className="lg:col-span-2"
action={
<button onClick={onSettings} className="-me-2 grid size-9 place-items-center rounded-full text-ink-3 transition-colors hover:text-ink" aria-label={t('stats.settings')}>
<Settings2 size={18} />
</button>
}
>
<Columns
label={year ? t('stats.monthByMonth', { year }) : t('stats.last12')}
height={150}
@@ -134,7 +164,10 @@ function StatsBody({ scope, items, year, scale, onOpen }: { scope: Scope; items:
axis: m.initial,
value: m.count,
highlight: m === busiest,
tip: `${m.label} : ${t('stats.monthFinished', { count: m.count })}${m.minutes ? ` · ${formatDuration(m.minutes)}` : ''}`,
hidden: hidden.has(m.key),
tip: hidden.has(m.key)
? `${m.label} : ${t('stats.monthHidden')}`
: `${m.label} : ${t('stats.monthFinished', { count: m.count })}${m.minutes ? ` · ${formatDuration(m.minutes)}` : ''}`,
}))}
/>
{busiest && busiest.count > 0 && (
+3 -3
View File
@@ -181,8 +181,8 @@ export function MediaProvider({ children, cloudUser }: { children: ReactNode; cl
getLists: () => listsRef.current,
applyLists: (next) => setLists(() => next, true),
getSettings: () => {
const { ratingScale, topCategories, accentColor, themeMode, notifPrefs, challenges } = settingsRef.current
return { ratingScale, topCategories, accentColor, themeMode, notifPrefs, challenges }
const { ratingScale, topCategories, accentColor, themeMode, notifPrefs, challenges, statsHiddenMonths } = settingsRef.current
return { ratingScale, topCategories, accentColor, themeMode, notifPrefs, challenges, statsHiddenMonths }
},
applySettings: (patch) => updateSettingsRef.current(patch, true),
itemsChanged: () => void reloadItems(),
@@ -223,7 +223,7 @@ export function MediaProvider({ children, cloudUser }: { children: ReactNode; cl
}, [settings.themeMode])
const updateSettings = useCallback((patch: Partial<Settings>, silent = false) => {
if (!silent && syncRef.current && ('ratingScale' in patch || 'topCategories' in patch || 'accentColor' in patch || 'themeMode' in patch || 'notifPrefs' in patch || 'challenges' in patch)) syncRef.current.markSettings()
if (!silent && syncRef.current && ('ratingScale' in patch || 'topCategories' in patch || 'accentColor' in patch || 'themeMode' in patch || 'notifPrefs' in patch || 'challenges' in patch || 'statsHiddenMonths' in patch)) syncRef.current.markSettings()
setSettings((prev) => {
const next = { ...prev, ...patch }
try {
+2
View File
@@ -96,6 +96,8 @@ export interface Settings {
notifPrefs?: NotifPrefs
/** Défis de visionnage (synchronisés avec les réglages, privés). */
challenges?: Challenge[]
/** Mois masqués dans la courbe des stats (AAAA-MM), ex. le mois où j'ai tout ajouté d'un coup. */
statsHiddenMonths?: string[]
}
/** Défi : « voir N films en 2026 », « 20 épisodes cette semaine »… */