- Double authentification : l'écran du code se ferme bien après un code juste (la session « aal2 » prévient maintenant l'app) ; plus d'affichage furtif de l'app avant la vérification ; revérification au retour du réseau - Serveur (migration 20261128170000, appliquée) : les lectures par fonction (profil, bibliothèque, fil, notifications, listes partagées, avis, recherche, blocages) exigent aussi le code pour un compte protégé ; une fiche restaurée ne compte plus comme « a noté » ; une demande d'abonnement refusée disparaît des notifications - Catalogue : la grille continue de se charger après un passage par Journal / Listes - Moyenne des notes de saison arrondie à la demi-étoile (et plus à l'étoile entière) - Double tap sur « +1 » : plus de double message de fin de revisionnage ; « −1 » jamais ignoré - Bouton « Ouvrir les Réglages » (clé TMDB retirée) supprimé de la recherche - Pluriels russe, polonais et arabe complétés pour les notifications Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
30 files changed
+106
-63
No files matched your search
+1
-9
@@ -104,13 +104,7 @@ export default function App() {
|
||||
// Laisse les fenêtres retirer leur entrée d'historique avant de changer d'onglet
|
||||
setTimeout(() => go('home'), 50)
|
||||
}
|
||||
const toSettings = () => {
|
||||
setLayers([])
|
||||
setAdding(false)
|
||||
setManual(null)
|
||||
// Laisse les fenêtres retirer leur entrée d'historique avant de changer d'onglet
|
||||
setTimeout(() => go('settings'), 50)
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<ToastProvider>
|
||||
@@ -144,7 +138,6 @@ export default function App() {
|
||||
onOpenItem={openItem}
|
||||
onOpenPerson={openPerson}
|
||||
onManual={(title) => setManual(title)}
|
||||
onGoToSettings={toSettings}
|
||||
/>
|
||||
)}
|
||||
{layers.map((l) =>
|
||||
@@ -154,7 +147,6 @@ export default function App() {
|
||||
item={l.item}
|
||||
seed={l.seed}
|
||||
onClose={() => closeLayer(l.uid)}
|
||||
onGoToSettings={toSettings}
|
||||
onOpenPerson={openPerson}
|
||||
focus={l.item ? l.focus : undefined}
|
||||
onDone={backHome}
|
||||
|
||||
+24
-14
@@ -46,28 +46,38 @@ export default function Root() {
|
||||
setAuthMode(mode)
|
||||
setGuest(false)
|
||||
}
|
||||
// Double authentification : un compte protégé doit saisir son code avant d'entrer (undefined = vérification en cours).
|
||||
// Comptes sans double authentification (déjà vérifiés sur cet appareil) : on entre tout de suite, la vérification se fait en fond.
|
||||
const [mfaFactor, setMfaFactor] = useState<string | null | undefined>(() =>
|
||||
cloudEnabled && getSession() && sessionAal() !== 'aal2' && knownMfa() !== false ? undefined : null,
|
||||
)
|
||||
// Double authentification : un compte protégé doit saisir son code avant d'entrer.
|
||||
// Résultat de la vérification, rattaché au jeton vérifié : un nouveau jeton (connexion, code validé) est revérifié.
|
||||
const [mfa, setMfa] = useState<{ token: string; factor: string | null }>()
|
||||
// Réseau retrouvé : on revérifie (une session ouverte hors-ligne n'a pas pu l'être)
|
||||
const [onlineTick, setOnlineTick] = useState(0)
|
||||
useEffect(() => {
|
||||
const on = () => setOnlineTick((n) => n + 1)
|
||||
window.addEventListener('online', on)
|
||||
return () => window.removeEventListener('online', on)
|
||||
}, [])
|
||||
const accessToken = session?.accessToken
|
||||
useEffect(() => {
|
||||
if (!cloudEnabled || !accessToken || sessionAal() === 'aal2' || !navigator.onLine) {
|
||||
setMfaFactor(null)
|
||||
return
|
||||
}
|
||||
if (!cloudEnabled || !accessToken || sessionAal() === 'aal2' || !navigator.onLine) return
|
||||
let alive = true
|
||||
// Nouvelle connexion d'un compte peut-être protégé : on attend la vérification avant d'ouvrir l'app
|
||||
if (knownMfa() !== false) setMfaFactor(undefined)
|
||||
pendingMfaFactor()
|
||||
.then((f) => alive && setMfaFactor(f))
|
||||
.then((factor) => alive && setMfa({ token: accessToken, factor }))
|
||||
// Serveur injoignable : on laisse entrer (la base refuse de toute façon les données sans le code)
|
||||
.catch(() => alive && setMfaFactor(null))
|
||||
.catch(() => alive && setMfa({ token: accessToken, factor: null }))
|
||||
return () => {
|
||||
alive = false
|
||||
}
|
||||
}, [accessToken])
|
||||
}, [accessToken, onlineTick])
|
||||
// Calculé au rendu (pas d'effet) : l'app n'est jamais montée, même un instant, avant la vérification.
|
||||
// undefined = vérification en cours ; comptes connus sans double authentification : on entre tout de suite.
|
||||
const mfaFactor: string | null | undefined =
|
||||
!session || sessionAal() === 'aal2' || !navigator.onLine
|
||||
? null
|
||||
: mfa?.token === session.accessToken
|
||||
? mfa.factor
|
||||
: knownMfa() === false
|
||||
? null
|
||||
: undefined
|
||||
const userId = session?.user.id
|
||||
const userEmail = session?.user.email
|
||||
const user = useMemo(() => (userId ? { id: userId, email: userEmail ?? '' } : undefined), [userId, userEmail])
|
||||
|
||||
@@ -51,6 +51,7 @@ function usePlusOne(onOpen: (item: MediaItem, focus?: Completion) => void) {
|
||||
const cap = episodeCap(item)
|
||||
const endsRewatch = !!item.rewatch && !!cap && item.rewatch.episodes + 1 >= cap
|
||||
return incrementEpisode(item.id).then((done) => {
|
||||
if (done === false) return
|
||||
if (done) onOpen(item, done)
|
||||
else if (endsRewatch) toast.show(t('rewatch.finishedToast', { title: item.title }))
|
||||
})
|
||||
|
||||
@@ -34,14 +34,12 @@ export default function AddTitle({
|
||||
onOpenItem,
|
||||
onOpenPerson,
|
||||
onManual,
|
||||
onGoToSettings,
|
||||
}: {
|
||||
onClose: () => void
|
||||
onPick: (r: SearchResult) => void
|
||||
onOpenItem: (item: MediaItem) => void
|
||||
onOpenPerson: (p: PersonHit) => void
|
||||
onManual: (title: string) => void
|
||||
onGoToSettings?: () => void
|
||||
}) {
|
||||
const { items, settings } = useMedia()
|
||||
const social = useSocial()
|
||||
@@ -217,11 +215,6 @@ export default function AddTitle({
|
||||
{!hasKey && (tab === 'all' || tab === 'titles' || tab === 'people') && (
|
||||
<div className="mt-4 rounded-2xl border border-dashed border-line-strong p-4 text-sm text-ink-2">
|
||||
{t('search.animeOnly')}
|
||||
{onGoToSettings && (
|
||||
<button onClick={onGoToSettings} className="mt-2 block font-medium text-ink">
|
||||
{t('search.openSettings')} <span className="text-accent">→</span>
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ export default function EditDetails({
|
||||
initialTitle?: string
|
||||
onClose: () => void
|
||||
onCreated?: (item: MediaItem) => void
|
||||
onGoToSettings?: () => void
|
||||
}) {
|
||||
const { items, add, update } = useMedia()
|
||||
useScrollLock()
|
||||
|
||||
@@ -45,7 +45,6 @@ interface Props {
|
||||
/** Titre trouvé en ligne (pas encore ajouté) */
|
||||
seed?: SearchResult
|
||||
onClose: () => void
|
||||
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 */
|
||||
@@ -58,7 +57,7 @@ interface Props {
|
||||
* 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, focus: initialFocus, onDone }: Props) {
|
||||
export default function TitleSheet({ item: initial, seed, onClose, onOpenPerson, focus: initialFocus, onDone }: Props) {
|
||||
const { items, settings, add, update, lists, patchMany } = useMedia()
|
||||
const actions = useLibraryActions()
|
||||
const social = useSocial()
|
||||
@@ -694,7 +693,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{editing && item && <EditDetails item={item} onClose={() => setEditing(false)} onGoToSettings={onGoToSettings} />}
|
||||
{editing && item && <EditDetails item={item} onClose={() => setEditing(false)} />}
|
||||
{preview && <SharePreview blob={preview.blob} filename={preview.filename} title={title} onClose={() => setPreview(undefined)} />}
|
||||
<ConfirmDialog
|
||||
open={confirmDelete}
|
||||
|
||||
@@ -507,7 +507,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'تمت الإضافة',
|
||||
|
||||
'search.offline': 'لا يوجد اتصال بالإنترنت: البحث يتطلب الشبكة.',
|
||||
'search.openSettings': 'فتح الإعدادات',
|
||||
'search.privacy': 'يُرسَل العنوان الذي تبحث عنه فقط إلى {source}. تبقى مكتبتك على هاتفك.',
|
||||
|
||||
'catalog.sortRecent': 'المعدّلة مؤخرًا',
|
||||
@@ -721,6 +720,9 @@ const dict: Translations = {
|
||||
'notif.followAccepted': '{name} قبل طلبك',
|
||||
'notif.unread_one': '{count} إشعار جديد',
|
||||
'notif.unread_other': '{count} إشعارات جديدة',
|
||||
'notif.unread_two': 'إشعاران جديدان',
|
||||
'notif.unread_few': '{count} إشعارات جديدة',
|
||||
'notif.unread_many': '{count} إشعارًا جديدًا',
|
||||
'social.accept': 'قبول',
|
||||
'social.decline': 'رفض',
|
||||
'social.removeFollower': 'إزالة',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Hinzugefügt',
|
||||
|
||||
'search.offline': 'Keine Internetverbindung: Für die Suche brauchst du Netz.',
|
||||
'search.openSettings': 'Einstellungen öffnen',
|
||||
'search.privacy': 'Nur der gesuchte Titel wird an {source} gesendet. Deine Bibliothek bleibt auf deinem Handy.',
|
||||
|
||||
'catalog.sortRecent': 'Zuletzt bearbeitet',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Added',
|
||||
|
||||
'search.offline': 'No internet connection: search needs the network.',
|
||||
'search.openSettings': 'Open Settings',
|
||||
'search.privacy': 'Only the title you search for is sent to {source}. Your library stays on your phone.',
|
||||
|
||||
'catalog.sortRecent': 'Recently edited',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Añadido',
|
||||
|
||||
'search.offline': 'Sin conexión a internet: la búsqueda necesita red.',
|
||||
'search.openSettings': 'Abrir Ajustes',
|
||||
'search.privacy': 'Solo se envía a {source} el título que buscas. Tu biblioteca se queda en tu teléfono.',
|
||||
|
||||
'catalog.sortRecent': 'Editados recientemente',
|
||||
|
||||
@@ -461,7 +461,6 @@ const dict = {
|
||||
'reco.addedShort': 'Ajouté',
|
||||
|
||||
'search.offline': 'Pas de connexion Internet : la recherche nécessite le réseau.',
|
||||
'search.openSettings': 'Ouvrir les Réglages',
|
||||
'search.privacy': 'Seul le titre recherché est envoyé à {source}. Ta bibliothèque reste sur ton téléphone.',
|
||||
|
||||
'catalog.sortRecent': 'Modifiés récemment',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'जोड़ा गया',
|
||||
|
||||
'search.offline': 'इंटरनेट कनेक्शन नहीं है: खोज के लिए नेटवर्क ज़रूरी है।',
|
||||
'search.openSettings': 'सेटिंग्स खोलें',
|
||||
'search.privacy': 'सिर्फ़ खोजा गया टाइटल {source} को भेजा जाता है। आपकी लाइब्रेरी आपके फ़ोन पर ही रहती है।',
|
||||
|
||||
'catalog.sortRecent': 'हाल ही में एडिट किए',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Ditambahkan',
|
||||
|
||||
'search.offline': 'Tidak ada koneksi internet: pencarian butuh jaringan.',
|
||||
'search.openSettings': 'Buka Pengaturan',
|
||||
'search.privacy': 'Hanya judul yang kamu cari yang dikirim ke {source}. Koleksimu tetap di ponselmu.',
|
||||
|
||||
'catalog.sortRecent': 'Baru diubah',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Aggiunto',
|
||||
|
||||
'search.offline': 'Nessuna connessione internet: la ricerca ha bisogno della rete.',
|
||||
'search.openSettings': 'Apri le Impostazioni',
|
||||
'search.privacy': 'Viene inviato a {source} solo il titolo cercato. La tua libreria resta sul tuo telefono.',
|
||||
|
||||
'catalog.sortRecent': 'Modificati di recente',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': '追加済み',
|
||||
|
||||
'search.offline': 'インターネットに接続されていません。検索にはネット接続が必要です。',
|
||||
'search.openSettings': '設定を開く',
|
||||
'search.privacy': '{source}に送信されるのは検索したタイトルだけです。ライブラリはスマホに残ります。',
|
||||
|
||||
'catalog.sortRecent': '最近の更新順',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': '추가됨',
|
||||
|
||||
'search.offline': '인터넷에 연결되어 있지 않아요. 검색하려면 네트워크가 필요해요.',
|
||||
'search.openSettings': '설정 열기',
|
||||
'search.privacy': '검색한 제목만 {source}(으)로 전송돼요. 라이브러리는 휴대폰에 그대로 남아요.',
|
||||
|
||||
'catalog.sortRecent': '최근 수정순',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Toegevoegd',
|
||||
|
||||
'search.offline': 'Geen internetverbinding: zoeken werkt alleen online.',
|
||||
'search.openSettings': 'Instellingen openen',
|
||||
'search.privacy': 'Alleen de gezochte titel wordt naar {source} gestuurd. Je bibliotheek blijft op je telefoon.',
|
||||
|
||||
'catalog.sortRecent': 'Recent bewerkt',
|
||||
|
||||
@@ -491,7 +491,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Dodano',
|
||||
|
||||
'search.offline': 'Brak połączenia z internetem: wyszukiwanie wymaga sieci.',
|
||||
'search.openSettings': 'Otwórz Ustawienia',
|
||||
'search.privacy': 'Do {source} wysyłany jest tylko wyszukiwany tytuł. Twoja biblioteka zostaje na twoim telefonie.',
|
||||
|
||||
'catalog.sortRecent': 'Ostatnio edytowane',
|
||||
@@ -693,6 +692,8 @@ const dict: Translations = {
|
||||
'notif.followAccepted': '{name} zaakceptował(a) twoją prośbę',
|
||||
'notif.unread_one': '{count} nowe powiadomienie',
|
||||
'notif.unread_other': '{count} nowych powiadomień',
|
||||
'notif.unread_few': '{count} nowe powiadomienia',
|
||||
'notif.unread_many': '{count} nowych powiadomień',
|
||||
'social.accept': 'Akceptuj',
|
||||
'social.decline': 'Odrzuć',
|
||||
'social.removeFollower': 'Usuń',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Adicionado',
|
||||
|
||||
'search.offline': 'Sem conexão com a internet: a busca precisa de rede.',
|
||||
'search.openSettings': 'Abrir Ajustes',
|
||||
'search.privacy': 'Só o título buscado é enviado para {source}. Sua biblioteca fica no seu celular.',
|
||||
|
||||
'catalog.sortRecent': 'Editados recentemente',
|
||||
|
||||
@@ -491,7 +491,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Добавлено',
|
||||
|
||||
'search.offline': 'Нет подключения к интернету: для поиска нужна сеть.',
|
||||
'search.openSettings': 'Открыть настройки',
|
||||
'search.privacy': 'В {source} отправляется только название, которое ты ищешь. Твоя библиотека остаётся на телефоне.',
|
||||
|
||||
'catalog.sortRecent': 'Недавно изменённые',
|
||||
@@ -693,6 +692,8 @@ const dict: Translations = {
|
||||
'notif.followAccepted': '{name} принял(а) твой запрос',
|
||||
'notif.unread_one': '{count} новое уведомление',
|
||||
'notif.unread_other': 'Новых уведомлений: {count}',
|
||||
'notif.unread_few': '{count} новых уведомления',
|
||||
'notif.unread_many': '{count} новых уведомлений',
|
||||
'social.accept': 'Принять',
|
||||
'social.decline': 'Отклонить',
|
||||
'social.removeFollower': 'Удалить',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'เพิ่มแล้ว',
|
||||
|
||||
'search.offline': 'ไม่มีการเชื่อมต่ออินเทอร์เน็ต การค้นหาต้องใช้เครือข่าย',
|
||||
'search.openSettings': 'เปิดตั้งค่า',
|
||||
'search.privacy': 'จะส่งเฉพาะชื่อเรื่องที่ค้นหาไปยัง {source} เท่านั้น คลังของคุณยังอยู่ในโทรศัพท์ของคุณ',
|
||||
|
||||
'catalog.sortRecent': 'แก้ไขล่าสุด',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Eklendi',
|
||||
|
||||
'search.offline': 'İnternet bağlantısı yok: arama için ağ gerekli.',
|
||||
'search.openSettings': 'Ayarlar’ı aç',
|
||||
'search.privacy': 'Yalnızca aradığın başlık {source} servisine gönderilir. Kütüphanen telefonunda kalır.',
|
||||
|
||||
'catalog.sortRecent': 'Son düzenlenenler',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': 'Đã thêm',
|
||||
|
||||
'search.offline': 'Không có kết nối internet: tìm kiếm cần có mạng.',
|
||||
'search.openSettings': 'Mở Cài đặt',
|
||||
'search.privacy': 'Chỉ tên phim bạn tìm được gửi tới {source}. Thư viện của bạn vẫn nằm trên điện thoại.',
|
||||
|
||||
'catalog.sortRecent': 'Sửa gần đây',
|
||||
|
||||
@@ -459,7 +459,6 @@ const dict: Translations = {
|
||||
'reco.addedShort': '已添加',
|
||||
|
||||
'search.offline': '没有网络连接:搜索需要联网。',
|
||||
'search.openSettings': '打开「设置」',
|
||||
'search.privacy': '只有搜索的标题会发送给 {source}。你的片库仍保留在手机上。',
|
||||
|
||||
'catalog.sortRecent': '最近修改',
|
||||
|
||||
@@ -58,7 +58,8 @@ let current: Session | null = load()
|
||||
const listeners = new Set<(s: Session | null) => void>()
|
||||
|
||||
function setSession(s: Session | null) {
|
||||
const changedUser = current?.user.id !== s?.user.id
|
||||
// Changement de compte, ou nouveau jeton (renouvellement, code de double authentification validé)
|
||||
const changed = current?.user.id !== s?.user.id || current?.accessToken !== s?.accessToken
|
||||
current = s
|
||||
try {
|
||||
if (s) localStorage.setItem(KEY, JSON.stringify(s))
|
||||
@@ -66,7 +67,7 @@ function setSession(s: Session | null) {
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
if (changedUser) for (const fn of listeners) fn(s)
|
||||
if (changed) for (const fn of listeners) fn(s)
|
||||
}
|
||||
|
||||
// Connexion / déconnexion dans un autre onglet
|
||||
|
||||
+3
-3
@@ -10,15 +10,15 @@ import { episodeCap, episodesBeforeSeason } from './franchise'
|
||||
/** 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 à l'étoile entière (valeur stockée sur 10). */
|
||||
/** Moyenne des saisons notées, arrondie à la demi-étoile (valeur stockée sur 10). */
|
||||
export function seasonsAverage(ratings: MediaItem['seasonRatings']): 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 Math.max(2, Math.round(avg / 2) * 2)
|
||||
// Une demi-étoile = 1 point sur 10
|
||||
return Math.max(1, Math.round(avg))
|
||||
}
|
||||
|
||||
/** Saisons entièrement vues pour un nombre d'épisodes donné (1 = première). */
|
||||
|
||||
@@ -133,7 +133,7 @@ export default function CatalogPage({ onOpen, onAdd }: Props) {
|
||||
const io = new IntersectionObserver((e) => e[0]?.isIntersecting && setGridCount((n) => n + GRID_STEP), { rootMargin: '1200px 0px' })
|
||||
io.observe(el)
|
||||
return () => io.disconnect()
|
||||
}, [gridCount, results.length])
|
||||
}, [gridCount, results.length, view])
|
||||
const selected = useMemo(() => (selection ? items.filter((i) => selection.has(i.id)) : []), [items, selection])
|
||||
const allShownSelected = selecting && results.length > 0 && results.every((i) => selection.has(i.id))
|
||||
|
||||
|
||||
+8
-4
@@ -55,7 +55,8 @@ interface MediaStore {
|
||||
update: (id: string, patch: Partial<MediaInput>) => Promise<void>
|
||||
remove: (id: string) => 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>
|
||||
/** false : double tap ignoré */
|
||||
incrementEpisode: (id: string, delta?: number) => Promise<Completion | false | 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>
|
||||
@@ -403,9 +404,12 @@ export function MediaProvider({
|
||||
const lastIncrement = useRef(new Map<string, number>())
|
||||
const incrementEpisode = useCallback(
|
||||
async (id: string, delta = 1) => {
|
||||
const now = Date.now()
|
||||
if (now - (lastIncrement.current.get(id) ?? 0) < 400) return
|
||||
lastIncrement.current.set(id, now)
|
||||
if (delta > 0) {
|
||||
const now = Date.now()
|
||||
// false : tap ignoré (rien n'a changé), à ne pas confondre avec « pas de saison terminée »
|
||||
if (now - (lastIncrement.current.get(id) ?? 0) < 400) return false as const
|
||||
lastIncrement.current.set(id, now)
|
||||
}
|
||||
const item = itemsRef.current.find((i) => i.id === id)
|
||||
if (!item) return
|
||||
// Revisionnage : on avance sa propre progression (le premier visionnage ne bouge pas)
|
||||
|
||||
Reference in new issue
Block a user