Profil : Top 1, onglet Top 5, 5 derniers vus, plus de stats ni d'« À voir »
deploy / deploy (push) Successful in 40s

- Onglet Profil : une ligne « Top 1 » (le n°1 de chaque Top 5), « En cours », et les 5 derniers vus
- Nouvel onglet « Top 5 » entre Profil et Bibliothèque, avec les classements complets
- Stats détaillées et « À voir » retirés du profil (déjà dans Stats et Bibliothèque)
- Bouton « Modifier le profil » (et S'abonner) sous la bannière au lieu de mordre dessus
- Serveur (migration 20261128140000, appliquée) : get_profile n'envoie plus que le nombre
  de titres vus, les 5 derniers vus et plus la liste « À voir »
- 4 textes devenus inutiles retirés (18 langues)

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-11-27 20:36:32 +00:00
1 parent 9ce9bbc0c0
commit 3f207b17c0
22 files changed
+139 -150

No files matched your search

+46 -53
View File
@@ -55,7 +55,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
const { settings } = useMedia()
const [profile, setProfile] = useState<Profile | null>()
const [error, setError] = useState<string>()
const [tab, setTab] = useState<'profile' | 'library'>('profile')
const [tab, setTab] = useState<'profile' | 'top' | 'library'>('profile')
const [busy, setBusy] = useState(false)
const [confirmUnfollow, setConfirmUnfollow] = useState(false)
const [toast, setToast] = useState<string>()
@@ -174,12 +174,12 @@ export default function ProfileView({ username, onClose }: { username: string; o
}
const topByCategory = useMemo(() => {
const out: { label: string; items: MediaItem[] }[] = []
const out: { label: string; single: string; items: MediaItem[] }[] = []
// Mon profil : mes réglages locaux font foi tout de suite (même avant la synchro)
const shown = profile?.isMe ? TOP_CATEGORIES.filter((c) => settings.topCategories.includes(c.value)) : TOP_CATEGORIES
for (const c of shown) {
const list = (profile?.top ?? []).filter((i) => i.top?.category === c.value).sort((a, b) => a.top!.rank - b.top!.rank)
if (list.length) out.push({ label: c.plural, items: list })
if (list.length) out.push({ label: c.plural, single: c.label, items: list })
}
return out
}, [profile, settings.topCategories])
@@ -213,14 +213,15 @@ export default function ProfileView({ username, onClose }: { username: string; o
{profile.bannerUrl && <img src={profile.bannerUrl} alt="" className="size-full object-cover" />}
</div>
<div className="px-4 lg:px-10">
<div className="relative -mt-11 flex items-end justify-between gap-3 lg:-mt-14">
{/* La photo chevauche la bannière ; les boutons restent en dessous (pt = partie de la photo posée sur la bannière + marge) */}
<div className="relative -mt-11 flex items-start justify-between gap-3 lg:-mt-14">
<Avatar url={profile.avatarUrl} name={profile.displayName} size={88} className="border-4 border-bg" />
{profile.isMe ? (
<button onClick={social.openEdit} className="btn btn-ghost mb-1 px-4 py-2 text-sm">
<button onClick={social.openEdit} className="btn btn-ghost mt-[3.5rem] px-4 py-2 text-sm lg:mt-[4.25rem]">
{t('social.editProfile')}
</button>
) : (
<div className="mb-1 flex items-center gap-1">
<div className="mt-[3.5rem] flex items-center gap-1 lg:mt-[4.25rem]">
{blocked ? (
<button onClick={doUnblock} disabled={busy} className="btn btn-ghost px-4 py-2 text-sm">
{busy ? <Loader2 size={15} className="animate-spin" /> : <UserCheck size={15} />}
@@ -279,7 +280,7 @@ export default function ProfileView({ username, onClose }: { username: string; o
)}
<div className="mt-5 flex divide-x divide-line rounded-2xl border border-line py-3 lg:max-w-2xl">
<Stat value={profile.visible ? (profile.stats?.finished ?? 0) : undefined} label={t('social.seen')} />
<Stat value={profile.visible ? (profile.seen ?? 0) : undefined} label={t('social.seen')} />
<Stat value={profile.followers} label={t('social.followers', { count: profile.followers })} onClick={profile.visible ? () => social.openFollowList(profile, 'followers') : undefined} />
<Stat value={profile.following} label={t('social.followingCount', { count: profile.following })} onClick={profile.visible ? () => social.openFollowList(profile, 'following') : undefined} />
</div>
@@ -299,19 +300,21 @@ export default function ProfileView({ username, onClose }: { username: string; o
</div>
) : (
<>
<div className="mt-6 grid grid-cols-2 gap-1 rounded-md border border-line p-1 lg:max-w-md">
{(['profile', 'library'] as const).map((v) => (
<div className={cx('mt-6 grid gap-1 rounded-md border border-line p-1 lg:max-w-md', topByCategory.length ? 'grid-cols-3' : 'grid-cols-2')}>
{(topByCategory.length ? (['profile', 'top', 'library'] as const) : (['profile', 'library'] as const)).map((v) => (
<button
key={v}
onClick={() => setTab(v)}
className={cx('rounded-md py-2 text-sm font-medium transition-colors', tab === v ? 'bg-ink text-bg' : 'text-ink-3')}
>
{v === 'profile' ? t('social.tabProfile') : t('social.tabLibrary')}
{v === 'profile' ? t('social.tabProfile') : v === 'top' ? t('social.top5') : t('social.tabLibrary')}
</button>
))}
</div>
{tab === 'profile' ? (
<ProfileTab profile={profile} topByCategory={topByCategory} onOpen={openItem} />
) : tab === 'top' && topByCategory.length ? (
<TopTab topByCategory={topByCategory} onOpen={openItem} />
) : (
<LibraryTab profile={profile} onOpen={openItem} />
)}
@@ -346,25 +349,24 @@ export default function ProfileView({ username, onClose }: { username: string; o
)
}
function ProfileTab({ profile, topByCategory, onOpen }: { profile: Profile; topByCategory: { label: string; items: MediaItem[] }[]; onOpen: (i: MediaItem) => void }) {
const s = profile.stats
type TopGroup = { label: string; single: string; items: MediaItem[] }
/** Onglet Profil : le n°1 de chaque Top 5, ce que je regarde, mes 5 derniers vus. */
function ProfileTab({ profile, topByCategory, onOpen }: { profile: Profile; topByCategory: TopGroup[]; onOpen: (i: MediaItem) => void }) {
const firsts = topByCategory.flatMap((c) => (c.items[0]?.top?.rank === 1 ? [{ item: c.items[0], category: c.single }] : []))
const recent = profile.recent.slice(0, 5)
return (
<>
{topByCategory.map((c) => (
<section key={c.label}>
<SectionTitle>
{t('social.top5')} · {c.label}
</SectionTitle>
{firsts.length > 0 && (
<>
<SectionTitle>{t('social.top1')}</SectionTitle>
<div className="grid grid-cols-5 gap-2 lg:grid-cols-8 lg:gap-3 xl:grid-cols-10">
{c.items.map((item) => (
<div key={item.id} className="relative">
<PosterTile item={item} onOpen={() => onOpen(item)} />
<span className="absolute start-1 top-1 grid size-5 place-items-center rounded-full bg-bg/85 text-[10px] font-bold">{item.top!.rank}</span>
</div>
{firsts.map(({ item, category }) => (
<PosterTile key={item.id} item={item} onOpen={() => onOpen(item)} caption={category} />
))}
</div>
</section>
))}
</>
)}
{profile.watching.length > 0 && (
<>
@@ -378,45 +380,36 @@ function ProfileTab({ profile, topByCategory, onOpen }: { profile: Profile; topB
)}
<SectionTitle>{t('social.recent')}</SectionTitle>
{profile.recent.length ? (
<div className="grid grid-cols-4 gap-2.5 sm:grid-cols-5 lg:grid-cols-8 lg:gap-3 xl:grid-cols-10">
{profile.recent.map((item) => (
{recent.length ? (
<div className="grid grid-cols-5 gap-2 lg:grid-cols-8 lg:gap-3 xl:grid-cols-10">
{recent.map((item) => (
<PosterTile key={item.id} item={item} onOpen={() => onOpen(item)} />
))}
</div>
) : (
<p className="text-sm text-ink-3">{t('social.noRecent')}</p>
)}
</>
)
}
{profile.watchlist.length > 0 && (
<>
<SectionTitle>{t('social.watchlist')}</SectionTitle>
<div className="grid grid-cols-4 gap-2.5 sm:grid-cols-5 lg:grid-cols-8 lg:gap-3 xl:grid-cols-10">
{profile.watchlist.map((item) => (
<PosterTile key={item.id} item={item} onOpen={() => onOpen(item)} />
))}
</div>
</>
)}
{s && (
<>
<SectionTitle>{t('nav.stats')}</SectionTitle>
<div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
{[
[s.finishedYear, t('social.statYear')],
[s.films, t('social.statFilms')],
[s.series, t('social.statSeries')],
[s.episodes, t('home.episodesSeen')],
].map(([v, label]) => (
<div key={label as string} className="card p-4">
<div className="eyebrow">{label}</div>
<div className="mt-2 text-2xl font-bold tabular-nums leading-none">{fmtNumber(v as number)}</div>
/** Onglet Top 5 : les classements complets, catégorie par catégorie. */
function TopTab({ topByCategory, onOpen }: { topByCategory: TopGroup[]; onOpen: (i: MediaItem) => void }) {
return (
<>
{topByCategory.map((c) => (
<section key={c.label}>
<SectionTitle>{c.label}</SectionTitle>
<div className="grid grid-cols-5 gap-2 lg:grid-cols-8 lg:gap-3 xl:grid-cols-10">
{c.items.map((item) => (
<div key={item.id} className="relative">
<PosterTile item={item} onOpen={() => onOpen(item)} />
<span className="absolute start-1 top-1 grid size-5 place-items-center rounded-full bg-bg/85 text-[10px] font-bold">{item.top!.rank}</span>
</div>
))}
</div>
</>
)}
</section>
))}
</>
)
}