Audit : corrections de bugs, sécurité et performances (sans changement de fonctionnement)
Données et synchro - Import « remplacer » atomique (plus de bibliothèque vidée si l'écriture échoue). - Deux onglets sur le même compte : mise à jour croisée, file d'envoi partagée sans perte. - Réception : une modification locale faite pendant la synchro n'est plus écrasée ; une seule transaction. - Envoi : file vidée paquet par paquet, fiche invalide isolée (quota : gardée en attente), taille en octets réels, délai proportionnel à la taille ; grandes affiches décodées sans fetch (bloqué par la CSP). - Plus d'écriture dans la base d'un autre compte après déconnexion ; base fermée proprement (iOS). - Revisionnages journalisés à part (rewatchLog) : les défis ne sous-estiment plus le 1er visionnage ; décocher des épisodes un autre jour ne gonfle plus les défis. Comptes et social - Renouvellement de session : plus de déconnexion de tous les onglets avec un jeton déjà utilisé, plus de rafale de renouvellements, déconnexion qui révoque bien la session serveur. - Délais maximum sur les appels réseau, écran blanc évité au retour de Google. - Abonnés/abonnements au-delà de 50, pagination du fil et des profils, fil hors-ligne, listes bloquées. - Code mort retiré (CommentsSheet et options jamais utilisées). Interface et logique - Toast qui ne disparaissait plus, focus sur « Annuler » dans les confirmations, Échap pendant la saisie IME. - Demi-étoile en arabe, flèches RTL, fonds d'overlay en jeton de thème, couleur du thème étoilé. - Séries en cours sans total connu : les nouveaux épisodes se cochent à nouveau ; épisodes spéciaux ignorés. - Catalogue, accueil et calendrier plus rapides sur les grosses bibliothèques. Sources externes - Proxy TMDB : les 18 langues acceptées (9 étaient refusées), 429 transmis, délais, paramètres durcis. - Contenus adultes AniList filtrés des recommandations, cache d'import borné, imports plus sûrs. Serveur (migration 20261122140000_audit_hardening.sql, déjà appliquée en ligne) - Fonctions admin et « comptes suspendus » versionnées ; blocage effectif ; avis robustes ; fiches supprimées vidées ; comptes suspendus sans abonnement ni réaction ; objets morts supprimés. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
73 files changed
+2074
-2162
No files matched your search
@@ -39,6 +39,8 @@ export default function AccountSection({ account, onMessage }: { account: Accoun
|
||||
try {
|
||||
const r = await account.logout(force)
|
||||
if (r === 'pending') setConfirmLogout(true)
|
||||
} catch (err) {
|
||||
onMessage('error', (err as Error).message)
|
||||
} finally {
|
||||
setBusy(null)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { t } from '../i18n'
|
||||
import { LanguageSelect } from '../i18n/react'
|
||||
import { Eye, EyeOff, Loader2 } from 'lucide-react'
|
||||
import { useState, type FormEvent, type ReactNode } from 'react'
|
||||
import { useEffect, useState, type FormEvent, type ReactNode } from 'react'
|
||||
import { PASSWORD_MIN, requestPasswordReset, signIn, signInWithGoogle, signUp, updatePassword } from '../lib/cloud/auth'
|
||||
import { USERNAME_RE } from '../lib/cloud/social'
|
||||
import { cx } from '../lib/utils'
|
||||
@@ -61,6 +61,15 @@ export default function AuthScreen({ notice, onExplore, initialMode = 'login' }:
|
||||
const cleanUsername = username.trim().replace(/^@/, '').toLowerCase()
|
||||
const usernameOk = USERNAME_RE.test(cleanUsername) && !RANDOM_USERNAME.test(cleanUsername)
|
||||
|
||||
// Retour arrière depuis Google (page restaurée du cache) : les boutons ne restent pas bloqués
|
||||
useEffect(() => {
|
||||
const onShow = (e: PageTransitionEvent) => {
|
||||
if (e.persisted) setBusy(false)
|
||||
}
|
||||
window.addEventListener('pageshow', onShow)
|
||||
return () => window.removeEventListener('pageshow', onShow)
|
||||
}, [])
|
||||
|
||||
const switchTo = (m: Mode) => {
|
||||
setMode(m)
|
||||
setError(undefined)
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Check, ChevronLeft, ChevronRight, Loader2, Plus, RefreshCw, X } from 'l
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { loadAiring, refreshAiring, saveAiring } from '../lib/airing'
|
||||
import { findTmdbSeries, getAniListById, getTmdbDetails, releaseToResult, type GlobalRelease, type ReleaseCategory } from '../lib/catalogApi'
|
||||
import { findFranchiseItem } from '../lib/franchise'
|
||||
import { franchiseKey } from '../lib/franchise'
|
||||
import { cachedMonth, isBrowsableMonth, loadMonth, RELEASE_CATEGORIES } from '../lib/globalReleases'
|
||||
import { remotePosterToLocal } from '../lib/image'
|
||||
import { calendarEvents, loadReleases, refreshReleases } from '../lib/releases'
|
||||
@@ -13,6 +13,7 @@ import { useEscape } from '../lib/escape'
|
||||
import { useScrollLock } from '../lib/scrollLock'
|
||||
import { cx, normalizeText, todayISO } from '../lib/utils'
|
||||
import { useMedia } from '../store'
|
||||
import { TYPE_BY_VALUE } from '../lib/constants'
|
||||
import type { MediaInput, MediaItem, MediaType } from '../types'
|
||||
import { TypeBadge } from './Badges'
|
||||
import Poster from './Poster'
|
||||
@@ -21,6 +22,11 @@ import Poster from './Poster'
|
||||
const weekdays = () => Array.from({ length: 7 }, (_, k) => new Date(2024, 0, 1 + k).toLocaleDateString(locale(), { weekday: 'narrow' }))
|
||||
const PER_DAY = 20
|
||||
const PREFS_KEY = 'azuucine:calendar-prefs'
|
||||
/** Jour local décalé de n jours (sans « + n × 24 h », faux aux changements d'heure). */
|
||||
const plusDays = (n: number) => {
|
||||
const d = new Date()
|
||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate() + n)
|
||||
}
|
||||
const iso = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`
|
||||
const monthId = (d: Date) => iso(d).slice(0, 7)
|
||||
const niceDate = (d: string) => new Date(d + 'T12:00:00').toLocaleDateString(locale(), { weekday: 'long', day: 'numeric', month: 'long' })
|
||||
@@ -132,8 +138,9 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
const [airing, rel] = await Promise.all([refreshAiring(items, loadAiring(), settings.tmdbKey, force), refreshReleases(items, settings.tmdbKey, force)])
|
||||
saveAiring(airing)
|
||||
setReleases(rel)
|
||||
// Comme à l'accueil : aussi les fiches « Terminé » dont la série continue (statut inchangé)
|
||||
const patches = items
|
||||
.filter((i) => i.status !== 'termine' && airing[i.id] && airing[i.id].aired > (i.episodesTotal ?? 0))
|
||||
.filter((i) => airing[i.id] && (i.status !== 'termine' || !airing[i.id].ended) && airing[i.id].aired > (i.episodesTotal ?? 0))
|
||||
.map((i) => ({ id: i.id, patch: { episodesTotal: airing[i.id].aired } }))
|
||||
if (patches.length) await patchMany(patches)
|
||||
} finally {
|
||||
@@ -194,6 +201,32 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
for (const i of items) for (const t of [i.title, i.originalTitle]) if (t) m.set(normalizeText(t), i)
|
||||
return m
|
||||
}, [items])
|
||||
// Même série, autre saison (comme findFranchiseItem) : index calculé une fois par bibliothèque,
|
||||
// au lieu de parcourir toute la bibliothèque pour chaque sortie
|
||||
const byFranchise = useMemo(() => {
|
||||
const m = new Map<string, { item: MediaItem; index: number }>()
|
||||
items.forEach((item, index) => {
|
||||
if (!TYPE_BY_VALUE[item.type]?.episodic) return
|
||||
for (const x of [item.title, item.originalTitle]) {
|
||||
const k = x && franchiseKey(x)
|
||||
if (k && k.length >= 2 && !m.has(k)) m.set(k, { item, index })
|
||||
}
|
||||
})
|
||||
return m
|
||||
}, [items])
|
||||
const franchiseItem = useCallback(
|
||||
(titles: (string | undefined)[], type: MediaType) => {
|
||||
if (!TYPE_BY_VALUE[type]?.episodic) return undefined
|
||||
let best: { item: MediaItem; index: number } | undefined
|
||||
for (const x of titles) {
|
||||
const k = x && franchiseKey(x)
|
||||
const hit = k && k.length >= 2 ? byFranchise.get(k) : undefined
|
||||
if (hit && (!best || hit.index < best.index)) best = hit
|
||||
}
|
||||
return best?.item
|
||||
},
|
||||
[byFranchise],
|
||||
)
|
||||
|
||||
const entries = useMemo(() => {
|
||||
const map = new Map<string, Entry>()
|
||||
@@ -208,7 +241,7 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
byTitle.get(normalizeText(r.title)) ??
|
||||
(r.originalTitle ? byTitle.get(normalizeText(r.originalTitle)) : undefined) ??
|
||||
// « Black Clover Season 2 » sur AniList = ma fiche « Black Clover »
|
||||
(r.cat !== 'film' ? findFranchiseItem(items, [r.title, r.originalTitle], { type: r.cat }) : undefined)
|
||||
(r.cat !== 'film' ? franchiseItem([r.title, r.originalTitle], r.cat) : undefined)
|
||||
map.set(key, {
|
||||
key,
|
||||
date: r.date,
|
||||
@@ -226,11 +259,15 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
.filter((e) => (prefs.mode === 'mine' ? !!e.item : true))
|
||||
.filter((e) => e.type === 'autre' || cats.has(e.type))
|
||||
.sort((a, b) => a.date.localeCompare(b.date) || b.pop - a.pop || a.title.localeCompare(b.title, locale()))
|
||||
}, [items, releases, global, byExt, byTitle, prefs])
|
||||
}, [items, releases, global, byExt, byTitle, franchiseItem, prefs])
|
||||
|
||||
const byDay = useMemo(() => {
|
||||
const m = new Map<string, Entry[]>()
|
||||
for (const e of entries) m.set(e.date, [...(m.get(e.date) ?? []), e])
|
||||
for (const e of entries) {
|
||||
const list = m.get(e.date)
|
||||
if (list) list.push(e)
|
||||
else m.set(e.date, [e])
|
||||
}
|
||||
return m
|
||||
}, [entries])
|
||||
|
||||
@@ -248,9 +285,9 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
const mid = monthId(month)
|
||||
const isCurrent = mid === today.slice(0, 7)
|
||||
// Mois en cours : les 14 prochains jours (même s'ils débordent sur le mois suivant) ; sinon tout le mois
|
||||
const lastDay = isCurrent ? iso(new Date(Date.now() + 13 * 86400000)) : `${mid}-31`
|
||||
const lastDay = isCurrent ? iso(plusDays(13)) : `${mid}-31`
|
||||
const days = [...byDay.keys()].filter((d) => (isCurrent ? d >= today : d.startsWith(mid)) && d <= lastDay).sort()
|
||||
const tomorrow = iso(new Date(Date.now() + 86400000))
|
||||
const tomorrow = iso(plusDays(1))
|
||||
const dayTitle = (d: string) => (d === today ? t('time.today') : d === tomorrow ? t('time.tomorrow') : niceDate(d))
|
||||
|
||||
const changeMonth = (delta: number) => {
|
||||
@@ -318,7 +355,7 @@ export default function CalendarView({ onClose, onOpen }: { onClose: () => void;
|
||||
</div>
|
||||
{list.length > shown.length && (
|
||||
<button onClick={() => setExpanded((s) => new Set(s).add(day))} className="mt-1 w-full py-2 text-xs font-medium text-ink-3">
|
||||
{t('calendar.seeMore', { count: list.length - shown.length })} <span className="text-accent">→</span>
|
||||
{t('calendar.seeMore', { count: list.length - shown.length })} <span className="inline-block text-accent rtl:-scale-x-100">→</span>
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useId } from 'react'
|
||||
import { t } from '../i18n'
|
||||
import { useBackToClose } from '../lib/backNav'
|
||||
import { useEscape } from '../lib/escape'
|
||||
@@ -15,26 +16,27 @@ interface Props {
|
||||
export default function ConfirmDialog({ open, title, message, confirmLabel = t('common.confirm'), onConfirm, onCancel }: Props) {
|
||||
useEscape(onCancel, open)
|
||||
useBackToClose(onCancel, open)
|
||||
const titleId = useId()
|
||||
|
||||
if (!open) return null
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-black/70 p-4 sm:items-center" onClick={onCancel}>
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-scrim p-4 sm:items-center" onClick={onCancel}>
|
||||
<div
|
||||
role="alertdialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="confirm-title"
|
||||
aria-labelledby={titleId}
|
||||
className="sheet-in safe-bottom w-full max-w-sm rounded-3xl border border-line-strong bg-surface p-5"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<h2 id="confirm-title" className="text-lg">
|
||||
<h2 id={titleId} className="text-lg">
|
||||
{title}
|
||||
</h2>
|
||||
{message && <p className="mt-2 text-sm leading-relaxed text-ink-2">{message}</p>}
|
||||
<div className="mt-5 grid grid-cols-2 gap-2">
|
||||
<button onClick={onCancel} className="btn btn-ghost">
|
||||
<button onClick={onCancel} className="btn btn-ghost" autoFocus>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button onClick={onConfirm} className="btn btn-primary" autoFocus>
|
||||
<button onClick={onConfirm} className="btn btn-primary">
|
||||
{confirmLabel}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,10 @@ export default function EpisodeList({ form, aired, onChange }: Props) {
|
||||
|
||||
// Taille de la saison affichée (ou de toute la série si on ne connaît pas le découpage)
|
||||
const before = seasons ? episodesBeforeSeason(seasons, viewSeason) : 0
|
||||
const size = seasons ? (seasons[viewSeason - 1] ?? 0) : Math.min(episodeCap(form) ?? 0, MAX_GENERIC)
|
||||
// Total enregistré plus grand que la somme des saisons : le surplus va à la dernière saison
|
||||
// (sinon les derniers épisodes ne pouvaient jamais être cochés)
|
||||
const extra = seasons && viewSeason === seasons.length ? Math.max(0, (episodeCap(form) ?? 0) - episodesBeforeSeason(seasons, seasons.length + 1)) : 0
|
||||
const size = seasons ? Math.min((seasons[viewSeason - 1] ?? 0) + extra, MAX_GENERIC) : Math.min(episodeCap(form) ?? 0, MAX_GENERIC)
|
||||
|
||||
useEffect(() => {
|
||||
if (!isTmdb || !navigator.onLine) return setEpisodes(undefined)
|
||||
|
||||
@@ -43,7 +43,11 @@ export default function JournalView({ onOpen }: { onOpen: (item: MediaItem) => v
|
||||
const months = useMemo(() => {
|
||||
const list = year ? entries.filter((e) => e.date.startsWith(year)) : entries
|
||||
const map = new Map<string, Entry[]>()
|
||||
for (const e of list) map.set(e.date.slice(0, 7), [...(map.get(e.date.slice(0, 7)) ?? []), e])
|
||||
for (const e of list) {
|
||||
const month = map.get(e.date.slice(0, 7))
|
||||
if (month) month.push(e)
|
||||
else map.set(e.date.slice(0, 7), [e])
|
||||
}
|
||||
return [...map.entries()]
|
||||
}, [entries, year])
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ function ListDetail({ list, onBack, onOpen }: { list: CustomList; onBack: () =>
|
||||
return (
|
||||
<>
|
||||
<button onClick={onBack} className="mt-2 flex items-center gap-1.5 text-sm text-ink-3">
|
||||
<ArrowLeft size={16} /> {t('lists.myLists')}
|
||||
<ArrowLeft size={16} className="rtl:rotate-180" /> {t('lists.myLists')}
|
||||
</button>
|
||||
|
||||
<div className="mb-5 mt-3 flex items-start justify-between gap-3">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { t } from '../i18n'
|
||||
import { Heart, Plus } from 'lucide-react'
|
||||
import { memo } from 'react'
|
||||
import { TYPE_BY_VALUE } from '../lib/constants'
|
||||
import { canWatchMore } from '../lib/airing'
|
||||
import { episodeCap, seasonPosition } from '../lib/franchise'
|
||||
@@ -36,8 +37,12 @@ function Progress({ item }: { item: MediaItem }) {
|
||||
)
|
||||
}
|
||||
|
||||
/** Carte verticale (grille du catalogue). */
|
||||
export function MediaCard({ item, onOpen }: { item: MediaItem; onOpen: (item: MediaItem) => void }) {
|
||||
/**
|
||||
* Carte verticale (grille du catalogue).
|
||||
* Mémorisée : taper dans la recherche ou cocher une fiche ne redessine plus toute la grille
|
||||
* (elle se redessine quand même si la bibliothèque ou les réglages changent, via useMedia).
|
||||
*/
|
||||
export const MediaCard = memo(function MediaCard({ item, onOpen }: { item: MediaItem; onOpen: (item: MediaItem) => void }) {
|
||||
const { settings, incrementEpisode } = useMedia()
|
||||
// Revisionnage en cours : la progression montrée est celle du revisionnage
|
||||
const view = progressView(item)
|
||||
@@ -76,4 +81,4 @@ export function MediaCard({ item, onOpen }: { item: MediaItem; onOpen: (item: Me
|
||||
</button>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -62,7 +62,10 @@ export function RatingInput({ value, onChange, scale, size = 'lg', label }: Inpu
|
||||
const pick = (e: MouseEvent<HTMLButtonElement>, index: number) => {
|
||||
const rect = e.currentTarget.getBoundingClientRect()
|
||||
// Clavier (Entrée / Espace) : pas de position de clic, on donne l'étoile entière
|
||||
const half = e.detail !== 0 && e.clientX - rect.left < rect.width / 2
|
||||
// En arabe (RTL), l'étoile se remplit depuis la droite : la demi-étoile est la moitié droite
|
||||
const rtl = getComputedStyle(e.currentTarget).direction === 'rtl'
|
||||
const fromStart = rtl ? rect.right - e.clientX : e.clientX - rect.left
|
||||
const half = e.detail !== 0 && fromStart < rect.width / 2
|
||||
const next = (index + (half ? 0.5 : 1)) * 2
|
||||
onChange(next === value ? undefined : next) // retoucher la même valeur efface la note
|
||||
}
|
||||
|
||||
@@ -4,9 +4,10 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
import { aniListRecommendations, getTmdbDetails, searchAniList, tmdbRecommendations, type SearchResult } from '../lib/catalogApi'
|
||||
import { remotePosterToLocal } from '../lib/image'
|
||||
import { normalizeText } from '../lib/utils'
|
||||
import { useMedia } from '../store'
|
||||
import { GuestError, useMedia } from '../store'
|
||||
import type { MediaInput, MediaItem } from '../types'
|
||||
import Poster from './Poster'
|
||||
import { useToast } from './Toast'
|
||||
import { LinkArrow, SectionTitle } from './ui'
|
||||
|
||||
// Cache en mémoire le temps de la session (évite de refaire les requêtes)
|
||||
@@ -33,6 +34,7 @@ async function recommendationsFor(seed: MediaItem, tmdbKey?: string): Promise<Se
|
||||
/** « Si tu as aimé X » : suggestions à partir de mes titres préférés, ajoutables en un clic. */
|
||||
export default function Recommendations() {
|
||||
const { items, settings, add } = useMedia()
|
||||
const toast = useToast()
|
||||
const hasKey = !!settings.tmdbKey?.trim()
|
||||
|
||||
// Titres « graines » : mes préférés, dans un ordre aléatoire fixé pour la session
|
||||
@@ -104,6 +106,9 @@ export default function Recommendations() {
|
||||
}
|
||||
await add(input)
|
||||
setAdded((s) => new Set(s).add(r.externalId))
|
||||
} catch (e) {
|
||||
// Hors ligne, TMDB injoignable, stockage plein… : on le dit (mode visiteur : déjà signalé ailleurs)
|
||||
if (!(e instanceof GuestError)) toast.show((e as Error)?.message || t('reco.error'))
|
||||
} finally {
|
||||
setBusy(undefined)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useEffect, useMemo, useState } from 'react'
|
||||
import { shareImage } from '../lib/shareCard'
|
||||
import { useBackToClose } from '../lib/backNav'
|
||||
import { useEscape } from '../lib/escape'
|
||||
import { useScrollLock } from '../lib/scrollLock'
|
||||
|
||||
interface Props {
|
||||
blob: Blob
|
||||
@@ -30,6 +31,7 @@ export default function SharePreview({ blob, filename, title, onClose }: Props)
|
||||
setUrl(u)
|
||||
return () => URL.revokeObjectURL(u)
|
||||
}, [blob])
|
||||
useScrollLock()
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
|
||||
|
||||
@@ -9,13 +9,10 @@ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, use
|
||||
export interface ToastOptions {
|
||||
/** Bouton « Annuler » : remet les choses comme avant. */
|
||||
undo?: () => void | Promise<void>
|
||||
/** Durée d'affichage en ms (6 s avec « Annuler », 3 s sinon). */
|
||||
duration?: number
|
||||
}
|
||||
|
||||
interface ToastApi {
|
||||
show: (message: string, opts?: ToastOptions) => void
|
||||
dismiss: () => void
|
||||
}
|
||||
|
||||
interface ToastState extends ToastOptions {
|
||||
@@ -35,7 +32,7 @@ export function ToastProvider({ children }: { children: ReactNode }) {
|
||||
setToast({ id: seq.current, message, ...opts })
|
||||
}, [])
|
||||
|
||||
const api = useMemo(() => ({ show, dismiss }), [show, dismiss])
|
||||
const api = useMemo(() => ({ show }), [show])
|
||||
|
||||
return (
|
||||
<ToastContext.Provider value={api}>
|
||||
@@ -49,7 +46,7 @@ export function ToastProvider({ children }: { children: ReactNode }) {
|
||||
export function useToast(): ToastApi {
|
||||
return useContext(ToastContext) ?? NOOP
|
||||
}
|
||||
const NOOP: ToastApi = { show: () => {}, dismiss: () => {} }
|
||||
const NOOP: ToastApi = { show: () => {} }
|
||||
|
||||
function ToastViewport({ toast, onDismiss, onShow }: { toast: ToastState | null; onDismiss: () => void; onShow: ToastApi['show'] }) {
|
||||
const [paused, setPaused] = useState(false)
|
||||
@@ -57,10 +54,12 @@ function ToastViewport({ toast, onDismiss, onShow }: { toast: ToastState | null;
|
||||
const remaining = useRef(0)
|
||||
const startedAt = useRef(0)
|
||||
|
||||
// Nouveau message : compte à rebours complet
|
||||
// Nouveau message : compte à rebours complet. La pause est remise à zéro : un message fermé
|
||||
// sous le doigt / la souris ne reçoit jamais « pointerleave », et les suivants ne partaient plus.
|
||||
useEffect(() => {
|
||||
setPaused(false)
|
||||
if (!toast) return
|
||||
remaining.current = toast.duration ?? (toast.undo ? 6000 : 3000)
|
||||
remaining.current = toast.undo ? 6000 : 3000
|
||||
setUndoing(false)
|
||||
}, [toast])
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import { ChevronDown, ChevronUp, Search, X } from 'lucide-react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { TOP_CATEGORIES } from '../lib/constants'
|
||||
import { cx, formatRating, normalizeText } from '../lib/utils'
|
||||
import { useMedia } from '../store'
|
||||
import { GuestError, useMedia } from '../store'
|
||||
import { useToast } from './Toast'
|
||||
import type { TopCategory } from '../types'
|
||||
import { TypeBadge } from './Badges'
|
||||
import Poster from './Poster'
|
||||
@@ -29,6 +30,7 @@ export default function TopFiveEditor({ category: initialCategory, onClose }: Pr
|
||||
const [query, setQuery] = useState('')
|
||||
const [allTypes, setAllTypes] = useState(false)
|
||||
const [saving, setSaving] = useState(false)
|
||||
const toast = useToast()
|
||||
const catInfo = TOP_CATEGORIES.find((c) => c.value === category)!
|
||||
const byId = useMemo(() => new Map(items.map((i) => [i.id, i])), [items])
|
||||
|
||||
@@ -66,9 +68,15 @@ export default function TopFiveEditor({ category: initialCategory, onClose }: Pr
|
||||
|
||||
const save = async () => {
|
||||
setSaving(true)
|
||||
await setTopList(category, ids)
|
||||
setSaving(false)
|
||||
onClose()
|
||||
// Échec (hors-ligne, mode découverte…) : le bouton ne reste pas bloqué et la fenêtre reste ouverte
|
||||
try {
|
||||
await setTopList(category, ids)
|
||||
onClose()
|
||||
} catch (e) {
|
||||
if (!(e instanceof GuestError)) toast.show((e as Error).message)
|
||||
} finally {
|
||||
setSaving(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { t } from '../../i18n'
|
||||
import { Check } from 'lucide-react'
|
||||
import { useRef, type ReactNode } from 'react'
|
||||
import { useEffect, useRef, type ReactNode } from 'react'
|
||||
import { cx } from '../../lib/utils'
|
||||
|
||||
interface Props {
|
||||
@@ -32,6 +32,9 @@ export default function SelectableCard({ title, selecting, selected, onToggle, o
|
||||
origin.current = undefined
|
||||
}
|
||||
|
||||
// Carte retirée pendant l'appui (filtre, suppression…) : le minuteur ne doit plus se déclencher
|
||||
useEffect(() => () => clearTimeout(timer.current), [])
|
||||
|
||||
return (
|
||||
<div
|
||||
className="group relative select-none [-webkit-touch-callout:none]"
|
||||
|
||||
@@ -5,12 +5,14 @@ import { useBackToClose } from '../../lib/backNav'
|
||||
import { allTags, cleanTag, hasTag } from '../../lib/bulk'
|
||||
import { STATUSES } from '../../lib/constants'
|
||||
import { useEscape } from '../../lib/escape'
|
||||
import { useScrollLock } from '../../lib/scrollLock'
|
||||
import { cx, normalizeText } from '../../lib/utils'
|
||||
import { useMedia } from '../../store'
|
||||
import { GuestError, useMedia } from '../../store'
|
||||
import type { MediaItem, WatchStatus } from '../../types'
|
||||
import { StatusDot } from '../Badges'
|
||||
import ConfirmDialog from '../ConfirmDialog'
|
||||
import { NewListForm } from '../ListsView'
|
||||
import { useToast } from '../Toast'
|
||||
import { useLibraryActions } from './useLibraryActions'
|
||||
|
||||
type Panel = null | 'status' | 'list' | 'tag' | 'delete'
|
||||
@@ -29,10 +31,18 @@ export default function SelectionBar({ selected, onDone }: Props) {
|
||||
const ids = selected.map((i) => i.id)
|
||||
const none = selected.length === 0
|
||||
|
||||
const toast = useToast()
|
||||
const run = async (fn: () => Promise<void>) => {
|
||||
setPanel(null)
|
||||
await fn()
|
||||
onDone()
|
||||
// Même en cas d'échec, la sélection se ferme (sinon la barre restait bloquée)
|
||||
try {
|
||||
await fn()
|
||||
} catch (e) {
|
||||
// Mode découverte : la demande de compte est déjà ouverte
|
||||
if (!(e instanceof GuestError)) toast.show((e as Error).message)
|
||||
} finally {
|
||||
onDone()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -95,10 +105,11 @@ function BarButton({ icon, label, onClick, disabled, danger }: { icon: ReactNode
|
||||
|
||||
/** Petite feuille en bas de l'écran ; Échap ou le geste retour la ferment sans quitter la sélection. */
|
||||
function PickerSheet({ title, onClose, children }: { title: string; onClose: () => void; children: ReactNode }) {
|
||||
useScrollLock()
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-black/70 sm:items-center" onClick={onClose}>
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-scrim sm:items-center" onClick={onClose}>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
|
||||
@@ -85,7 +85,7 @@ export default function BugReportDialog({ onClose }: { onClose: () => void }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-[80] flex touch-none items-end justify-center overscroll-none bg-black/70 sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div className="fixed inset-0 z-[80] flex touch-none items-end justify-center overscroll-none bg-scrim sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
|
||||
@@ -12,7 +12,6 @@ export interface MenuAction {
|
||||
icon: ReactNode
|
||||
label: string
|
||||
onClick: () => void
|
||||
danger?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,14 +23,11 @@ export default function ReportButton({
|
||||
actions = [],
|
||||
className,
|
||||
size = 18,
|
||||
label,
|
||||
}: {
|
||||
target: ReportTarget
|
||||
actions?: MenuAction[]
|
||||
className?: string
|
||||
size?: number
|
||||
/** Nom accessible du bouton (par défaut « Plus d'options ») */
|
||||
label?: string
|
||||
}) {
|
||||
const [menu, setMenu] = useState(false)
|
||||
const [report, setReport] = useState(false)
|
||||
@@ -43,7 +39,7 @@ export default function ReportButton({
|
||||
e.stopPropagation()
|
||||
setMenu(true)
|
||||
}}
|
||||
aria-label={label ?? t('report.more')}
|
||||
aria-label={t('report.more')}
|
||||
aria-haspopup="menu"
|
||||
className={cx('grid size-9 shrink-0 place-items-center rounded-full text-ink-3 transition-colors hover:text-ink active:bg-surface-2', className)}
|
||||
>
|
||||
@@ -57,7 +53,6 @@ export default function ReportButton({
|
||||
<MenuItem
|
||||
key={a.label}
|
||||
icon={a.icon}
|
||||
danger={a.danger}
|
||||
onClick={() => {
|
||||
setMenu(false)
|
||||
a.onClick()
|
||||
@@ -89,7 +84,7 @@ function ActionMenu({ onClose, children }: { onClose: () => void; children: Reac
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
return (
|
||||
<div className="fixed inset-0 z-[80] flex items-end justify-center bg-black/70 sm:items-center" onClick={onClose}>
|
||||
<div className="fixed inset-0 z-[80] flex items-end justify-center bg-scrim sm:items-center" onClick={onClose}>
|
||||
<div role="menu" className="sheet-in safe-bottom w-full max-w-md rounded-t-3xl border border-line-strong bg-surface p-3 sm:rounded-3xl" onClick={(e) => e.stopPropagation()}>
|
||||
{children}
|
||||
<button type="button" onClick={onClose} className="mt-1 w-full rounded-xl px-3 py-3 text-center text-sm text-ink-3 active:bg-surface-2">
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function ReportDialog({ target, onClose }: { target: ReportTarget
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-[80] flex touch-none items-end justify-center overscroll-none bg-black/70 sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div className="fixed inset-0 z-[80] flex touch-none items-end justify-center overscroll-none bg-scrim sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { t } from '../../i18n'
|
||||
import { useMedia } from '../../store'
|
||||
import ReviewComments from './ReviewComments'
|
||||
import ReviewText from './ReviewText'
|
||||
import Sheet from './Sheet'
|
||||
|
||||
/** Commentaires sous un de mes avis, en plein écran (ouvert depuis une notification). */
|
||||
export default function CommentsSheet({ authorId, itemId, title, onClose }: { authorId: string; itemId: string; title: string; onClose: () => void }) {
|
||||
const { items } = useMedia()
|
||||
// Mon avis tel qu'il est sur cet appareil (les commentaires viennent du serveur)
|
||||
const mine = items.find((i) => i.id === itemId)
|
||||
return (
|
||||
<Sheet title={title || t('comments.title')} label={t('comments.title')} onClose={onClose} elevated>
|
||||
<div className="px-4 pt-4">
|
||||
{mine?.notes && (
|
||||
<article className="card mb-4 p-3.5">
|
||||
<p className="eyebrow">{t('form.review')}</p>
|
||||
<ReviewText text={mine.notes} spoiler={mine.notesSpoiler} revealed clamp />
|
||||
</article>
|
||||
)}
|
||||
<p className="eyebrow mb-1">{t('comments.title')}</p>
|
||||
<ReviewComments authorId={authorId} itemId={itemId} defaultOpen />
|
||||
</div>
|
||||
</Sheet>
|
||||
)
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Loader2 } from 'lucide-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { t } from '../../i18n'
|
||||
import { acceptFollower, getFollowList, removeFollower, type Profile, type ProfileCard } from '../../lib/cloud/social'
|
||||
import { acceptFollower, FOLLOW_PAGE, getFollowList, removeFollower, type Profile, type ProfileCard } from '../../lib/cloud/social'
|
||||
import { cx } from '../../lib/utils'
|
||||
import { GuestError } from '../../store'
|
||||
import { useToast } from '../Toast'
|
||||
import PersonRow from './PersonRow'
|
||||
import Sheet from './Sheet'
|
||||
import { useSocial } from './SocialProvider'
|
||||
@@ -18,19 +20,53 @@ export default function FollowList({ profile, initial, onClose }: { profile: Pro
|
||||
const tab: Tab = picked === 'requests' && !showRequests ? 'followers' : picked
|
||||
const [list, setList] = useState<ProfileCard[]>()
|
||||
const [busy, setBusy] = useState<string>()
|
||||
const toast = useToast()
|
||||
// Le serveur renvoie les comptes par pages : lignes reçues (décalage de la suivante) et page suivante possible
|
||||
const received = useRef(0)
|
||||
const [more, setMore] = useState(false)
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
// Numéro du dernier chargement : une page arrivée après un changement d'onglet est ignorée
|
||||
const request = useRef(0)
|
||||
|
||||
useEffect(() => {
|
||||
const id = ++request.current
|
||||
received.current = 0
|
||||
setMore(false)
|
||||
setLoadingMore(false)
|
||||
if (tab === 'requests') return setList(social.requests)
|
||||
let alive = true
|
||||
setList(undefined)
|
||||
getFollowList(profile.id, tab)
|
||||
.then((l) => alive && setList(l))
|
||||
.catch(() => alive && setList([]))
|
||||
return () => {
|
||||
alive = false
|
||||
}
|
||||
.then((page) => {
|
||||
if (id !== request.current) return
|
||||
received.current = page.received
|
||||
setList(page.cards)
|
||||
setMore(page.received >= FOLLOW_PAGE)
|
||||
})
|
||||
.catch(() => id === request.current && setList([]))
|
||||
}, [tab, profile.id, social.requests])
|
||||
|
||||
const loadMore = async () => {
|
||||
if (tab === 'requests' || loadingMore) return
|
||||
const id = request.current
|
||||
setLoadingMore(true)
|
||||
try {
|
||||
const page = await getFollowList(profile.id, tab, received.current)
|
||||
if (id !== request.current) return
|
||||
received.current += page.received
|
||||
// Sans doublon (même clé React) si la liste a bougé entre deux pages
|
||||
setList((l) => {
|
||||
const base = l ?? []
|
||||
const seen = new Set(base.map((p) => p.id))
|
||||
return [...base, ...page.cards.filter((p) => !seen.has(p.id) && !!seen.add(p.id))]
|
||||
})
|
||||
setMore(page.received >= FOLLOW_PAGE)
|
||||
} catch (e) {
|
||||
if (id === request.current) toast.show((e as Error).message)
|
||||
} finally {
|
||||
if (id === request.current) setLoadingMore(false)
|
||||
}
|
||||
}
|
||||
|
||||
const act = async (person: ProfileCard, action: 'accept' | 'remove') => {
|
||||
setBusy(person.id)
|
||||
try {
|
||||
@@ -38,6 +74,8 @@ export default function FollowList({ profile, initial, onClose }: { profile: Pro
|
||||
else await removeFollower(person.id)
|
||||
setList((l) => l?.filter((p) => p.id !== person.id))
|
||||
await social.refresh()
|
||||
} catch (e) {
|
||||
if (!(e instanceof GuestError)) toast.show((e as Error).message)
|
||||
} finally {
|
||||
setBusy(undefined)
|
||||
}
|
||||
@@ -92,6 +130,11 @@ export default function FollowList({ profile, initial, onClose }: { profile: Pro
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{list !== undefined && list.length > 0 && more && tab !== 'requests' && (
|
||||
<button onClick={() => void loadMore()} disabled={loadingMore} className="btn btn-ghost mt-3 w-full">
|
||||
{loadingMore ? <Loader2 size={16} className="animate-spin" /> : t('social.loadMore')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</Sheet>
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Loader2, Star, UserPlus } from 'lucide-react'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { t } from '../../i18n'
|
||||
import { getFeed, type FeedEntry } from '../../lib/cloud/social'
|
||||
import { FEED_PAGE, getFeed, type FeedEntry } from '../../lib/cloud/social'
|
||||
import { useOnResume } from '../../lib/onResume'
|
||||
import { timeAgo } from '../../lib/timeAgo'
|
||||
import { formatRating } from '../../lib/utils'
|
||||
@@ -11,6 +11,20 @@ import { LinkArrow, SectionTitle } from '../ui'
|
||||
import Avatar from './Avatar'
|
||||
import { useSocial } from './SocialProvider'
|
||||
|
||||
const feedKey = (e: FeedEntry) => `${e.id}-${e.createdAt}`
|
||||
|
||||
/** Ajoute une page sans doublon (même entrée reçue deux fois = même clé React). */
|
||||
function append(list: FeedEntry[], page: FeedEntry[]): FeedEntry[] {
|
||||
const seen = new Set(list.map(feedKey))
|
||||
const out = [...list]
|
||||
for (const e of page) {
|
||||
if (seen.has(feedKey(e))) continue
|
||||
seen.add(feedKey(e))
|
||||
out.push(e)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
const VERB = { finished: 'feed.finished', started: 'feed.started', rewatched: 'feed.rewatched', added: 'feed.added' } as const
|
||||
|
||||
/** Accueil : ce que regardent mes abonnements. */
|
||||
@@ -21,20 +35,46 @@ export default function FriendsFeed() {
|
||||
const [more, setMore] = useState(false)
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
const [shown, setShown] = useState(6)
|
||||
// Hors-ligne avant le premier chargement : message au lieu d'un chargement sans fin
|
||||
const [offline, setOffline] = useState(false)
|
||||
// Date de la dernière ligne reçue : point de départ de la page suivante
|
||||
const cursor = useRef<string | undefined>(undefined)
|
||||
// Numéro du dernier chargement : une réponse arrivée après un plus récent est ignorée
|
||||
const req = useRef(0)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const id = ++req.current
|
||||
setLoadingMore(false)
|
||||
try {
|
||||
const list = await getFeed()
|
||||
setEntries(list)
|
||||
setMore(list.length >= 30)
|
||||
const page = await getFeed()
|
||||
if (id !== req.current) return
|
||||
cursor.current = page.cursor
|
||||
setEntries(append([], page.entries))
|
||||
setMore(page.received >= FEED_PAGE)
|
||||
setOffline(false)
|
||||
} catch {
|
||||
if (id !== req.current) return
|
||||
// Hors-ligne : on garde ce qui est déjà affiché
|
||||
if (!navigator.onLine) {
|
||||
setOffline(true)
|
||||
return
|
||||
}
|
||||
setEntries([])
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (social.enabled && navigator.onLine) void load()
|
||||
if (!social.enabled) return
|
||||
if (navigator.onLine) void load()
|
||||
else setOffline(true)
|
||||
}, [social.enabled, load])
|
||||
// Réseau retrouvé alors que le fil n'a jamais pu être chargé : on le charge
|
||||
useEffect(() => {
|
||||
if (!social.enabled || !offline) return
|
||||
const on = () => void load()
|
||||
window.addEventListener('online', on)
|
||||
return () => window.removeEventListener('online', on)
|
||||
}, [social.enabled, offline, load])
|
||||
// Retour sur l'app : on récupère ce que les abonnements ont ajouté entre-temps
|
||||
useOnResume(() => void load(), social.enabled)
|
||||
// Abonnement / désabonnement : le fil change aussi
|
||||
@@ -46,23 +86,30 @@ export default function FriendsFeed() {
|
||||
if (!social.enabled) return null
|
||||
|
||||
const loadMore = async () => {
|
||||
if (!entries) return
|
||||
if (!entries || loadingMore) return
|
||||
if (shown < entries.length) return setShown((n) => n + 10)
|
||||
const id = req.current
|
||||
setLoadingMore(true)
|
||||
try {
|
||||
const next = await getFeed(entries[entries.length - 1]?.createdAt)
|
||||
setEntries([...entries, ...next])
|
||||
setMore(next.length >= 30)
|
||||
const page = await getFeed(cursor.current ?? entries[entries.length - 1]?.createdAt)
|
||||
if (id !== req.current) return
|
||||
cursor.current = page.cursor ?? cursor.current
|
||||
setEntries((list) => append(list ?? [], page.entries))
|
||||
setMore(page.received >= FEED_PAGE)
|
||||
setShown((n) => n + 10)
|
||||
} catch {
|
||||
/* hors-ligne / serveur indisponible : le bouton reste là pour réessayer */
|
||||
} finally {
|
||||
setLoadingMore(false)
|
||||
if (id === req.current) setLoadingMore(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionTitle action={<LinkArrow onClick={social.openSearch}>{t('social.findFriends')}</LinkArrow>}>{t('feed.title')}</SectionTitle>
|
||||
{entries === undefined ? (
|
||||
{entries === undefined && offline ? (
|
||||
<p className="text-sm text-ink-3">{t('common.offline')}</p>
|
||||
) : entries === undefined ? (
|
||||
<p className="flex items-center gap-2 text-sm text-ink-3">
|
||||
<Loader2 size={14} className="animate-spin" /> {t('social.loading')}
|
||||
</p>
|
||||
@@ -77,7 +124,7 @@ export default function FriendsFeed() {
|
||||
<>
|
||||
<ul className="divide-y divide-line">
|
||||
{entries.slice(0, shown).map((e) => (
|
||||
<li key={`${e.id}-${e.createdAt}`} className="flex items-center gap-3 py-2.5">
|
||||
<li key={feedKey(e)} className="flex items-center gap-3 py-2.5">
|
||||
<button onClick={() => social.openProfile(e.user.username)} aria-label={e.user.displayName}>
|
||||
<Avatar url={e.user.avatarUrl} name={e.user.displayName} size={36} />
|
||||
</button>
|
||||
|
||||
@@ -7,7 +7,8 @@ import { useScrollLock } from '../../lib/scrollLock'
|
||||
import { titleReviews, type TitleReview } from '../../lib/cloud/reviews'
|
||||
import { useSocial } from './SocialProvider'
|
||||
import { cx, formatDate, formatRating, normalizeText } from '../../lib/utils'
|
||||
import { useMedia } from '../../store'
|
||||
import { GuestError, useMedia } from '../../store'
|
||||
import { useToast } from '../Toast'
|
||||
import type { MediaInput, MediaItem } from '../../types'
|
||||
import { StatusPill, TypeBadge } from '../Badges'
|
||||
import Poster from '../Poster'
|
||||
@@ -30,6 +31,7 @@ export default function ItemPeek({ item, owner, onClose }: { item: MediaItem; ow
|
||||
const social = useSocial()
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [added, setAdded] = useState(false)
|
||||
const toast = useToast()
|
||||
// Avis d'un autre membre : on récupère les réactions pour pouvoir réagir ici même
|
||||
const [review, setReview] = useState<TitleReview>()
|
||||
const canReact = !!owner && owner.username !== social.me?.username && !!item.notes && !!item.externalId
|
||||
@@ -83,13 +85,16 @@ export default function ItemPeek({ item, owner, onClose }: { item: MediaItem; ow
|
||||
}
|
||||
await add(input)
|
||||
setAdded(true)
|
||||
} catch (e) {
|
||||
// Mode découverte : l'invitation à créer un compte est déjà affichée
|
||||
if (!(e instanceof GuestError)) toast.show((e as Error).message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60] flex touch-none items-end justify-center overscroll-none bg-black/70 sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div className="fixed inset-0 z-[60] flex touch-none items-end justify-center overscroll-none bg-scrim sm:items-center sm:p-4" onClick={onClose}>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Ban, Check, Loader2, Lock, Share2, Star, UserCheck, UserPlus } from 'lucide-react'
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { fmtNumber, t } from '../../i18n'
|
||||
import { follow, getProfile, getProfileItems, profileLink, unfollow, type Profile } from '../../lib/cloud/social'
|
||||
import { follow, getProfile, getProfileItems, PROFILE_ITEMS_PAGE, profileLink, unfollow, type Profile } from '../../lib/cloud/social'
|
||||
import { STATUSES, TOP_CATEGORIES } from '../../lib/constants'
|
||||
import { cx, formatRating } from '../../lib/utils'
|
||||
import { useMedia } from '../../store'
|
||||
@@ -64,15 +64,22 @@ export default function ProfileView({ username, onClose }: { username: string; o
|
||||
const { isBlocked } = useBlocked(!!profile && !profile.isMe)
|
||||
const blocked = !!profile && !profile.isMe && isBlocked(profile.id)
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setError(undefined)
|
||||
try {
|
||||
setProfile(await getProfile(username))
|
||||
} catch (e) {
|
||||
setError((e as Error).message)
|
||||
setProfile(null)
|
||||
}
|
||||
}, [username])
|
||||
/** `reload` : rechargement après une action (s'abonner, bloquer…) — en cas d'échec, on garde le profil affiché. */
|
||||
const load = useCallback(
|
||||
async (reload = false) => {
|
||||
if (!reload) setError(undefined)
|
||||
try {
|
||||
const next = await getProfile(username)
|
||||
if (reload) setError(undefined)
|
||||
setProfile(next)
|
||||
} catch (e) {
|
||||
if (reload) return setToast((e as Error).message)
|
||||
setError((e as Error).message)
|
||||
setProfile(null)
|
||||
}
|
||||
},
|
||||
[username],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
void load()
|
||||
@@ -113,7 +120,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
|
||||
setBusy(true)
|
||||
try {
|
||||
await follow(profile.id)
|
||||
await load()
|
||||
await load(true)
|
||||
void social.refresh()
|
||||
} catch (e) {
|
||||
setToast((e as Error).message)
|
||||
@@ -128,7 +135,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
|
||||
setBusy(true)
|
||||
try {
|
||||
await unfollow(profile.id)
|
||||
await load()
|
||||
await load(true)
|
||||
void social.refresh()
|
||||
} catch (e) {
|
||||
setToast((e as Error).message)
|
||||
@@ -144,7 +151,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
|
||||
setBusy(true)
|
||||
try {
|
||||
await blockUser({ id: profile.id, username: profile.username, displayName: profile.displayName, avatarUrl: profile.avatarUrl })
|
||||
await load()
|
||||
await load(true)
|
||||
void social.refresh()
|
||||
setToast(t('block.done', { name: profile.displayName }))
|
||||
} catch (e) {
|
||||
@@ -422,18 +429,29 @@ function LibraryTab({ profile, onOpen }: { profile: Profile; onOpen: (i: MediaIt
|
||||
const [done, setDone] = useState(false)
|
||||
|
||||
const request = useRef(0)
|
||||
// Lignes reçues du serveur (y compris celles écartées à la relecture) : décalage de la page suivante
|
||||
const received = useRef(0)
|
||||
|
||||
const loadPage = useCallback(
|
||||
async (reset: boolean) => {
|
||||
// Une réponse arrivée après un changement de filtre ne doit pas écraser la nouvelle liste
|
||||
const id = ++request.current
|
||||
setLoading(true)
|
||||
if (reset) setList([])
|
||||
if (reset) {
|
||||
setList([])
|
||||
received.current = 0
|
||||
}
|
||||
try {
|
||||
const page = await getProfileItems(profile.id, status || null, reset ? 0 : list.length)
|
||||
const page = await getProfileItems(profile.id, status || null, reset ? 0 : received.current)
|
||||
if (id !== request.current) return
|
||||
setList((prev) => (reset ? page : [...prev, ...page]))
|
||||
setDone(page.length < 48)
|
||||
received.current += page.received
|
||||
setList((prev) => {
|
||||
// Sans doublon (une fiche ne peut apparaître qu'une fois : même clé React)
|
||||
const base = reset ? [] : prev
|
||||
const seen = new Set(base.map((i) => i.id))
|
||||
return [...base, ...page.items.filter((i) => !seen.has(i.id) && !!seen.add(i.id))]
|
||||
})
|
||||
setDone(page.received < PROFILE_ITEMS_PAGE)
|
||||
} catch {
|
||||
if (id === request.current) setDone(true)
|
||||
} finally {
|
||||
@@ -441,7 +459,7 @@ function LibraryTab({ profile, onOpen }: { profile: Profile; onOpen: (i: MediaIt
|
||||
}
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[profile.id, status, list.length],
|
||||
[profile.id, status],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ export default function ReviewComments({
|
||||
authorId,
|
||||
itemId,
|
||||
count: initialCount,
|
||||
defaultOpen,
|
||||
hidden,
|
||||
children,
|
||||
}: {
|
||||
@@ -25,14 +24,13 @@ export default function ReviewComments({
|
||||
itemId: string
|
||||
/** Nombre connu (sinon chargé à l'ouverture) */
|
||||
count?: number | null
|
||||
defaultOpen?: boolean
|
||||
/** Serveur sans les commentaires (migration pas encore appliquée) : seules les autres actions s'affichent */
|
||||
hidden?: boolean
|
||||
children?: ReactNode
|
||||
}) {
|
||||
const social = useSocial()
|
||||
const { isBlocked } = useBlocked(social.enabled)
|
||||
const [open, setOpen] = useState(!!defaultOpen)
|
||||
const [open, setOpen] = useState(false)
|
||||
const [count, setCount] = useState(initialCount ?? undefined)
|
||||
const [comments, setComments] = useState<ReviewComment[]>()
|
||||
const [unavailable, setUnavailable] = useState(false)
|
||||
|
||||
@@ -11,17 +11,12 @@ export default function ReviewText({
|
||||
text,
|
||||
spoiler,
|
||||
className,
|
||||
clamp,
|
||||
revealed,
|
||||
}: {
|
||||
text: string
|
||||
spoiler?: boolean
|
||||
className?: string
|
||||
clamp?: boolean
|
||||
/** Déjà dévoilé (mon propre avis) : seul le badge « Spoiler » reste */
|
||||
revealed?: boolean
|
||||
}) {
|
||||
const [shown, setShown] = useState(!spoiler || !!revealed)
|
||||
const [shown, setShown] = useState(!spoiler)
|
||||
|
||||
if (!shown) {
|
||||
return (
|
||||
@@ -51,7 +46,7 @@ export default function ReviewText({
|
||||
<EyeOff size={11} aria-hidden="true" /> {t('spoiler.badge')}
|
||||
</span>
|
||||
)}
|
||||
<p className={cx('whitespace-pre-line break-words text-sm leading-relaxed text-ink-2', clamp && 'line-clamp-6')}>{text}</p>
|
||||
<p className="whitespace-pre-line break-words text-sm leading-relaxed text-ink-2">{text}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import ProfileView from './ProfileView'
|
||||
import TitleReviews from './TitleReviews'
|
||||
import { useOnResume } from '../../lib/onResume'
|
||||
import WelcomeProfile, { RANDOM_USERNAME } from './WelcomeProfile'
|
||||
import CommentsSheet from './CommentsSheet'
|
||||
import { InvitePeople, SharedListSheet } from './SharedLists'
|
||||
import { getAniListById, type SearchResult } from '../../lib/catalogApi'
|
||||
import { TYPE_BY_VALUE } from '../../lib/constants'
|
||||
@@ -28,11 +27,8 @@ interface SocialApi {
|
||||
openFollowList: (profile: Profile, kind: 'followers' | 'following') => void
|
||||
/** Tous les avis sur un titre (amis / autres) */
|
||||
openReviews: (externalId: string, title: string) => void
|
||||
peek: (item: MediaItem, owner?: PeekOwner) => void
|
||||
/** Ouvre la fiche si elle est à moi, sinon l'aperçu */
|
||||
openItem: (item: MediaItem, owner?: PeekOwner) => void
|
||||
/** Fil de commentaires d'un avis, en plein écran (depuis une notification) */
|
||||
openComments: (authorId: string, itemId: string, title: string) => void
|
||||
/** Liste partagée */
|
||||
openSharedList: (id: string) => void
|
||||
/** Inviter des membres dans une liste partagée */
|
||||
@@ -54,9 +50,7 @@ const SocialContext = createContext<SocialApi>({
|
||||
openEdit: () => {},
|
||||
openFollowList: () => {},
|
||||
openReviews: () => {},
|
||||
peek: () => {},
|
||||
openItem: () => {},
|
||||
openComments: () => {},
|
||||
openSharedList: () => {},
|
||||
openInvite: () => {},
|
||||
openTitle: () => {},
|
||||
@@ -66,13 +60,14 @@ const SocialContext = createContext<SocialApi>({
|
||||
|
||||
export const useSocial = () => useContext(SocialContext)
|
||||
|
||||
let overlayUid = 0
|
||||
|
||||
type Overlay =
|
||||
| { kind: 'profile'; username: string }
|
||||
| { kind: 'search' }
|
||||
| { kind: 'edit' }
|
||||
| { kind: 'follows'; profile: Profile; list: 'followers' | 'following' }
|
||||
| { kind: 'reviews'; externalId: string; title: string }
|
||||
| { kind: 'comments'; authorId: string; itemId: string; title: string }
|
||||
| { kind: 'sharedList'; id: string }
|
||||
| { kind: 'invite'; listId: string; listName: string }
|
||||
|
||||
@@ -91,7 +86,7 @@ export function SocialProvider({
|
||||
const enabled = !!account
|
||||
const [me, setMe] = useState<Profile | null>(null)
|
||||
const [requests, setRequests] = useState<ProfileCard[]>([])
|
||||
const [stack, setStack] = useState<Overlay[]>([])
|
||||
const [stack, setStack] = useState<(Overlay & { uid: number })[]>([])
|
||||
const [peeked, setPeeked] = useState<{ item: MediaItem; owner?: PeekOwner }>()
|
||||
const [sharedTick, setSharedTick] = useState(0)
|
||||
const bumpShared = useCallback(() => setSharedTick((n) => n + 1), [])
|
||||
@@ -129,8 +124,9 @@ export function SocialProvider({
|
||||
// Nouvelles demandes d'abonnement, compteurs… mis à jour au retour sur l'app
|
||||
useOnResume(() => void refresh(), enabled)
|
||||
|
||||
const push = useCallback((o: Overlay) => setStack((s) => [...s.slice(-8), o]), [])
|
||||
const pop = useCallback(() => setStack((s) => s.slice(0, -1)), [])
|
||||
// Clé stable par écran (et non sa place dans la pile, qui change quand la pile est écourtée)
|
||||
const push = useCallback((o: Overlay) => setStack((s) => [...s.slice(-8), { ...o, uid: ++overlayUid }]), [])
|
||||
const close = useCallback((uid: number) => setStack((s) => s.filter((x) => x.uid !== uid)), [])
|
||||
|
||||
// Lien partagé « #/u/pseudo »
|
||||
useEffect(() => {
|
||||
@@ -191,9 +187,7 @@ export function SocialProvider({
|
||||
openEdit: () => push({ kind: 'edit' }),
|
||||
openFollowList: (profile, list) => push({ kind: 'follows', profile, list }),
|
||||
openReviews: (externalId, title) => push({ kind: 'reviews', externalId, title }),
|
||||
peek: (item, owner) => setPeeked({ item, owner }),
|
||||
openItem,
|
||||
openComments: (authorId, itemId, title) => push({ kind: 'comments', authorId, itemId, title }),
|
||||
openSharedList: (id) => push({ kind: 'sharedList', id }),
|
||||
openInvite: (listId, listName) => push({ kind: 'invite', listId, listName }),
|
||||
openTitle: (s) => void openTitle(s),
|
||||
@@ -207,23 +201,21 @@ export function SocialProvider({
|
||||
<SocialContext.Provider value={api}>
|
||||
{/* Les écrans sociaux sont placés avant l'app : une fiche ouverte depuis un profil passe au-dessus */}
|
||||
{enabled &&
|
||||
stack.map((o, k) =>
|
||||
stack.map((o) =>
|
||||
o.kind === 'profile' ? (
|
||||
<ProfileView key={k} username={o.username} onClose={pop} />
|
||||
<ProfileView key={o.uid} username={o.username} onClose={() => close(o.uid)} />
|
||||
) : o.kind === 'search' ? (
|
||||
<PeopleSearch key={k} onClose={pop} />
|
||||
<PeopleSearch key={o.uid} onClose={() => close(o.uid)} />
|
||||
) : o.kind === 'edit' ? (
|
||||
<EditProfile key={k} onClose={pop} />
|
||||
<EditProfile key={o.uid} onClose={() => close(o.uid)} />
|
||||
) : o.kind === 'follows' ? (
|
||||
<FollowList key={k} profile={o.profile} initial={o.list} onClose={pop} />
|
||||
<FollowList key={o.uid} profile={o.profile} initial={o.list} onClose={() => close(o.uid)} />
|
||||
) : o.kind === 'reviews' ? (
|
||||
<TitleReviews key={k} externalId={o.externalId} title={o.title} onClose={pop} onOpenProfile={(u) => push({ kind: 'profile', username: u })} />
|
||||
) : o.kind === 'comments' ? (
|
||||
<CommentsSheet key={k} authorId={o.authorId} itemId={o.itemId} title={o.title} onClose={pop} />
|
||||
<TitleReviews key={o.uid} externalId={o.externalId} title={o.title} onClose={() => close(o.uid)} onOpenProfile={(u) => push({ kind: 'profile', username: u })} />
|
||||
) : o.kind === 'sharedList' ? (
|
||||
<SharedListSheet key={k} id={o.id} onClose={pop} />
|
||||
<SharedListSheet key={o.uid} id={o.id} onClose={() => close(o.uid)} />
|
||||
) : (
|
||||
<InvitePeople key={k} listId={o.listId} listName={o.listName} onClose={pop} />
|
||||
<InvitePeople key={o.uid} listId={o.listId} listName={o.listName} onClose={() => close(o.uid)} />
|
||||
),
|
||||
)}
|
||||
{children}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Loader2, Star } from 'lucide-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { t } from '../../i18n'
|
||||
import { getSession } from '../../lib/cloud/auth'
|
||||
import { useBlocked } from '../../lib/cloud/moderation'
|
||||
import { titleReviews, type TitleReview, type TitleReviews as TitleReviewsData } from '../../lib/cloud/reviews'
|
||||
import { formatRating } from '../../lib/utils'
|
||||
@@ -71,6 +72,8 @@ function ReviewColumn({ heading, empty, list, onOpenProfile }: { heading: string
|
||||
|
||||
function ReviewCard({ r, onOpenProfile }: { r: TitleReview; onOpenProfile: (username: string) => void }) {
|
||||
const { settings } = useMedia()
|
||||
// Mon propre avis : ni signalement ni réaction (seuls les commentaires restent)
|
||||
const mine = r.user_id === getSession()?.user.id
|
||||
return (
|
||||
<article className="card p-3.5">
|
||||
<div className="flex items-center gap-2.5">
|
||||
@@ -85,12 +88,12 @@ function ReviewCard({ r, onOpenProfile }: { r: TitleReview; onOpenProfile: (user
|
||||
{formatRating(r.rating, settings.ratingScale)}
|
||||
</span>
|
||||
)}
|
||||
<ReportButton target={{ type: 'review', id: r.item_id, userId: r.user_id }} className="-me-1.5" size={16} />
|
||||
{!mine && <ReportButton target={{ type: 'review', id: r.item_id, userId: r.user_id }} className="-me-1.5" size={16} />}
|
||||
</div>
|
||||
{r.notes && <ReviewText text={r.notes} spoiler={r.spoiler} />}
|
||||
<div className="mt-3">
|
||||
<ReviewComments authorId={r.user_id} itemId={r.item_id} count={r.comments} hidden={r.comments === null}>
|
||||
<Reactions authorId={r.user_id} itemId={r.item_id} reactions={r.reactions} mine={r.mine} />
|
||||
{!mine && <Reactions authorId={r.user_id} itemId={r.item_id} reactions={r.reactions} mine={r.mine} />}
|
||||
</ReviewComments>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -99,6 +99,13 @@ function SeasonRow({
|
||||
if (highlight) ref.current?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
}, [highlight])
|
||||
|
||||
// À l'ouverture de l'éditeur : on repart de l'avis enregistré (il a pu changer depuis, ex. synchro)
|
||||
const openEditor = () => {
|
||||
setDraft(value?.notes ?? '')
|
||||
setSpoiler(!!value?.spoiler)
|
||||
setWriting(true)
|
||||
}
|
||||
|
||||
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">
|
||||
@@ -164,7 +171,7 @@ function SeasonRow({
|
||||
</div>
|
||||
</div>
|
||||
) : value?.notes ? (
|
||||
<button onClick={() => setWriting(true)} className="mt-3 block w-full text-start">
|
||||
<button onClick={openEditor} 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>}
|
||||
@@ -173,7 +180,7 @@ function SeasonRow({
|
||||
<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">
|
||||
<button onClick={openEditor} 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>
|
||||
))}
|
||||
|
||||
@@ -67,6 +67,8 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
// La fiche suit la version à jour de la bibliothèque (ou celle créée depuis cette fiche)
|
||||
const [itemId, setItemId] = useState<string | undefined>(() => initial?.id ?? (seed && items.find((i) => i.externalId === seed.externalId)?.id))
|
||||
const item = useMemo(() => (itemId ? items.find((i) => i.id === itemId) : undefined), [items, itemId])
|
||||
// Étiquettes proposées : recalculées seulement quand la bibliothèque change
|
||||
const tagSuggestions = useMemo(() => allTags(items), [items])
|
||||
|
||||
// Infos du catalogue pour un titre pas encore ajouté
|
||||
const [meta, setMeta] = useState<Partial<MediaInput> | undefined>(() => (seed?.source === 'anilist' ? { ...seed.prefill } : undefined))
|
||||
@@ -201,9 +203,14 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
}
|
||||
// Changement de statut d'un titre déjà suivi : « Annuler » remet la fiche telle quelle (dates, épisodes…)
|
||||
const before = item
|
||||
void save(patch).then(() => {
|
||||
if (before) actions.offerUndo(t('toast.status', { title: before.title, status: STATUS_BY_VALUE[s].label }), [before])
|
||||
})
|
||||
void save(patch)
|
||||
.then(() => {
|
||||
if (before) actions.offerUndo(t('toast.status', { title: before.title, status: STATUS_BY_VALUE[s].label }), [before])
|
||||
})
|
||||
.catch((e) => {
|
||||
// Mode découverte : la demande de compte est déjà ouverte
|
||||
if (!(e instanceof GuestError)) setToast((e as Error).message)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,6 +294,8 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
}
|
||||
const blob = await renderItemCard(item, settings.ratingScale, credits)
|
||||
setPreview({ blob, filename: `kino-${slug(item.title)}.png` })
|
||||
} catch {
|
||||
setToast(t('share.err.create'))
|
||||
} finally {
|
||||
setSharing(false)
|
||||
}
|
||||
@@ -560,7 +569,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<button onClick={() => setReviewing(true)} disabled={busy} className="flex w-full items-center gap-2 rounded-2xl border border-dashed border-line-strong px-4 py-3.5 text-left text-sm text-ink-2">
|
||||
<button onClick={() => setReviewing(true)} disabled={busy} className="flex w-full items-center gap-2 rounded-2xl border border-dashed border-line-strong px-4 py-3.5 text-start text-sm text-ink-2">
|
||||
<Pencil size={16} className="text-accent" /> {t('title.writeReview')}
|
||||
</button>
|
||||
)}
|
||||
@@ -621,7 +630,7 @@ export default function TitleSheet({ item: initial, seed, onClose, onGoToSetting
|
||||
)}
|
||||
|
||||
{/* Mon suivi : dates, plateforme, listes, revisionnages */}
|
||||
{item && <Tracking item={item} lists={lists} tagSuggestions={allTags(items)} onChange={changeTracking} />}
|
||||
{item && <Tracking item={item} lists={lists} tagSuggestions={tagSuggestions} onChange={changeTracking} />}
|
||||
|
||||
{/* Listes partagées avec d'autres membres (titre de ma bibliothèque ou pas encore ajouté) */}
|
||||
{externalId && social.enabled && (
|
||||
@@ -701,8 +710,8 @@ function MoreMenu({ onClose, children }: { onClose: () => void; children: ReactN
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-black/70 sm:items-center" onClick={onClose}>
|
||||
<div role="menu" className="safe-bottom w-full max-w-md rounded-t-3xl border border-line-strong bg-surface p-3 sm:rounded-3xl" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="fixed inset-0 z-[60] flex items-end justify-center bg-scrim sm:items-center" onClick={onClose}>
|
||||
<div className="safe-bottom w-full max-w-md rounded-t-3xl border border-line-strong bg-surface p-3 sm:rounded-3xl" onClick={(e) => e.stopPropagation()}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
@@ -711,7 +720,7 @@ function MoreMenu({ onClose, children }: { onClose: () => void; children: ReactN
|
||||
|
||||
function MenuButton({ icon, children, onClick, danger }: { icon: ReactNode; children: ReactNode; onClick: () => void; danger?: boolean }) {
|
||||
return (
|
||||
<button onClick={onClick} className={cx('flex w-full items-center gap-3 rounded-xl px-3 py-3.5 text-left text-[15px] active:bg-surface-2', danger ? 'text-accent' : 'text-ink')}>
|
||||
<button onClick={onClick} className={cx('flex w-full items-center gap-3 rounded-xl px-3 py-3.5 text-start text-[15px] active:bg-surface-2', danger ? 'text-accent' : 'text-ink')}>
|
||||
{icon}
|
||||
{children}
|
||||
</button>
|
||||
@@ -832,7 +841,7 @@ function Tracking({ item, lists, tagSuggestions, onChange }: { item: MediaItem;
|
||||
|
||||
return (
|
||||
<section className="mx-4 mt-8 border-t border-line pt-5">
|
||||
<button onClick={() => setOpen((v) => !v)} aria-expanded={open} className="flex w-full items-center justify-between text-left">
|
||||
<button onClick={() => setOpen((v) => !v)} aria-expanded={open} className="flex w-full items-center justify-between text-start">
|
||||
<span>
|
||||
<span className="eyebrow block text-ink-2">{t('title.myTracking')}</span>
|
||||
<span className="mt-1 block text-xs text-ink-3">{summary.length ? summary.join(' · ') : t('title.trackingHint')}</span>
|
||||
|
||||
@@ -40,7 +40,7 @@ export function SectionTitle({ children, action }: { children: ReactNode; action
|
||||
export function LinkArrow({ onClick, children }: { onClick: () => void; children: ReactNode }) {
|
||||
return (
|
||||
<button onClick={onClick} className="shrink-0 text-xs font-medium text-ink-3 transition-colors hover:text-ink">
|
||||
{children} <span className="text-accent">→</span>
|
||||
{children} <span className="inline-block text-accent rtl:-scale-x-100">→</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user