Notes par saison : note + avis par saison, note finale = moyenne arrondie
deploy / deploy (push) Successful in 43s
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:
26 files changed
+540
-11
No files matched your search
@@ -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">
|
||||
|
||||
Reference in new issue
Block a user