Notes par saison : note + avis par saison, note finale = moyenne arrondie
deploy / deploy (push) Successful in 43s

- Section « Mes saisons » dans la fiche d'une série (≥ 2 saisons) : une note et un avis (avec spoiler) par saison.
- Quand la série est terminée, la note finale = moyenne des saisons notées, arrondie (étoiles et /10).
- Les séries déjà notées sans notes de saison restent intactes.
- Un +1 qui termine une saison ouvre la fiche sur cette saison à noter ; « Reprendre » passe à S02 É01.

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-14 10:26:48 +00:00
1 parent aa5442e02a
commit ed905a3278
26 files changed
+540 -11

No files matched your search

+5 -2
View File
@@ -20,6 +20,7 @@ import SyncIndicator from './components/SyncIndicator'
import { useMedia } from './store'
import type { SearchResult } from './lib/catalogApi'
import type { MediaItem } from './types'
import type { Completion } from './lib/seasons'
const TABS: Tab[] = ['home', 'catalog', 'stats', 'settings']
// L'administration a sa propre route (#/admin), hors de la navigation principale
@@ -40,7 +41,7 @@ function routeFromHash(): Route {
* ou page d'une personne. Titre → acteur → autre titre → … : « retour » remonte d'un cran.
*/
type Layer =
| { kind: 'title'; item: MediaItem; seed?: undefined }
| { kind: 'title'; item: MediaItem; seed?: undefined; focus?: Completion }
| { kind: 'title'; seed: SearchResult; item?: undefined }
| { kind: 'person'; personId: string; name?: string; photo?: string }
let layerUid = 0
@@ -69,7 +70,8 @@ export default function App() {
// Dans la barre de navigation, l'administration reste rattachée à « Réglages »
const navTab: Tab = route === 'admin' ? 'settings' : route === 'notfound' ? 'home' : route
const openItem = (item: MediaItem) => pushLayer({ kind: 'title', item })
/** `focus` : saison (ou série) qu'on vient de finir avec +1 → la fiche s'ouvre sur la note */
const openItem = (item: MediaItem, focus?: Completion) => pushLayer({ kind: 'title', item, focus })
const openSeed = (seed: SearchResult) => pushLayer({ kind: 'title', seed })
const openPerson = (p: { id: string; name?: string; photo?: string }) => pushLayer({ kind: 'person', personId: p.id, name: p.name, photo: p.photo })
const openNew = () => setAdding(true)
@@ -122,6 +124,7 @@ export default function App() {
onClose={() => closeLayer(l.uid)}
onGoToSettings={toSettings}
onOpenPerson={openPerson}
focus={l.item ? l.focus : undefined}
/>
) : (
<PersonSheet
+6 -4
View File
@@ -1,3 +1,4 @@
import type { Completion } from '../lib/seasons'
import { Check, Info, Plus } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import { t } from '../i18n'
@@ -27,7 +28,7 @@ export function waitingLabel(item: MediaItem): string {
}
/** Grande bannière de l'accueil : défile entre les titres que je regarde en ce moment (ou le prochain à voir). */
export default function HomeHero({ items, onOpen }: { items: MediaItem[]; onOpen: (item: MediaItem) => void }) {
export default function HomeHero({ items, onOpen }: { items: MediaItem[]; onOpen: (item: MediaItem, focus?: Completion) => void }) {
const { incrementEpisode } = useMedia()
// On retient le titre affiché (et pas sa position) : la liste se réordonne quand on avance un épisode
const [currentId, setCurrentId] = useState<string>()
@@ -106,7 +107,8 @@ export default function HomeHero({ items, onOpen }: { items: MediaItem[]; onOpen
<button
onClick={() => {
setPausedAt(Date.now())
void incrementEpisode(item.id)
// Saison (ou série) terminée : on ouvre la fiche sur la note
void incrementEpisode(item.id).then((done) => done && onOpen(item, done))
}}
className="btn btn-primary px-5"
>
@@ -140,7 +142,7 @@ export default function HomeHero({ items, onOpen }: { items: MediaItem[]; onOpen
}
/** Carte horizontale « Reprendre » : image, barre de progression, prochain épisode. */
export function ContinueCard({ item, onOpen }: { item: MediaItem; onOpen: (item: MediaItem) => void }) {
export function ContinueCard({ item, onOpen }: { item: MediaItem; onOpen: (item: MediaItem, focus?: Completion) => void }) {
const { incrementEpisode } = useMedia()
const image = item.backdrop ?? item.poster
const next = nextEpisodeLabel(item)
@@ -153,7 +155,7 @@ export function ContinueCard({ item, onOpen }: { item: MediaItem; onOpen: (item:
</button>
{next && (
<button
onClick={() => incrementEpisode(item.id)}
onClick={() => void incrementEpisode(item.id).then((done) => done && onOpen(item, done))}
className="absolute bottom-3 end-2 flex h-8 items-center gap-0.5 rounded-full bg-accent-fill px-3 text-xs font-semibold text-on-accent transition active:scale-90"
aria-label={t('card.plusOne', { title: item.title })}
>
+182
View File
@@ -0,0 +1,182 @@
import { Check, Pencil } from 'lucide-react'
import { useEffect, useRef, useState } from 'react'
import { t } from '../../i18n'
import { episodesBeforeSeason } from '../../lib/franchise'
import { seasonsAverage } from '../../lib/seasons'
import { cx, formatRating } from '../../lib/utils'
import type { MediaItem, RatingScale, SeasonRating } from '../../types'
import { RatingInput } from '../Rating'
/**
* « Mes saisons » : une note et un avis par saison.
* Une saison se note dès qu'on l'a commencée ; quand toute la série est vue, la note finale
* devient la moyenne des saisons notées (calculée dans le store).
*/
export default function SeasonRatings({
item,
scale,
highlight,
onChange,
}: {
item: MediaItem
scale: RatingScale
/** Saison à mettre en avant (on vient de la finir) */
highlight?: number
onChange: (seasonRatings: MediaItem['seasonRatings']) => void
}) {
const seasons = item.seasons ?? []
const ratings: Record<string, SeasonRating> = item.seasonRatings ?? {}
const avg = seasonsAverage(ratings, scale)
const set = (n: number, patch: Partial<SeasonRating>) => {
const key = String(n)
const next: Record<string, SeasonRating> = { ...ratings, [key]: { ...ratings[key], ...patch } }
const cur = next[key]
if (cur.rating == null && !cur.notes) delete next[key]
onChange(Object.keys(next).length ? next : undefined)
}
return (
<section className="mx-4 mt-6" aria-label={t('seasons.title')}>
<div className="mb-2 flex items-baseline justify-between gap-3">
<h3 className="eyebrow text-ink-2">{t('seasons.title')}</h3>
{avg != null && (
<span className="text-xs text-ink-3">
{t('seasons.average')} <span className="font-semibold text-ink">{formatRating(avg, scale)}</span>
</span>
)}
</div>
<p className="mb-3 text-xs leading-relaxed text-ink-3">{t('seasons.hint')}</p>
<ul className="space-y-2">
{seasons.map((size, k) => {
const n = k + 1
const before = episodesBeforeSeason(seasons, n)
const seen = Math.max(0, Math.min(size, item.episodesWatched - before))
return (
<SeasonRow
key={n}
n={n}
size={size}
seen={seen}
value={ratings[String(n)]}
scale={scale}
highlight={highlight === n}
onChange={(patch) => set(n, patch)}
/>
)
})}
</ul>
</section>
)
}
function SeasonRow({
n,
size,
seen,
value,
scale,
highlight,
onChange,
}: {
n: number
size: number
seen: number
value?: SeasonRating
scale: RatingScale
highlight: boolean
onChange: (patch: Partial<SeasonRating>) => void
}) {
const started = seen > 0
const done = seen >= size
const [writing, setWriting] = useState(false)
const [draft, setDraft] = useState(value?.notes ?? '')
const [spoiler, setSpoiler] = useState(!!value?.spoiler)
const ref = useRef<HTMLLIElement>(null)
// Saison qu'on vient de finir : on l'amène à l'écran
useEffect(() => {
if (highlight) ref.current?.scrollIntoView({ behavior: 'smooth', block: 'center' })
}, [highlight])
return (
<li ref={ref} id={`season-${n}`} className={cx('card p-3.5 transition-shadow', highlight && 'ring-2 ring-accent')}>
<div className="flex items-center justify-between gap-3">
<div className="min-w-0">
<p className="font-semibold">{t('seasons.season', { n })}</p>
<p className={cx('text-xs', done ? 'text-ink-2' : 'text-ink-3')}>
{done ? (
<span className="inline-flex items-center gap-1">
<Check size={12} className="text-accent" /> {t('seasons.seen')}
</span>
) : started ? (
t('seasons.progress', { seen, size })
) : (
t('seasons.notStarted')
)}
</p>
</div>
{highlight && !value?.rating && <span className="eyebrow shrink-0 text-accent">{t('seasons.rateNow')}</span>}
</div>
{started && (
<div className="mt-2.5">
<RatingInput value={value?.rating} onChange={(rating) => onChange({ rating })} scale={scale} size="sm" label={t('seasons.season', { n })} />
</div>
)}
{started &&
(writing ? (
<div className="mt-3">
<textarea
value={draft}
onChange={(e) => setDraft(e.target.value)}
maxLength={5000}
rows={4}
autoFocus
placeholder={t('seasons.reviewPh', { n })}
className="field resize-y text-sm"
/>
<label className="mt-2 flex items-center gap-2 text-xs text-ink-2">
<input type="checkbox" checked={spoiler} onChange={(e) => setSpoiler(e.target.checked)} className="accent-[var(--color-accent)]" />
{t('spoiler.checkbox')}
</label>
<div className="mt-2.5 flex justify-end gap-2">
<button
onClick={() => {
setDraft(value?.notes ?? '')
setWriting(false)
}}
className="btn btn-ghost px-4 py-2 text-sm"
>
{t('common.cancel')}
</button>
<button
onClick={() => {
const notes = draft.trim() || undefined
onChange({ notes, spoiler: notes && spoiler ? true : undefined })
setWriting(false)
}}
className="btn btn-primary px-4 py-2 text-sm"
>
{t('common.save')}
</button>
</div>
</div>
) : value?.notes ? (
<button onClick={() => setWriting(true)} className="mt-3 block w-full text-start">
<span className="flex items-center gap-1.5 text-xs text-ink-3">
{t('form.review')}
{value.spoiler && <span className="rounded-full border border-accent/50 px-1.5 py-px text-[10px] text-accent">{t('spoiler.badge')}</span>}
<Pencil size={11} />
</span>
<p className="mt-1 line-clamp-4 whitespace-pre-line text-sm leading-relaxed">{value.notes}</p>
</button>
) : (
<button onClick={() => setWriting(true)} className="mt-2.5 inline-flex items-center gap-1.5 text-xs font-medium text-ink-2">
<Pencil size={12} /> {t('seasons.writeReview')}
</button>
))}
</li>
)
}
+30 -3
View File
@@ -29,6 +29,8 @@ import SharePreview from '../SharePreview'
import EditDetails from './EditDetails'
import ReviewEditor from './ReviewEditor'
import WhereToWatch from './WhereToWatch'
import SeasonRatings from './SeasonRatings'
import { completionOf, hasSeasons, seasonsAverage, type Completion } from '../../lib/seasons'
import ReviewComments from '../social/ReviewComments'
import SharedListPicker from '../social/SharedListPicker'
@@ -44,13 +46,15 @@ interface Props {
onGoToSettings?: () => void
/** Ouvre la page d'un acteur / réalisateur (sa filmographie) */
onOpenPerson?: (p: { id: string; name?: string; photo?: string }) => void
/** Ouverte après un +1 qui termine une saison (ou la série) : on amène l'utilisateur à la note */
focus?: Completion
}
/**
* Fiche d'un titre, façon Letterboxd : tout se fait ici, et chaque geste est enregistré tout de suite.
* Vu / En cours / À voir, note, coup de cœur, avis, épisodes, casting et note moyenne du public.
*/
export default function TitleSheet({ item: initial, seed, onClose, onGoToSettings, onOpenPerson }: Props) {
export default function TitleSheet({ item: initial, seed, onClose, onGoToSettings, onOpenPerson, focus: initialFocus }: Props) {
const { items, settings, add, update, lists, patchMany } = useMedia()
const actions = useLibraryActions()
const social = useSocial()
@@ -222,9 +226,17 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
}
/** Nouveaux épisodes vus : le statut et les dates suivent (comme la liste d'épisodes). */
// Saison (ou série) qu'on vient de finir : on montre où la noter
const [focus, setFocus] = useState<Completion | undefined>(initialFocus)
const ratingRef = useRef<HTMLDivElement>(null)
useEffect(() => {
if (focus && 'final' in focus) ratingRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' })
}, [focus])
const setEpisodes = (n: number, season?: number) => {
if (!item) return
void update(item.id, episodesPatch(item, n, season))
const done = completionOf(item, item.episodesWatched, n)
void update(item.id, episodesPatch(item, n, season)).then(() => done && setFocus(done))
}
// Épisodes déjà sortis (fiche suivie) : on ne coche pas un épisode à venir
@@ -413,7 +425,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
</div>
)}
<div className="mt-5 border-t border-line pt-4">
<div ref={ratingRef} className={cx('mt-5 border-t border-line pt-4', focus && 'final' in focus && !item?.rating && 'rounded-xl ring-2 ring-accent ring-offset-4 ring-offset-surface')}>
<div className="mb-2 flex items-center justify-between">
<span className="eyebrow">{t('title.yourRating')}</span>
{episodic && (
@@ -427,6 +439,11 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
)}
</div>
<RatingInput value={item?.rating} onChange={rate} scale={settings.ratingScale} />
{item && hasSeasons(item) && (
<p className="mt-1.5 text-xs text-ink-3">
{seasonsAverage(item.seasonRatings, settings.ratingScale) != null && item.status === 'termine' ? t('seasons.finalApplied') : t('seasons.finalHint')}
</p>
)}
{item?.rating != null && <Criteria item={item} scale={settings.ratingScale} onChange={(criteria) => void update(item.id, { criteria })} />}
</div>
{busy && (
@@ -480,6 +497,16 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
</section>
)}
{/* Notes et avis par saison */}
{item && hasSeasons(item) && (
<SeasonRatings
item={item}
scale={settings.ratingScale}
highlight={focus && 'season' in focus ? focus.season : undefined}
onChange={(seasonRatings) => void update(item.id, { seasonRatings })}
/>
)}
</div>
<div className="order-2 min-w-0 lg:col-start-1 lg:row-start-1">
+13
View File
@@ -1557,6 +1557,19 @@ const dict: Translations = {
'guest.promptTitle': "أنشئ حسابك للمتابعة",
'guest.promptText': "لتقييم عمل أو إضافته إلى مكتبتك أو كتابة مراجعة، تحتاج إلى حساب. إنه مجاني ويستغرق 30 ثانية.",
'guest.banner': "أنت تستكشف بدون حساب: سجّل الدخول لتقييم أعمالك ومتابعتها.",
// — Notes par saison —
'seasons.title': "مواسمي",
'seasons.average': "المتوسط:",
'seasons.hint': "قيّم كل موسم بعد مشاهدته. عند انتهاء المسلسل يصبح تقييمك النهائي متوسط المواسم التي قيّمتها.",
'seasons.season': "الموسم {n}",
'seasons.seen': "تمت المشاهدة",
'seasons.progress': "{seen}/{size} حلقات",
'seasons.notStarted': "لم يبدأ بعد",
'seasons.rateNow': "قيّمه",
'seasons.reviewPh': "رأيك في الموسم {n}…",
'seasons.writeReview': "اكتب مراجعة لهذا الموسم",
'seasons.finalHint': "عند انتهاء المسلسل سيكون تقييمك متوسط المواسم التي قيّمتها.",
'seasons.finalApplied': "متوسط المواسم التي قيّمتها.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Erstelle ein Konto, um weiterzumachen",
'guest.promptText': "Zum Bewerten, Hinzufügen zu deiner Bibliothek oder Schreiben einer Rezension brauchst du ein Konto. Es ist kostenlos und dauert 30 Sekunden.",
'guest.banner': "Du erkundest ohne Konto: Melde dich an, um zu bewerten und deine Titel zu verfolgen.",
// — Notes par saison —
'seasons.title': "Meine Staffeln",
'seasons.average': "Durchschnitt:",
'seasons.hint': "Bewerte jede Staffel, sobald du sie gesehen hast. Ist die Serie beendet, wird deine Gesamtbewertung der Durchschnitt deiner bewerteten Staffeln.",
'seasons.season': "Staffel {n}",
'seasons.seen': "Gesehen",
'seasons.progress': "{seen}/{size} Folgen",
'seasons.notStarted': "Noch nicht begonnen",
'seasons.rateNow': "Jetzt bewerten",
'seasons.reviewPh': "Deine Meinung zu Staffel {n} …",
'seasons.writeReview': "Eine Rezension zu dieser Staffel schreiben",
'seasons.finalHint': "Am Ende der Serie ist deine Bewertung der Durchschnitt deiner bewerteten Staffeln.",
'seasons.finalApplied': "Durchschnitt deiner bewerteten Staffeln.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Create your account to continue",
'guest.promptText': "To rate, add a title to your library or write a review, you need an account. It's free and takes 30 seconds.",
'guest.banner': "You're exploring without an account: sign in to rate and track your titles.",
// — Notes par saison —
'seasons.title': "My seasons",
'seasons.average': "Average:",
'seasons.hint': "Rate each season once you've watched it. When the show is finished, your final rating becomes the average of your rated seasons.",
'seasons.season': "Season {n}",
'seasons.seen': "Watched",
'seasons.progress': "{seen}/{size} episodes",
'seasons.notStarted': "Not started yet",
'seasons.rateNow': "Rate it",
'seasons.reviewPh': "Your review of season {n}…",
'seasons.writeReview': "Write a review of this season",
'seasons.finalHint': "When the show is finished, your rating will be the average of your rated seasons.",
'seasons.finalApplied': "Average of your rated seasons.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Crea tu cuenta para continuar",
'guest.promptText': "Para puntuar, añadir un título a tu biblioteca o escribir una reseña necesitas una cuenta. Es gratis y lleva 30 segundos.",
'guest.banner': "Estás explorando sin cuenta: inicia sesión para puntuar y seguir tus títulos.",
// — Notes par saison —
'seasons.title': "Mis temporadas",
'seasons.average': "Media:",
'seasons.hint': "Puntúa cada temporada cuando la hayas visto. Al terminar la serie, tu nota final será la media de tus temporadas puntuadas.",
'seasons.season': "Temporada {n}",
'seasons.seen': "Vista",
'seasons.progress': "{seen}/{size} episodios",
'seasons.notStarted': "Aún no empezada",
'seasons.rateNow': "Puntúala",
'seasons.reviewPh': "Tu reseña de la temporada {n}…",
'seasons.writeReview': "Escribir una reseña de esta temporada",
'seasons.finalHint': "Al terminar la serie, tu nota será la media de tus temporadas puntuadas.",
'seasons.finalApplied': "Media de tus temporadas puntuadas.",
}
export default dict
+13
View File
@@ -1336,6 +1336,19 @@ const dict = {
'guest.promptTitle': "Crée ton compte pour continuer",
'guest.promptText': "Pour noter, ajouter un titre à ta bibliothèque ou écrire un avis, il te faut un compte. C'est gratuit et ça prend 30 secondes.",
'guest.banner': "Tu explores sans compte : connecte-toi pour noter et suivre tes titres.",
// — Notes par saison —
'seasons.title': "Mes saisons",
'seasons.average': "Moyenne :",
'seasons.hint': "Note chaque saison quand tu l'as vue. Une fois la série terminée, ta note finale devient la moyenne de tes saisons notées.",
'seasons.season': "Saison {n}",
'seasons.seen': "Vue",
'seasons.progress': "{seen}/{size} épisodes",
'seasons.notStarted': "Pas encore commencée",
'seasons.rateNow': "À noter",
'seasons.reviewPh': "Ton avis sur la saison {n}…",
'seasons.writeReview': "Écrire un avis sur cette saison",
'seasons.finalHint': "À la fin de la série, ta note sera la moyenne de tes saisons notées.",
'seasons.finalApplied': "Moyenne de tes saisons notées.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "जारी रखने के लिए अपना खाता बनाएँ",
'guest.promptText': "रेटिंग देने, लाइब्रेरी में टाइटल जोड़ने या समीक्षा लिखने के लिए खाता चाहिए। यह मुफ़्त है और 30 सेकंड लगते हैं।",
'guest.banner': "आप बिना खाते के देख रहे हैं: रेटिंग देने और टाइटल ट्रैक करने के लिए लॉग इन करें।",
// — Notes par saison —
'seasons.title': "मेरे सीज़न",
'seasons.average': "औसत:",
'seasons.hint': "हर सीज़न देखने के बाद उसे रेटिंग दें। सीरीज़ पूरी होने पर आपकी अंतिम रेटिंग आपके रेट किए सीज़नों का औसत होगी।",
'seasons.season': "सीज़न {n}",
'seasons.seen': "देखा",
'seasons.progress': "{seen}/{size} एपिसोड",
'seasons.notStarted': "अभी शुरू नहीं",
'seasons.rateNow': "रेट करें",
'seasons.reviewPh': "सीज़न {n} पर आपकी राय…",
'seasons.writeReview': "इस सीज़न की समीक्षा लिखें",
'seasons.finalHint': "सीरीज़ पूरी होने पर आपकी रेटिंग रेट किए सीज़नों का औसत होगी।",
'seasons.finalApplied': "रेट किए सीज़नों का औसत।",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Buat akunmu untuk melanjutkan",
'guest.promptText': "Untuk memberi nilai, menambahkan judul ke perpustakaanmu, atau menulis ulasan, kamu perlu akun. Gratis dan hanya 30 detik.",
'guest.banner': "Kamu menjelajah tanpa akun: masuk untuk memberi nilai dan melacak judulmu.",
// — Notes par saison —
'seasons.title': "Musimku",
'seasons.average': "Rata-rata:",
'seasons.hint': "Beri nilai tiap musim setelah kamu menontonnya. Saat serial selesai, nilai akhirmu jadi rata-rata musim yang kamu nilai.",
'seasons.season': "Musim {n}",
'seasons.seen': "Sudah ditonton",
'seasons.progress': "{seen}/{size} episode",
'seasons.notStarted': "Belum dimulai",
'seasons.rateNow': "Beri nilai",
'seasons.reviewPh': "Ulasanmu tentang musim {n}…",
'seasons.writeReview': "Tulis ulasan musim ini",
'seasons.finalHint': "Saat serial selesai, nilaimu jadi rata-rata musim yang kamu nilai.",
'seasons.finalApplied': "Rata-rata musim yang kamu nilai.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Crea il tuo account per continuare",
'guest.promptText': "Per votare, aggiungere un titolo alla tua libreria o scrivere una recensione ti serve un account. È gratis e richiede 30 secondi.",
'guest.banner': "Stai esplorando senza account: accedi per votare e seguire i tuoi titoli.",
// — Notes par saison —
'seasons.title': "Le mie stagioni",
'seasons.average': "Media:",
'seasons.hint': "Vota ogni stagione dopo averla vista. Finita la serie, il tuo voto finale sarà la media delle stagioni votate.",
'seasons.season': "Stagione {n}",
'seasons.seen': "Vista",
'seasons.progress': "{seen}/{size} episodi",
'seasons.notStarted': "Non ancora iniziata",
'seasons.rateNow': "Da votare",
'seasons.reviewPh': "La tua recensione della stagione {n}…",
'seasons.writeReview': "Scrivi una recensione di questa stagione",
'seasons.finalHint': "Finita la serie, il tuo voto sarà la media delle stagioni votate.",
'seasons.finalApplied': "Media delle stagioni votate.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "続けるにはアカウントを作成",
'guest.promptText': "評価やライブラリへの追加、レビューの投稿にはアカウントが必要です。無料で30秒で作れます。",
'guest.banner': "アカウントなしで閲覧中:評価や作品の記録にはログインしてください。",
// — Notes par saison —
'seasons.title': "シーズン評価",
'seasons.average': "平均:",
'seasons.hint': "観終わったシーズンごとに評価できます。シリーズを観終えると、評価したシーズンの平均が最終評価になります。",
'seasons.season': "シーズン{n}",
'seasons.seen': "視聴済み",
'seasons.progress': "{seen}/{size}話",
'seasons.notStarted': "未視聴",
'seasons.rateNow': "評価しよう",
'seasons.reviewPh': "シーズン{n}の感想…",
'seasons.writeReview': "このシーズンのレビューを書く",
'seasons.finalHint': "シリーズを観終えると、評価したシーズンの平均があなたの評価になります。",
'seasons.finalApplied': "評価したシーズンの平均です。",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "계속하려면 계정을 만드세요",
'guest.promptText': "평가하거나 라이브러리에 작품을 추가하거나 리뷰를 쓰려면 계정이 필요해요. 무료이고 30초면 돼요.",
'guest.banner': "계정 없이 둘러보는 중이에요: 평가하고 작품을 기록하려면 로그인하세요.",
// — Notes par saison —
'seasons.title': "내 시즌",
'seasons.average': "평균:",
'seasons.hint': "시즌을 다 보면 시즌별로 평가하세요. 시리즈를 다 보면 평가한 시즌들의 평균이 최종 평점이 돼요.",
'seasons.season': "시즌 {n}",
'seasons.seen': "시청 완료",
'seasons.progress': "{seen}/{size}화",
'seasons.notStarted': "아직 시작 안 함",
'seasons.rateNow': "평가하기",
'seasons.reviewPh': "시즌 {n}에 대한 리뷰…",
'seasons.writeReview': "이 시즌 리뷰 쓰기",
'seasons.finalHint': "시리즈를 다 보면 평가한 시즌들의 평균이 평점이 돼요.",
'seasons.finalApplied': "평가한 시즌들의 평균이에요.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Maak een account om verder te gaan",
'guest.promptText': "Om te beoordelen, een titel aan je bibliotheek toe te voegen of een recensie te schrijven heb je een account nodig. Het is gratis en duurt 30 seconden.",
'guest.banner': "Je verkent zonder account: log in om te beoordelen en je titels te volgen.",
// — Notes par saison —
'seasons.title': "Mijn seizoenen",
'seasons.average': "Gemiddeld:",
'seasons.hint': "Beoordeel elk seizoen zodra je het gezien hebt. Is de serie uit, dan wordt je eindscore het gemiddelde van je beoordeelde seizoenen.",
'seasons.season': "Seizoen {n}",
'seasons.seen': "Gezien",
'seasons.progress': "{seen}/{size} afleveringen",
'seasons.notStarted': "Nog niet begonnen",
'seasons.rateNow': "Beoordeel",
'seasons.reviewPh': "Jouw recensie van seizoen {n}…",
'seasons.writeReview': "Een recensie over dit seizoen schrijven",
'seasons.finalHint': "Aan het eind van de serie is je score het gemiddelde van je beoordeelde seizoenen.",
'seasons.finalApplied': "Gemiddelde van je beoordeelde seizoenen.",
}
export default dict
+13
View File
@@ -1474,6 +1474,19 @@ const dict: Translations = {
'guest.promptTitle': "Załóż konto, aby kontynuować",
'guest.promptText': "Aby oceniać, dodawać tytuły do biblioteki lub pisać recenzje, potrzebujesz konta. To darmowe i zajmuje 30 sekund.",
'guest.banner': "Przeglądasz bez konta: zaloguj się, aby oceniać i śledzić swoje tytuły.",
// — Notes par saison —
'seasons.title': "Moje sezony",
'seasons.average': "Średnia:",
'seasons.hint': "Oceniaj każdy sezon po obejrzeniu. Po skończeniu serialu twoja ocena końcowa będzie średnią ocenionych sezonów.",
'seasons.season': "Sezon {n}",
'seasons.seen': "Obejrzany",
'seasons.progress': "{seen}/{size} odcinków",
'seasons.notStarted': "Jeszcze nie rozpoczęty",
'seasons.rateNow': "Oceń",
'seasons.reviewPh': "Twoja recenzja sezonu {n}…",
'seasons.writeReview': "Napisz recenzję tego sezonu",
'seasons.finalHint': "Po skończeniu serialu twoja ocena będzie średnią ocenionych sezonów.",
'seasons.finalApplied': "Średnia ocenionych sezonów.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Cria a tua conta para continuar",
'guest.promptText': "Para avaliar, adicionar um título à tua biblioteca ou escrever uma crítica, precisas de uma conta. É grátis e demora 30 segundos.",
'guest.banner': "Estás a explorar sem conta: inicia sessão para avaliar e acompanhar os teus títulos.",
// — Notes par saison —
'seasons.title': "As minhas temporadas",
'seasons.average': "Média:",
'seasons.hint': "Avalia cada temporada quando a vires. Quando a série terminar, a tua nota final passa a ser a média das temporadas avaliadas.",
'seasons.season': "Temporada {n}",
'seasons.seen': "Vista",
'seasons.progress': "{seen}/{size} episódios",
'seasons.notStarted': "Ainda não começada",
'seasons.rateNow': "Avaliar",
'seasons.reviewPh': "A tua crítica da temporada {n}…",
'seasons.writeReview': "Escrever uma crítica desta temporada",
'seasons.finalHint': "No fim da série, a tua nota será a média das temporadas avaliadas.",
'seasons.finalApplied': "Média das tuas temporadas avaliadas.",
}
export default dict
+13
View File
@@ -1474,6 +1474,19 @@ const dict: Translations = {
'guest.promptTitle': "Создай аккаунт, чтобы продолжить",
'guest.promptText': "Чтобы ставить оценки, добавлять тайтлы в библиотеку или писать отзывы, нужен аккаунт. Это бесплатно и занимает 30 секунд.",
'guest.banner': "Ты смотришь без аккаунта: войди, чтобы ставить оценки и отслеживать тайтлы.",
// — Notes par saison —
'seasons.title': "Мои сезоны",
'seasons.average': "Среднее:",
'seasons.hint': "Оценивай каждый сезон после просмотра. Когда сериал закончится, итоговая оценка станет средней по оценённым сезонам.",
'seasons.season': "Сезон {n}",
'seasons.seen': "Просмотрен",
'seasons.progress': "{seen}/{size} серий",
'seasons.notStarted': "Ещё не начат",
'seasons.rateNow': "Оцени",
'seasons.reviewPh': "Твой отзыв о сезоне {n}…",
'seasons.writeReview': "Написать отзыв об этом сезоне",
'seasons.finalHint': "В конце сериала оценкой станет среднее по оценённым сезонам.",
'seasons.finalApplied': "Среднее по оценённым сезонам.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "สร้างบัญชีเพื่อดำเนินการต่อ",
'guest.promptText': "หากต้องการให้คะแนน เพิ่มเรื่องในคลัง หรือเขียนรีวิว คุณต้องมีบัญชี ฟรีและใช้เวลาเพียง 30 วินาที",
'guest.banner': "คุณกำลังสำรวจโดยไม่มีบัญชี: เข้าสู่ระบบเพื่อให้คะแนนและติดตามเรื่องของคุณ",
// — Notes par saison —
'seasons.title': "ซีซันของฉัน",
'seasons.average': "ค่าเฉลี่ย:",
'seasons.hint': "ให้คะแนนแต่ละซีซันเมื่อดูจบ เมื่อดูซีรีส์จบ คะแนนสุดท้ายจะเป็นค่าเฉลี่ยของซีซันที่คุณให้คะแนน",
'seasons.season': "ซีซัน {n}",
'seasons.seen': "ดูแล้ว",
'seasons.progress': "{seen}/{size} ตอน",
'seasons.notStarted': "ยังไม่เริ่ม",
'seasons.rateNow': "ให้คะแนน",
'seasons.reviewPh': "รีวิวของคุณสำหรับซีซัน {n}…",
'seasons.writeReview': "เขียนรีวิวซีซันนี้",
'seasons.finalHint': "เมื่อดูซีรีส์จบ คะแนนของคุณจะเป็นค่าเฉลี่ยของซีซันที่ให้คะแนน",
'seasons.finalApplied': "ค่าเฉลี่ยของซีซันที่คุณให้คะแนน",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Devam etmek için hesabını oluştur",
'guest.promptText': "Puan vermek, kitaplığına yapım eklemek ya da inceleme yazmak için bir hesap gerekir. Ücretsiz ve 30 saniye sürer.",
'guest.banner': "Hesapsız keşfediyorsun: puan vermek ve yapımlarını takip etmek için giriş yap.",
// — Notes par saison —
'seasons.title': "Sezonlarım",
'seasons.average': "Ortalama:",
'seasons.hint': "Her sezonu izledikten sonra puanla. Dizi bitince son puanın, puanladığın sezonların ortalaması olur.",
'seasons.season': "{n}. sezon",
'seasons.seen': "İzlendi",
'seasons.progress': "{seen}/{size} bölüm",
'seasons.notStarted': "Henüz başlanmadı",
'seasons.rateNow': "Puanla",
'seasons.reviewPh': "{n}. sezon hakkındaki incelemen…",
'seasons.writeReview': "Bu sezon için inceleme yaz",
'seasons.finalHint': "Dizi bitince puanın, puanladığın sezonların ortalaması olacak.",
'seasons.finalApplied': "Puanladığın sezonların ortalaması.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "Tạo tài khoản để tiếp tục",
'guest.promptText': "Để chấm điểm, thêm phim vào thư viện hoặc viết đánh giá, bạn cần một tài khoản. Miễn phí và chỉ mất 30 giây.",
'guest.banner': "Bạn đang khám phá mà không có tài khoản: đăng nhập để chấm điểm và theo dõi phim.",
// — Notes par saison —
'seasons.title': "Các mùa của tôi",
'seasons.average': "Trung bình:",
'seasons.hint': "Chấm điểm từng mùa sau khi xem. Khi xem hết series, điểm cuối cùng là trung bình các mùa bạn đã chấm.",
'seasons.season': "Mùa {n}",
'seasons.seen': "Đã xem",
'seasons.progress': "{seen}/{size} tập",
'seasons.notStarted': "Chưa bắt đầu",
'seasons.rateNow': "Chấm điểm",
'seasons.reviewPh': "Đánh giá của bạn về mùa {n}…",
'seasons.writeReview': "Viết đánh giá cho mùa này",
'seasons.finalHint': "Khi xem hết series, điểm của bạn sẽ là trung bình các mùa đã chấm.",
'seasons.finalApplied': "Trung bình các mùa bạn đã chấm.",
}
export default dict
+13
View File
@@ -1334,6 +1334,19 @@ const dict: Translations = {
'guest.promptTitle': "创建账户以继续",
'guest.promptText': "评分、把作品加入片库或撰写评论都需要账户。免费,只需 30 秒。",
'guest.banner': "你正在以访客身份浏览:登录后即可评分并记录你的作品。",
// — Notes par saison —
'seasons.title': "我的各季",
'seasons.average': "平均:",
'seasons.hint': "每看完一季就为它评分。整部剧看完后,最终评分为你已评分各季的平均值。",
'seasons.season': "第 {n} 季",
'seasons.seen': "已看完",
'seasons.progress': "{seen}/{size} 集",
'seasons.notStarted': "尚未开始",
'seasons.rateNow': "去评分",
'seasons.reviewPh': "你对第 {n} 季的评价…",
'seasons.writeReview': "为这一季写评价",
'seasons.finalHint': "整部剧看完后,你的评分将是已评分各季的平均值。",
'seasons.finalApplied': "已评分各季的平均值。",
}
export default dict
+2
View File
@@ -20,6 +20,7 @@ import {
} from './security'
import { normalizeText, todayISO, uid } from './utils'
import { normalizeChallenges, normalizeEpisodeLog } from './challenges'
import { normalizeSeasonRatings } from './seasons'
const TYPES = new Set<string>(MEDIA_TYPES.map((t) => t.value))
const STATUS_SET = new Set<string>(STATUSES.map((s) => s.value))
@@ -132,6 +133,7 @@ export function normalizeItem(raw: unknown): MediaItem | null {
tags,
countries: safeCountries(r.countries),
rewatchDates: safeDates(r.rewatchDates),
seasonRatings: normalizeSeasonRatings(r.seasonRatings),
episodeLog: normalizeEpisodeLog(r.episodeLog),
publicRating: (() => {
const n = num(r.publicRating, 0, 10)
+59
View File
@@ -0,0 +1,59 @@
import type { MediaItem, RatingScale, SeasonRating } from '../types'
import { episodeCap, episodesBeforeSeason } from './franchise'
/**
* Notes par saison (séries de plusieurs saisons) : on note chaque saison vue, avec un avis si on veut.
* Quand toute la série est vue, la note finale devient la moyenne des saisons notées,
* arrondie à l'étoile (échelle /5) ou au point (échelle /10). Une série déjà notée sans notes de saison n'est pas touchée.
*/
/** Série découpée en saisons connues (au moins 2). */
export const hasSeasons = (item: Pick<MediaItem, 'seasons'>) => (item.seasons?.length ?? 0) >= 2
/** Moyenne des saisons notées, arrondie selon l'échelle (valeur stockée sur 10). */
export function seasonsAverage(ratings: MediaItem['seasonRatings'], scale: RatingScale): number | undefined {
const values = Object.values(ratings ?? {})
.map((r) => r.rating)
.filter((v): v is number => typeof v === 'number' && v > 0)
if (!values.length) return undefined
const avg = values.reduce((a, b) => a + b, 0) / values.length
// Étoiles : une étoile = 2 points sur 10 → on arrondit à l'étoile entière
return scale === '5' ? Math.max(2, Math.round(avg / 2) * 2) : Math.max(1, Math.round(avg))
}
/** Saisons entièrement vues pour un nombre d'épisodes donné (1 = première). */
export function seasonsDone(seasons: number[], watched: number): number[] {
const out: number[] = []
for (let n = 1; n <= seasons.length; n++) if (watched >= episodesBeforeSeason(seasons, n) + seasons[n - 1]) out.push(n)
return out
}
/** Ce que vient de terminer un passage de `before` à `after` épisodes : une saison, toute la série, ou rien. */
export type Completion = { season: number } | { final: true }
export function completionOf(item: Pick<MediaItem, 'seasons' | 'episodesTotal'>, before: number, after: number): Completion | undefined {
if (after <= before) return undefined
const cap = episodeCap(item)
if (cap && after >= cap && before < cap) {
// Dernière saison d'une série à saisons : on note cette saison (la note finale suit toute seule)
return hasSeasons(item) ? { season: item.seasons!.length } : { final: true }
}
if (!hasSeasons(item)) return undefined
const newly = seasonsDone(item.seasons!, after).filter((n) => !seasonsDone(item.seasons!, before).includes(n))
return newly.length ? { season: newly[newly.length - 1] } : undefined
}
/** Nettoyage (sauvegarde, synchro) : saisons 1 à 200, note 0,5–10, avis ≤ 5 000 caractères. */
export function normalizeSeasonRatings(v: unknown): Record<string, SeasonRating> | undefined {
if (!v || typeof v !== 'object' || Array.isArray(v)) return undefined
const out: Record<string, SeasonRating> = {}
for (const [k, raw] of Object.entries(v as Record<string, unknown>).slice(0, 200)) {
if (!/^[1-9]\d{0,2}$/.test(k) || !raw || typeof raw !== 'object') continue
const r = raw as Record<string, unknown>
const rating = typeof r.rating === 'number' && r.rating >= 0.5 && r.rating <= 10 ? Math.round(r.rating * 2) / 2 : undefined
const notes = typeof r.notes === 'string' && r.notes.trim() ? r.notes.slice(0, 5000) : undefined
if (rating == null && !notes) continue
out[k] = { rating, notes, spoiler: notes && r.spoiler === true ? true : undefined }
}
return Object.keys(out).length ? out : undefined
}
+13 -2
View File
@@ -1,3 +1,4 @@
import { completionOf, seasonsAverage, type Completion } from './lib/seasons'
import { t } from './i18n'
import { createContext, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import type { CustomList, MediaInput, MediaItem, Settings, TopCategory } from './types'
@@ -53,7 +54,8 @@ interface MediaStore {
add: (input: MediaInput) => Promise<MediaItem>
update: (id: string, patch: Partial<MediaInput>) => Promise<void>
remove: (id: string) => Promise<void>
incrementEpisode: (id: string, delta?: number) => Promise<void>
/** +1 épisode. Renvoie ce que ça vient de terminer (une saison, ou toute la série), pour proposer de noter. */
incrementEpisode: (id: string, delta?: number) => Promise<Completion | undefined>
importItems: (items: MediaItem[], mode: 'merge' | 'replace') => Promise<void>
/** Remplace le Top 5 d'une catégorie par ces fiches, dans l'ordre (max 5). */
setTopList: (category: TopCategory, orderedIds: string[]) => Promise<void>
@@ -284,6 +286,11 @@ export function MediaProvider({
const current = itemsRef.current.find((i) => i.id === id)
if (!current) return
const next = { ...current, ...patch, updatedAt: new Date().toISOString() }
// Notes de saison : série entièrement vue → la note finale est la moyenne des saisons notées
if (('seasonRatings' in patch || patch.status === 'termine') && next.status === 'termine' && next.seasonRatings) {
const avg = seasonsAverage(next.seasonRatings, settingsRef.current.ratingScale)
if (avg != null) next.rating = avg
}
// Défis : on retient le jour où des épisodes sont cochés (ou décochés)
const delta = (patch.episodesWatched ?? current.episodesWatched) - current.episodesWatched
if (delta) next.episodeLog = logEpisodes(current.episodeLog, delta)
@@ -361,6 +368,7 @@ export function MediaProvider({
// Statut, saison et dates (début au premier épisode, fin au dernier) suivent
const patch = episodesPatch(item, next)
await update(id, patch)
return completionOf(item, item.episodesWatched, next)
},
[update],
)
@@ -549,7 +557,10 @@ export function MediaProvider({
ask()
throw new GuestError()
},
update: noop, remove: noop, incrementEpisode: noop, importItems: noop, setTopList: noop, clearAll: noop,
update: noop, remove: noop, incrementEpisode: async () => {
ask()
return undefined
}, importItems: noop, setTopList: noop, clearAll: noop,
updateMany: noop, removeMany: noop, restore: noop, deleteList: noop, toggleInList: noop,
createList: (name: string) => {
ask()
+9
View File
@@ -59,6 +59,8 @@ export interface MediaItem {
rewatchDates?: string[]
/** Note moyenne du public sur 10 (TMDB ou AniList). */
publicRating?: number
/** Notes et avis par saison (« 1 », « 2 »…), pour les séries de plusieurs saisons. */
seasonRatings?: Record<string, SeasonRating>
/** Épisodes cochés par jour (AAAA-MM-JJ → nombre), pour les défis. Privé (retiré des profils publics). */
episodeLog?: Record<string, number>
@@ -66,6 +68,13 @@ export interface MediaItem {
updatedAt: string // ISO
}
/** Note (sur 10) et avis d'une saison. */
export interface SeasonRating {
rating?: number
notes?: string
spoiler?: boolean
}
export type MediaInput = Omit<MediaItem, 'id' | 'createdAt' | 'updatedAt'>
export type RatingScale = '5' | '10'