Fiche plein écran sur PC, bas des fenêtres visible, dates automatiques
deploy / deploy (push) Successful in 59s

- Bas coupé : .safe-bottom (hors couches Tailwind) annulait les marges du
  bas (pb-16, pb-40…) de toutes les fenêtres ; passé en @layer base, et
  marges des fenêtres calculées avec env(safe-area-inset-bottom).
- PC (≥ lg) : fiche en deux colonnes sur toute la largeur (infos, avis,
  casting, suivi à gauche ; note moyenne, actions et épisodes à droite),
  grande image d'en-tête, liste d'épisodes plus haute.
- Dates : noter un titre terminé met la date du jour (si aucune) ; pour une
  série, premier épisode coché = date de début, dernier = date de fin
  (règle commune lib/progress.ts, aussi pour le bouton +1 de l'accueil).

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-08 17:57:24 +00:00
1 parent 1b185e5e9d
commit 91009bd069
10 files changed
+89 -42

No files matched your search

+1 -1
View File
@@ -104,7 +104,7 @@ export default function EpisodeList({ form, aired, onChange }: Props) {
</span> </span>
</div> </div>
<div ref={listRef} className="max-h-[26rem] space-y-1 overflow-y-auto overscroll-contain pe-1"> <div ref={listRef} className="max-h-[26rem] space-y-1 overflow-y-auto lg:max-h-[60vh] overscroll-contain pe-1">
{rows.map((e) => { {rows.map((e) => {
const seen = e.number <= watchedHere const seen = e.number <= watchedHere
// Pas encore sorti : date à venir (TMDB), ou au-delà des épisodes diffusés // Pas encore sorti : date à venir (TMDB), ou au-delà des épisodes diffusés
+1 -1
View File
@@ -52,7 +52,7 @@ export default function SharePreview({ blob, filename, title, onClose }: Props)
<div className="flex min-h-0 flex-1 items-center justify-center px-6"> <div className="flex min-h-0 flex-1 items-center justify-center px-6">
{url && <img src={url} alt={t('share.posterAlt', { title })} className="max-h-full max-w-full rounded-2xl border border-line object-contain" />} {url && <img src={url} alt={t('share.posterAlt', { title })} className="max-h-full max-w-full rounded-2xl border border-line object-contain" />}
</div> </div>
<div className="safe-bottom mx-auto grid w-full max-w-md grid-cols-1 gap-2 px-4 pb-4 pt-4"> <div className="mx-auto grid w-full max-w-md grid-cols-1 gap-2 px-4 pb-[calc(1rem+env(safe-area-inset-bottom))] pt-4">
<button onClick={go} disabled={busy} className="btn btn-primary py-3"> <button onClick={go} disabled={busy} className="btn btn-primary py-3">
{canShare ? <Share2 size={18} /> : <Download size={18} />} {canShare ? <Share2 size={18} /> : <Download size={18} />}
{canShare ? t('share.share') : t('share.saveImage')} {canShare ? t('share.share') : t('share.saveImage')}
+1 -1
View File
@@ -23,7 +23,7 @@ export default function Sheet({ title, onClose, right, children, label, elevated
</div> </div>
</header> </header>
<div className="sheet-scroll"> <div className="sheet-scroll">
<div className="safe-bottom mx-auto max-w-2xl pb-16">{children}</div> <div className="mx-auto max-w-2xl pb-[calc(6rem+env(safe-area-inset-bottom))]">{children}</div>
</div> </div>
</div> </div>
) )
+1 -1
View File
@@ -97,7 +97,7 @@ export default function AddTitle({
</header> </header>
<div className="sheet-scroll"> <div className="sheet-scroll">
<div className="safe-bottom mx-auto max-w-2xl px-4 pb-16 pt-2"> <div className="mx-auto max-w-2xl px-4 pb-[calc(10rem+env(safe-area-inset-bottom))] pt-2">
{!hasKey && ( {!hasKey && (
<div className="mt-4 rounded-2xl border border-dashed border-line-strong p-4 text-sm text-ink-2"> <div className="mt-4 rounded-2xl border border-dashed border-line-strong p-4 text-sm text-ink-2">
{t('search.animeOnly')} {t('search.animeOnly')}
+1 -1
View File
@@ -124,7 +124,7 @@ export default function EditDetails({
void submit() void submit()
}} }}
> >
<div className="safe-bottom mx-auto max-w-2xl space-y-7 px-4 py-6 pb-16"> <div className="mx-auto max-w-2xl space-y-7 px-4 pt-6 pb-[calc(10rem+env(safe-area-inset-bottom))]">
<div className="flex gap-4"> <div className="flex gap-4">
<div className="w-28 shrink-0"> <div className="w-28 shrink-0">
<button type="button" onClick={() => fileRef.current?.click()} className="relative block w-full" aria-label={t('form.pickPoster')}> <button type="button" onClick={() => fileRef.current?.click()} className="relative block w-full" aria-label={t('form.pickPoster')}>
+1 -1
View File
@@ -25,7 +25,7 @@ export default function ReviewEditor({ title, initial, onSave, onClose }: { titl
</div> </div>
</header> </header>
<div className="sheet-scroll"> <div className="sheet-scroll">
<div className="safe-bottom mx-auto max-w-2xl px-4 py-5"> <div className="mx-auto max-w-2xl px-4 pt-5 pb-[calc(10rem+env(safe-area-inset-bottom))]">
<span className="eyebrow">{t('form.review')}</span> <span className="eyebrow">{t('form.review')}</span>
<textarea <textarea
className="field mt-2 min-h-[45dvh] resize-none leading-relaxed" className="field mt-2 min-h-[45dvh] resize-none leading-relaxed"
+32 -21
View File
@@ -9,6 +9,7 @@ import { airedCount, nextAirDate, useAiringCache } from '../../lib/airing'
import { useBackToClose } from '../../lib/backNav' import { useBackToClose } from '../../lib/backNav'
import { useEscape } from '../../lib/escape' import { useEscape } from '../../lib/escape'
import { episodeCap, seasonPosition } from '../../lib/franchise' import { episodeCap, seasonPosition } from '../../lib/franchise'
import { episodesPatch } from '../../lib/progress'
import { useScrollLock } from '../../lib/scrollLock' import { useScrollLock } from '../../lib/scrollLock'
import { renderItemCard, slug } from '../../lib/shareCard' import { renderItemCard, slug } from '../../lib/shareCard'
import { cx, formatDate, formatDuration, formatRating, todayISO } from '../../lib/utils' import { cx, formatDate, formatDuration, formatRating, todayISO } from '../../lib/utils'
@@ -160,41 +161,42 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
const patch: Partial<MediaInput> = { status: s } const patch: Partial<MediaInput> = { status: s }
const today = todayISO() const today = todayISO()
if (s === 'a_voir') Object.assign(patch, { startDate: undefined, endDate: undefined }) if (s === 'a_voir') Object.assign(patch, { startDate: undefined, endDate: undefined })
if (s === 'en_cours') Object.assign(patch, { startDate: item?.startDate ?? today, endDate: undefined }) // Série : la date de début est celle du premier épisode coché
if (s === 'en_cours') Object.assign(patch, { startDate: episodic && !item?.episodesWatched ? item?.startDate : (item?.startDate ?? today), endDate: undefined })
if (s === 'termine') { if (s === 'termine') {
patch.endDate = item?.endDate ?? today patch.endDate = item?.status === 'termine' && item.endDate ? item.endDate : today
if (!item?.startDate && !episodic) patch.startDate = patch.endDate if (!item?.startDate) patch.startDate = episodic && item?.episodesWatched ? today : patch.endDate
const cap = episodeCap(item ?? { episodesTotal: data.episodesTotal, seasons: data.seasons }) const cap = episodeCap(item ?? { episodesTotal: data.episodesTotal, seasons: data.seasons })
if (episodic && cap) patch.episodesWatched = cap if (episodic && cap) patch.episodesWatched = cap
} }
void save(patch) void save(patch)
} }
/** Noter un titre pas encore vu le marque comme vu (comme sur Letterboxd). */ /**
* Noter un titre pas encore vu le marque comme vu (comme sur Letterboxd),
* et la date de visionnage devient le jour où l'on note (si elle n'est pas déjà connue).
*/
const rate = (rating: number | undefined) => { const rate = (rating: number | undefined) => {
const patch: Partial<MediaInput> = { rating } const patch: Partial<MediaInput> = { rating }
if (rating != null && (!item || item.status === 'a_voir')) { if (rating != null) {
const today = todayISO()
if (!item || item.status === 'a_voir') {
patch.status = 'termine' patch.status = 'termine'
patch.endDate = todayISO()
const cap = episodeCap(item ?? { episodesTotal: data.episodesTotal, seasons: data.seasons }) const cap = episodeCap(item ?? { episodesTotal: data.episodesTotal, seasons: data.seasons })
if (episodic && cap) patch.episodesWatched = cap if (episodic && cap) patch.episodesWatched = cap
} }
// Date de fin seulement pour un titre terminé (noter une série en cours ne la termine pas)
const finished = (patch.status ?? item?.status) === 'termine'
if (finished && !item?.endDate) patch.endDate = today
if (finished && !item?.startDate) patch.startDate = today
}
void save(patch) void save(patch)
} }
/** Nouveaux épisodes vus : le statut et les dates suivent (comme la liste d'épisodes). */ /** Nouveaux épisodes vus : le statut et les dates suivent (comme la liste d'épisodes). */
const setEpisodes = (n: number, season?: number) => { const setEpisodes = (n: number, season?: number) => {
if (!item) return if (!item) return
const cap = episodeCap(item) void update(item.id, episodesPatch(item, n, season))
const watched = Math.max(0, cap ? Math.min(n, cap) : n)
const patch: Partial<MediaInput> = {
episodesWatched: watched,
season: item.seasons ? (season ?? seasonPosition({ ...item, episodesWatched: watched, season: undefined })?.season) : item.season,
}
if (watched > 0 && (item.status === 'a_voir' || item.status === 'pause')) Object.assign(patch, { status: 'en_cours', startDate: item.startDate ?? todayISO() })
if (cap && watched >= cap) Object.assign(patch, { status: 'termine', endDate: item.endDate ?? todayISO() })
else if (item.status === 'termine' && watched < item.episodesWatched) Object.assign(patch, { status: 'en_cours', endDate: undefined })
void update(item.id, patch)
} }
// Épisodes déjà sortis (fiche suivie) : on ne coche pas un épisode à venir // Épisodes déjà sortis (fiche suivie) : on ne coche pas un épisode à venir
@@ -259,7 +261,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
return ( return (
<div className="sheet sheet-in" role="dialog" aria-modal="true" aria-label={title}> <div className="sheet sheet-in" role="dialog" aria-modal="true" aria-label={title}>
<header className="safe-top border-b border-line bg-bg"> <header className="safe-top border-b border-line bg-bg">
<div className="mx-auto flex max-w-2xl items-center gap-2 px-3 py-2.5"> <div className="mx-auto flex max-w-2xl items-center gap-2 px-3 py-2.5 lg:max-w-6xl">
<button onClick={onClose} className="grid size-10 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}> <button onClick={onClose} className="grid size-10 place-items-center rounded-full text-ink-2" aria-label={t('common.close')}>
<X size={22} /> <X size={22} />
</button> </button>
@@ -275,19 +277,20 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
</header> </header>
<div className="sheet-scroll"> <div className="sheet-scroll">
<div className="safe-bottom mx-auto max-w-2xl pb-20"> {/* Grande marge en bas : rien ne reste caché sous une barre des tâches ou la barre d'accueil du téléphone */}
<div className="mx-auto max-w-2xl pb-[calc(10rem+env(safe-area-inset-bottom))] lg:max-w-6xl">
{/* Image de scène + affiche */} {/* Image de scène + affiche */}
{(backdrop ?? extras?.backdrop) ? ( {(backdrop ?? extras?.backdrop) ? (
<img src={backdrop ?? extras?.backdrop} alt="" className="aspect-[16/8] w-full border-b border-line object-cover opacity-80" /> <img src={backdrop ?? extras?.backdrop} alt="" className="aspect-[16/8] w-full border-b border-line object-cover opacity-80 lg:aspect-auto lg:h-[22rem] lg:rounded-b-2xl lg:border-x" />
) : ( ) : (
<div className="h-6" /> <div className="h-6" />
)} )}
<div className="flex gap-4 px-4"> <div className="flex gap-4 px-4">
<div className={cx('relative w-28 shrink-0', (backdrop ?? extras?.backdrop) && '-mt-14')}> <div className={cx('relative w-28 shrink-0 lg:w-44', (backdrop ?? extras?.backdrop) && '-mt-14 lg:-mt-28')}>
<Poster src={poster} title={title} className="shadow-none" /> <Poster src={poster} title={title} className="shadow-none" />
</div> </div>
<div className="min-w-0 flex-1 pt-3"> <div className="min-w-0 flex-1 pt-3">
<h1 className="text-2xl leading-tight">{title}</h1> <h1 className="text-2xl leading-tight lg:text-4xl">{title}</h1>
{data.originalTitle && <p className="mt-1 truncate text-sm text-ink-3">{data.originalTitle}</p>} {data.originalTitle && <p className="mt-1 truncate text-sm text-ink-3">{data.originalTitle}</p>}
{metaLine.length > 0 && <p className="mt-2 text-xs uppercase tracking-wide text-ink-3">{metaLine.join(' · ')}</p>} {metaLine.length > 0 && <p className="mt-2 text-xs uppercase tracking-wide text-ink-3">{metaLine.join(' · ')}</p>}
{extras && extras.directors.length > 0 && ( {extras && extras.directors.length > 0 && (
@@ -305,6 +308,9 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
{metaError && !item && <p className="mx-4 mt-4 text-sm text-accent">{metaError}</p>} {metaError && !item && <p className="mx-4 mt-4 text-sm text-accent">{metaError}</p>}
{/* Téléphone : une colonne. Ordinateur : deux colonnes (infos à gauche, mes actions et épisodes à droite). */}
<div className="flex flex-col lg:mt-4 lg:grid lg:grid-cols-[minmax(0,1fr)_26rem] lg:items-start lg:gap-6">
<div className="order-1 lg:col-start-2 lg:row-start-1">
{/* Note moyenne du public */} {/* Note moyenne du public */}
{source && <PublicRating average={average} votes={extras?.votes} distribution={extras?.distribution} scale={settings.ratingScale} source={source} mine={item?.rating} />} {source && <PublicRating average={average} votes={extras?.votes} distribution={extras?.distribution} scale={settings.ratingScale} source={source} mine={item?.rating} />}
@@ -402,6 +408,9 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
</section> </section>
)} )}
</div>
<div className="order-2 min-w-0 lg:col-start-1 lg:row-start-1">
{/* Mon avis */} {/* Mon avis */}
<section className="mx-4 mt-4"> <section className="mx-4 mt-4">
{item?.notes ? ( {item?.notes ? (
@@ -465,6 +474,8 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
{item && <Tracking item={item} lists={lists} onChange={(patch) => void update(item.id, patch)} />} {item && <Tracking item={item} lists={lists} onChange={(patch) => void update(item.id, patch)} />}
</div> </div>
</div> </div>
</div>
</div>
{toast && ( {toast && (
<div role="status" className="safe-bottom pointer-events-none fixed inset-x-0 bottom-4 z-[70] flex justify-center px-4"> <div role="status" className="safe-bottom pointer-events-none fixed inset-x-0 bottom-4 z-[70] flex justify-center px-4">
+5 -1
View File
@@ -220,8 +220,12 @@
.safe-top { .safe-top {
padding-top: env(safe-area-inset-top); padding-top: env(safe-area-inset-top);
} }
.safe-bottom { /* Couche « base » : une marge du bas explicite (pb-16, pb-40…) passe devant, sinon elle était annulée
et le bas des fenêtres restait collé au bord (caché sous la barre des tâches ou la barre d'accueil). */
@layer base {
.safe-bottom {
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
}
} }
/* /*
+41
View File
@@ -0,0 +1,41 @@
import type { MediaInput, MediaItem } from '../types'
import { episodeCap, seasonPosition } from './franchise'
import { todayISO } from './utils'
/**
* Nouveau nombre d'épisodes vus → ce qui change sur la fiche.
* Les dates se remplissent toutes seules :
* - premier épisode coché = date de début ;
* - dernier épisode coché = date de fin (et « Terminé ») ;
* - tout décoché = plus de date de début.
*/
export function episodesPatch(
item: Pick<MediaItem, 'episodesWatched' | 'episodesTotal' | 'seasons' | 'season' | 'status' | 'startDate' | 'endDate'>,
n: number,
season?: number,
): Partial<MediaInput> {
const cap = episodeCap(item)
const watched = Math.max(0, cap ? Math.min(n, cap) : n)
const patch: Partial<MediaInput> = { episodesWatched: watched }
if (item.seasons) patch.season = season ?? seasonPosition({ ...item, episodesWatched: watched, season: undefined })?.season
const today = todayISO()
if (watched > 0) {
if (!item.startDate || item.episodesWatched === 0) patch.startDate = item.episodesWatched === 0 ? today : item.startDate ?? today
if (item.status === 'a_voir' || item.status === 'pause') patch.status = 'en_cours'
} else {
patch.startDate = undefined
if (item.status === 'termine') patch.status = 'en_cours'
patch.endDate = undefined
}
if (cap && watched >= cap) {
patch.status = 'termine'
// Date de fin = le jour où l'on coche le dernier épisode
patch.endDate = item.status === 'termine' && item.endDate ? item.endDate : today
} else if (watched > 0 && item.status === 'termine' && watched < item.episodesWatched) {
patch.status = 'en_cours'
patch.endDate = undefined
}
return patch
}
+5 -14
View File
@@ -12,8 +12,9 @@ import { signOut } from './lib/cloud/auth'
import { dbNameFor, scopedKey } from './lib/scope' import { dbNameFor, scopedKey } from './lib/scope'
import { isPlainObject, LIMITS, readStorage, storageGet, storageSet } from './lib/security' import { isPlainObject, LIMITS, readStorage, storageGet, storageSet } from './lib/security'
import { mediaDB, requestPersistentStorage } from './lib/db' import { mediaDB, requestPersistentStorage } from './lib/db'
import { todayISO, uid } from './lib/utils' import { episodesPatch } from './lib/progress'
import { episodeCap, seasonPosition } from './lib/franchise' import { uid } from './lib/utils'
import { episodeCap } from './lib/franchise'
import { airedCount } from './lib/airing' import { airedCount } from './lib/airing'
// Clés propres à l'espace actif (compte connecté, ou appareil sans compte) // Clés propres à l'espace actif (compte connecté, ou appareil sans compte)
@@ -268,18 +269,8 @@ export function MediaProvider({ children, cloudUser }: { children: ReactNode; cl
const aired = airedCount(item) const aired = airedCount(item)
if (delta > 0 && aired != null) next = Math.min(next, Math.max(aired, item.episodesWatched)) if (delta > 0 && aired != null) next = Math.min(next, Math.max(aired, item.episodesWatched))
if (next === item.episodesWatched) return if (next === item.episodesWatched) return
const patch: Partial<MediaInput> = { episodesWatched: next } // Statut, saison et dates (début au premier épisode, fin au dernier) suivent
// Série en plusieurs saisons : la saison suit les épisodes vus const patch = episodesPatch(item, next)
const pos = seasonPosition({ episodesWatched: next, seasons: item.seasons })
if (pos && pos.season !== item.season) patch.season = pos.season
if (delta > 0 && (item.status === 'a_voir' || item.status === 'pause')) {
patch.status = 'en_cours'
if (!item.startDate) patch.startDate = todayISO()
}
if (cap && next === cap && delta > 0) {
patch.status = 'termine'
if (!item.endDate) patch.endDate = todayISO()
}
await update(id, patch) await update(id, patch)
}, },
[update], [update],