diff --git a/CLAUDE.md b/CLAUDE.md index a5b5674..f6c2a65 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,7 +61,7 @@ npm run build # build de prod - RTL géré (arabe) : préférer les classes logiques (`ps-`/`pe-`, `ms-`/`me-`, `start-`/`end-`, `border-e`). ## État (au 28 nov. 2026) -- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261128130000_notifications_actor_index.sql` incluse. +- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261128140000_profile_slim.sql` incluse. - **Notifications : abonnements uniquement** (27 nov. 2026) — cloche sur l'accueil, dans l'app, pas de push. Types : `new_follower`, `follow_request`, `unfollow`, `follow_accepted` (trigger `follows_notify`, RPC `get_notifications` / `unread_notifications` / `mark_notifications_read`). Les anciennes notifications (push, commentaires, épisodes, invitations) et `azuu_notify` ont été supprimées. La fonction Edge `send-push` répond 410 : à supprimer depuis le tableau de bord Supabase. - **Retirés (27-28 nov. 2026)** : défis, couleur d'accent au choix, apparences Nuit/Étoilé, notation sur 10 (les notes restent stockées sur 10 en interne, affichées sur 5 étoiles). - **Chargement** : les écrans rares (stats, réglages, admin, roulette, calendrier, écrans sociaux…) sont chargés à la demande puis préchargés au repos (`App.tsx` → `loaders`, `SocialProvider.tsx` → `socialLoaders`). diff --git a/src/components/social/ProfileView.tsx b/src/components/social/ProfileView.tsx index aaf7d45..25f9efb 100644 --- a/src/components/social/ProfileView.tsx +++ b/src/components/social/ProfileView.tsx @@ -55,7 +55,7 @@ export default function ProfileView({ username, onClose }: { username: string; o const { settings } = useMedia() const [profile, setProfile] = useState() const [error, setError] = useState() - 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() @@ -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 && }
-
+ {/* La photo chevauche la bannière ; les boutons restent en dessous (pt = partie de la photo posée sur la bannière + marge) */} +
{profile.isMe ? ( - ) : ( -
+
{blocked ? (
) : ( <> -
- {(['profile', 'library'] as const).map((v) => ( +
+ {(topByCategory.length ? (['profile', 'top', 'library'] as const) : (['profile', 'library'] as const)).map((v) => ( ))}
{tab === 'profile' ? ( + ) : tab === 'top' && topByCategory.length ? ( + ) : ( )} @@ -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) => ( -
- - {t('social.top5')} · {c.label} - + {firsts.length > 0 && ( + <> + {t('social.top1')}
- {c.items.map((item) => ( -
- onOpen(item)} /> - {item.top!.rank} -
+ {firsts.map(({ item, category }) => ( + onOpen(item)} caption={category} /> ))}
-
- ))} + + )} {profile.watching.length > 0 && ( <> @@ -378,45 +380,36 @@ function ProfileTab({ profile, topByCategory, onOpen }: { profile: Profile; topB )} {t('social.recent')} - {profile.recent.length ? ( -
- {profile.recent.map((item) => ( + {recent.length ? ( +
+ {recent.map((item) => ( onOpen(item)} /> ))}
) : (

{t('social.noRecent')}

)} + + ) +} - {profile.watchlist.length > 0 && ( - <> - {t('social.watchlist')} -
- {profile.watchlist.map((item) => ( - onOpen(item)} /> - ))} -
- - )} - - {s && ( - <> - {t('nav.stats')} -
- {[ - [s.finishedYear, t('social.statYear')], - [s.films, t('social.statFilms')], - [s.series, t('social.statSeries')], - [s.episodes, t('home.episodesSeen')], - ].map(([v, label]) => ( -
-
{label}
-
{fmtNumber(v as number)}
+/** 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) => ( +
+ {c.label} +
+ {c.items.map((item) => ( +
+ onOpen(item)} /> + {item.top!.rank}
))}
- - )} +
+ ))} ) } diff --git a/src/i18n/locales/ar.ts b/src/i18n/locales/ar.ts index 53a0b82..c8373ee 100644 --- a/src/i18n/locales/ar.ts +++ b/src/i18n/locales/ar.ts @@ -754,12 +754,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'هذا الحساب خاص: ستحتاج إلى إرسال طلب جديد لرؤية ملفه الشخصي مجددًا.', 'social.cancelRequest': 'إلغاء الطلب', 'social.unfollow': 'إلغاء المتابعة', + 'social.top1': 'الأول', 'social.top5': 'أفضل 5', 'social.recent': 'شوهدت مؤخرًا', 'social.noRecent': 'لم يكتمل شيء بعد.', - 'social.statYear': 'شوهدت هذا العام', - 'social.statFilms': 'أفلام شوهدت', - 'social.statSeries': 'مسلسلات وأنمي شوهدت', 'social.emptyLibrary': 'لا عناوين هنا.', 'social.loadMore': 'عرض المزيد', 'social.changeBanner': 'تغيير الغلاف', @@ -822,7 +820,6 @@ const dict: Translations = { 'welcome.go': 'هيا بنا', 'welcome.later': 'لاحقًا', 'social.watching': 'قيد المشاهدة', - 'social.watchlist': 'يرغب في مشاهدتها', 'search.animeOnly': 'بدون مفتاح TMDB، يمكن العثور على الأنمي فقط.', 'form.startShort': 'بدأ في', 'form.endShort': 'انتهى في', diff --git a/src/i18n/locales/de.ts b/src/i18n/locales/de.ts index 1458e45..bbabaf5 100644 --- a/src/i18n/locales/de.ts +++ b/src/i18n/locales/de.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Dieses Konto ist privat: Du musst erneut anfragen, um das Profil wieder zu sehen.', 'social.cancelRequest': 'Anfrage zurückziehen', 'social.unfollow': 'Nicht mehr folgen', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Zuletzt gesehen', 'social.noRecent': 'Noch nichts abgeschlossen.', - 'social.statYear': 'Dieses Jahr gesehen', - 'social.statFilms': 'Filme gesehen', - 'social.statSeries': 'Serien & Animes gesehen', 'social.emptyLibrary': 'Hier gibt’s keine Titel.', 'social.loadMore': 'Mehr anzeigen', 'social.changeBanner': 'Banner ändern', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Los geht's", 'welcome.later': "Später", 'social.watching': "Schaut gerade", - 'social.watchlist': "Möchte sehen", 'search.animeOnly': "Ohne TMDB-Schlüssel werden nur Animes gefunden.", 'form.startShort': "Begonnen", 'form.endShort': "Beendet", diff --git a/src/i18n/locales/en.ts b/src/i18n/locales/en.ts index 4af8767..4122c83 100644 --- a/src/i18n/locales/en.ts +++ b/src/i18n/locales/en.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'This account is private: you’ll have to send a new request to see their profile again.', 'social.cancelRequest': 'Cancel request', 'social.unfollow': 'Unfollow', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Recently watched', 'social.noRecent': 'Nothing finished yet.', - 'social.statYear': 'Watched this year', - 'social.statFilms': 'Movies watched', - 'social.statSeries': 'Series & anime watched', 'social.emptyLibrary': 'No titles here.', 'social.loadMore': 'Show more', 'social.changeBanner': 'Change banner', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Let's go", 'welcome.later': "Later", 'social.watching': "Watching", - 'social.watchlist': "Wants to watch", 'search.animeOnly': "Without a TMDB key, only anime can be found.", 'form.startShort': "Started", 'form.endShort': "Finished", diff --git a/src/i18n/locales/es.ts b/src/i18n/locales/es.ts index 869061d..aefa834 100644 --- a/src/i18n/locales/es.ts +++ b/src/i18n/locales/es.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Esta cuenta es privada: tendrás que volver a enviar una solicitud para ver su perfil.', 'social.cancelRequest': 'Cancelar solicitud', 'social.unfollow': 'Dejar de seguir', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Vistos recientemente', 'social.noRecent': 'Nada terminado por ahora.', - 'social.statYear': 'Vistos este año', - 'social.statFilms': 'Películas vistas', - 'social.statSeries': 'Series y animes vistos', 'social.emptyLibrary': 'No hay ningún título aquí.', 'social.loadMore': 'Ver más', 'social.changeBanner': 'Cambiar el banner', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Vamos", 'welcome.later': "Más tarde", 'social.watching': "Viendo", - 'social.watchlist': "Quiere ver", 'search.animeOnly': "Sin clave de TMDB solo se encuentran animes.", 'form.startShort': "Empezado", 'form.endShort': "Terminado", diff --git a/src/i18n/locales/fr.ts b/src/i18n/locales/fr.ts index dfda9d6..c5b55ba 100644 --- a/src/i18n/locales/fr.ts +++ b/src/i18n/locales/fr.ts @@ -660,12 +660,10 @@ const dict = { 'social.unfollowPrivate': 'Ce compte est privé : il faudra refaire une demande pour revoir son profil.', 'social.cancelRequest': 'Annuler la demande', 'social.unfollow': 'Se désabonner', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Vus récemment', 'social.noRecent': 'Rien de terminé pour l\'instant.', - 'social.statYear': 'Vus cette année', - 'social.statFilms': 'Films vus', - 'social.statSeries': 'Séries & animes vus', 'social.emptyLibrary': 'Aucun titre ici.', 'social.loadMore': 'Voir plus', 'social.changeBanner': 'Changer la bannière', @@ -725,7 +723,6 @@ const dict = { 'welcome.go': "C'est parti", 'welcome.later': "Plus tard", 'social.watching': "En cours", - 'social.watchlist': "Envie de voir", 'search.animeOnly': "Sans clé TMDB, seuls les animes sont trouvés.", 'form.startShort': "Commencé le", 'form.endShort': "Fini le", diff --git a/src/i18n/locales/hi.ts b/src/i18n/locales/hi.ts index 1e4ba4f..b1d2e65 100644 --- a/src/i18n/locales/hi.ts +++ b/src/i18n/locales/hi.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'यह अकाउंट प्राइवेट है: उनकी प्रोफ़ाइल फिर से देखने के लिए आपको नई रिक्वेस्ट भेजनी होगी।', 'social.cancelRequest': 'रिक्वेस्ट रद्द करें', 'social.unfollow': 'अनफ़ॉलो करें', + 'social.top1': 'टॉप 1', 'social.top5': 'टॉप 5', 'social.recent': 'हाल ही में देखे', 'social.noRecent': 'अभी तक कुछ पूरा नहीं किया।', - 'social.statYear': 'इस साल देखे', - 'social.statFilms': 'देखी गई फ़िल्में', - 'social.statSeries': 'देखी गई सीरीज़ और एनिमे', 'social.emptyLibrary': 'यहाँ कोई टाइटल नहीं।', 'social.loadMore': 'और दिखाएँ', 'social.changeBanner': 'बैनर बदलें', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': 'चलिए शुरू करें', 'welcome.later': 'बाद में', 'social.watching': 'देख रहे हैं', - 'social.watchlist': 'देखना चाहते हैं', 'search.animeOnly': 'TMDB की के बिना सिर्फ़ एनिमे खोजे जा सकते हैं।', 'form.startShort': 'शुरू किया', 'form.endShort': 'पूरा किया', diff --git a/src/i18n/locales/id.ts b/src/i18n/locales/id.ts index 43b34f0..fe0dcb7 100644 --- a/src/i18n/locales/id.ts +++ b/src/i18n/locales/id.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Akun ini privat: kamu harus mengirim permintaan lagi untuk melihat profilnya.', 'social.cancelRequest': 'Batalkan permintaan', 'social.unfollow': 'Berhenti mengikuti', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Baru ditonton', 'social.noRecent': 'Belum ada yang selesai.', - 'social.statYear': 'Ditonton tahun ini', - 'social.statFilms': 'Film ditonton', - 'social.statSeries': 'Serial & anime ditonton', 'social.emptyLibrary': 'Tidak ada judul di sini.', 'social.loadMore': 'Lihat lebih banyak', 'social.changeBanner': 'Ganti banner', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': 'Ayo mulai', 'welcome.later': 'Nanti saja', 'social.watching': 'Sedang ditonton', - 'social.watchlist': 'Mau ditonton', 'search.animeOnly': 'Tanpa kunci TMDB, hanya anime yang bisa ditemukan.', 'form.startShort': 'Mulai', 'form.endShort': 'Selesai', diff --git a/src/i18n/locales/it.ts b/src/i18n/locales/it.ts index b96cf92..eddc558 100644 --- a/src/i18n/locales/it.ts +++ b/src/i18n/locales/it.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Questo account è privato: dovrai inviare una nuova richiesta per rivedere il suo profilo.', 'social.cancelRequest': 'Annulla la richiesta', 'social.unfollow': 'Smetti di seguire', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Visti di recente', 'social.noRecent': 'Ancora niente di finito.', - 'social.statYear': 'Visti quest’anno', - 'social.statFilms': 'Film visti', - 'social.statSeries': 'Serie e anime visti', 'social.emptyLibrary': 'Nessun titolo qui.', 'social.loadMore': 'Mostra altro', 'social.changeBanner': 'Cambia il banner', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Iniziamo", 'welcome.later': "Più tardi", 'social.watching': "In corso", - 'social.watchlist': "Vuole vedere", 'search.animeOnly': "Senza chiave TMDB si trovano solo gli anime.", 'form.startShort': "Iniziato", 'form.endShort': "Finito", diff --git a/src/i18n/locales/ja.ts b/src/i18n/locales/ja.ts index 2ffea30..447ce59 100644 --- a/src/i18n/locales/ja.ts +++ b/src/i18n/locales/ja.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'このアカウントは非公開です。再びプロフィールを見るには、もう一度リクエストが必要です。', 'social.cancelRequest': 'リクエストを取り消す', 'social.unfollow': 'フォロー解除', + 'social.top1': 'トップ1', 'social.top5': 'トップ5', 'social.recent': '最近見た作品', 'social.noRecent': 'まだ見終わった作品はありません。', - 'social.statYear': '今年見た作品', - 'social.statFilms': '見た映画', - 'social.statSeries': '見たドラマ・アニメ', 'social.emptyLibrary': 'ここには作品がありません。', 'social.loadMore': 'もっと見る', 'social.changeBanner': 'バナーを変更', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "はじめる", 'welcome.later': "あとで", 'social.watching': "視聴中", - 'social.watchlist': "見たい", 'search.animeOnly': "TMDB キーがない場合はアニメのみ検索できます。", 'form.startShort': "開始日", 'form.endShort': "完了日", diff --git a/src/i18n/locales/ko.ts b/src/i18n/locales/ko.ts index 755a332..2b6d92b 100644 --- a/src/i18n/locales/ko.ts +++ b/src/i18n/locales/ko.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': '비공개 계정이라 프로필을 다시 보려면 팔로우 요청을 다시 보내야 해요.', 'social.cancelRequest': '요청 취소', 'social.unfollow': '언팔로우', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': '최근 본 작품', 'social.noRecent': '아직 다 본 작품이 없어요.', - 'social.statYear': '올해 본 작품', - 'social.statFilms': '본 영화', - 'social.statSeries': '본 시리즈 & 애니', 'social.emptyLibrary': '여기엔 작품이 없어요.', 'social.loadMore': '더 보기', 'social.changeBanner': '배너 변경', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "시작하기", 'welcome.later': "나중에", 'social.watching': "보는 중", - 'social.watchlist': "보고 싶어요", 'search.animeOnly': "TMDB 키가 없으면 애니만 찾을 수 있어요.", 'form.startShort': "시작일", 'form.endShort': "완료일", diff --git a/src/i18n/locales/nl.ts b/src/i18n/locales/nl.ts index ce6bdeb..1979e70 100644 --- a/src/i18n/locales/nl.ts +++ b/src/i18n/locales/nl.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Dit account is privé: je moet opnieuw een verzoek sturen om het profiel weer te zien.', 'social.cancelRequest': 'Verzoek annuleren', 'social.unfollow': 'Ontvolgen', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Onlangs gezien', 'social.noRecent': 'Nog niets uitgekeken.', - 'social.statYear': 'Gezien dit jaar', - 'social.statFilms': 'Films gezien', - 'social.statSeries': 'Series & anime gezien', 'social.emptyLibrary': 'Geen titels hier.', 'social.loadMore': 'Meer tonen', 'social.changeBanner': 'Banner wijzigen', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Aan de slag", 'welcome.later': "Later", 'social.watching': "Bezig", - 'social.watchlist': "Wil ik zien", 'search.animeOnly': "Zonder TMDB-sleutel worden alleen anime gevonden.", 'form.startShort': "Begonnen op", 'form.endShort': "Uitgekeken op", diff --git a/src/i18n/locales/pl.ts b/src/i18n/locales/pl.ts index 74d3fa1..211b1c5 100644 --- a/src/i18n/locales/pl.ts +++ b/src/i18n/locales/pl.ts @@ -722,12 +722,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'To konto jest prywatne: aby znów zobaczyć profil, trzeba będzie wysłać nową prośbę.', 'social.cancelRequest': 'Anuluj prośbę', 'social.unfollow': 'Przestań obserwować', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Ostatnio obejrzane', 'social.noRecent': 'Na razie nic nie zostało ukończone.', - 'social.statYear': 'Obejrzane w tym roku', - 'social.statFilms': 'Obejrzane filmy', - 'social.statSeries': 'Obejrzane seriale i anime', 'social.emptyLibrary': 'Brak tytułów.', 'social.loadMore': 'Pokaż więcej', 'social.changeBanner': 'Zmień baner', @@ -789,7 +787,6 @@ const dict: Translations = { 'welcome.go': 'Zaczynamy', 'welcome.later': 'Później', 'social.watching': 'W trakcie', - 'social.watchlist': 'Chce obejrzeć', 'search.animeOnly': 'Bez klucza TMDB można znaleźć tylko anime.', 'form.startShort': 'Rozpoczęto', 'form.endShort': 'Ukończono', diff --git a/src/i18n/locales/pt.ts b/src/i18n/locales/pt.ts index fcc66b7..8bc4d35 100644 --- a/src/i18n/locales/pt.ts +++ b/src/i18n/locales/pt.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Esta conta é privada: você vai precisar solicitar de novo para ver o perfil.', 'social.cancelRequest': 'Cancelar solicitação', 'social.unfollow': 'Deixar de seguir', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Vistos recentemente', 'social.noRecent': 'Nada concluído por enquanto.', - 'social.statYear': 'Vistos este ano', - 'social.statFilms': 'Filmes vistos', - 'social.statSeries': 'Séries e animes vistos', 'social.emptyLibrary': 'Nenhum título aqui.', 'social.loadMore': 'Ver mais', 'social.changeBanner': 'Trocar o banner', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Vamos lá", 'welcome.later': "Depois", 'social.watching': "Assistindo", - 'social.watchlist': "Quer assistir", 'search.animeOnly': "Sem chave do TMDB, só animes são encontrados.", 'form.startShort': "Começou", 'form.endShort': "Terminou", diff --git a/src/i18n/locales/ru.ts b/src/i18n/locales/ru.ts index e510e70..7155028 100644 --- a/src/i18n/locales/ru.ts +++ b/src/i18n/locales/ru.ts @@ -722,12 +722,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Это закрытый аккаунт: чтобы снова увидеть профиль, придётся отправить новый запрос.', 'social.cancelRequest': 'Отменить запрос', 'social.unfollow': 'Отписаться', + 'social.top1': 'Топ 1', 'social.top5': 'Топ 5', 'social.recent': 'Недавно просмотренные', 'social.noRecent': 'Пока ничего не досмотрено.', - 'social.statYear': 'Просмотрено в этом году', - 'social.statFilms': 'Просмотрено фильмов', - 'social.statSeries': 'Просмотрено сериалов и аниме', 'social.emptyLibrary': 'Здесь нет тайтлов.', 'social.loadMore': 'Показать ещё', 'social.changeBanner': 'Сменить баннер', @@ -789,7 +787,6 @@ const dict: Translations = { 'welcome.go': 'Поехали', 'welcome.later': 'Позже', 'social.watching': 'Смотрит', - 'social.watchlist': 'Хочет посмотреть', 'search.animeOnly': 'Без ключа TMDB можно найти только аниме.', 'form.startShort': 'Начато', 'form.endShort': 'Закончено', diff --git a/src/i18n/locales/th.ts b/src/i18n/locales/th.ts index 8c8f7dc..297a4bc 100644 --- a/src/i18n/locales/th.ts +++ b/src/i18n/locales/th.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'บัญชีนี้เป็นบัญชีส่วนตัว คุณจะต้องส่งคำขอใหม่เพื่อดูโปรไฟล์อีกครั้ง', 'social.cancelRequest': 'ยกเลิกคำขอ', 'social.unfollow': 'เลิกติดตาม', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'ดูล่าสุด', 'social.noRecent': 'ยังไม่มีเรื่องที่ดูจบ', - 'social.statYear': 'ดูในปีนี้', - 'social.statFilms': 'ภาพยนตร์ที่ดูแล้ว', - 'social.statSeries': 'ซีรีส์และอนิเมะที่ดูแล้ว', 'social.emptyLibrary': 'ไม่มีเรื่องที่นี่', 'social.loadMore': 'ดูเพิ่มเติม', 'social.changeBanner': 'เปลี่ยนแบนเนอร์', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': 'ไปกันเลย', 'welcome.later': 'ไว้ทีหลัง', 'social.watching': 'กำลังดู', - 'social.watchlist': 'อยากดู', 'search.animeOnly': 'หากไม่มีคีย์ TMDB จะค้นหาได้เฉพาะอนิเมะ', 'form.startShort': 'เริ่มดูเมื่อ', 'form.endShort': 'ดูจบเมื่อ', diff --git a/src/i18n/locales/tr.ts b/src/i18n/locales/tr.ts index f6b2d71..6c4624e 100644 --- a/src/i18n/locales/tr.ts +++ b/src/i18n/locales/tr.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Bu hesap gizli: profilini tekrar görmek için yeni bir istek göndermen gerekecek.', 'social.cancelRequest': 'İsteği iptal et', 'social.unfollow': 'Takibi bırak', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Son izlenenler', 'social.noRecent': 'Henüz biten bir şey yok.', - 'social.statYear': 'Bu yıl izlenen', - 'social.statFilms': 'İzlenen filmler', - 'social.statSeries': 'İzlenen dizi ve animeler', 'social.emptyLibrary': 'Burada yapım yok.', 'social.loadMore': 'Daha fazla göster', 'social.changeBanner': 'Kapağı değiştir', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "Hadi başlayalım", 'welcome.later': "Sonra", 'social.watching': "İzliyor", - 'social.watchlist': "İzlemek istiyor", 'search.animeOnly': "TMDB anahtarı olmadan yalnızca anime bulunabilir.", 'form.startShort': "Başlangıç", 'form.endShort': "Bitiş", diff --git a/src/i18n/locales/vi.ts b/src/i18n/locales/vi.ts index 76167c1..d535cad 100644 --- a/src/i18n/locales/vi.ts +++ b/src/i18n/locales/vi.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': 'Tài khoản này ở chế độ riêng tư: bạn sẽ phải gửi lại yêu cầu để xem hồ sơ của họ.', 'social.cancelRequest': 'Hủy yêu cầu', 'social.unfollow': 'Bỏ theo dõi', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': 'Xem gần đây', 'social.noRecent': 'Chưa xem xong phim nào.', - 'social.statYear': 'Đã xem năm nay', - 'social.statFilms': 'Phim lẻ đã xem', - 'social.statSeries': 'Phim bộ & anime đã xem', 'social.emptyLibrary': 'Không có phim nào ở đây.', 'social.loadMore': 'Xem thêm', 'social.changeBanner': 'Đổi ảnh bìa', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': 'Bắt đầu thôi', 'welcome.later': 'Để sau', 'social.watching': 'Đang xem', - 'social.watchlist': 'Muốn xem', 'search.animeOnly': 'Không có khóa TMDB thì chỉ tìm được anime.', 'form.startShort': 'Bắt đầu', 'form.endShort': 'Xem xong', diff --git a/src/i18n/locales/zh.ts b/src/i18n/locales/zh.ts index b65a83c..f3dc504 100644 --- a/src/i18n/locales/zh.ts +++ b/src/i18n/locales/zh.ts @@ -658,12 +658,10 @@ const dict: Translations = { 'social.unfollowPrivate': '这是私密账号:之后想再看 Ta 的主页需要重新申请。', 'social.cancelRequest': '取消申请', 'social.unfollow': '取消关注', + 'social.top1': 'Top 1', 'social.top5': 'Top 5', 'social.recent': '最近看过', 'social.noRecent': '暂时还没有看完的作品。', - 'social.statYear': '今年看过', - 'social.statFilms': '看过的电影', - 'social.statSeries': '看过的剧集和动画', 'social.emptyLibrary': '这里还没有作品。', 'social.loadMore': '查看更多', 'social.changeBanner': '更换横幅', @@ -723,7 +721,6 @@ const dict: Translations = { 'welcome.go': "开始吧", 'welcome.later': "稍后", 'social.watching': "正在看", - 'social.watchlist': "想看", 'search.animeOnly': "没有 TMDB 密钥时只能找到动画。", 'form.startShort': "开始于", 'form.endShort': "看完于", diff --git a/src/lib/cloud/social.ts b/src/lib/cloud/social.ts index 34a19d6..416578b 100644 --- a/src/lib/cloud/social.ts +++ b/src/lib/cloud/social.ts @@ -23,16 +23,6 @@ export interface ProfileCard { relation: Relation } -export interface ProfileStats { - total: number - finished: number - finishedYear: number - films: number - series: number - episodes: number - rated: number -} - export interface Profile extends ProfileCard { bio: string bannerUrl?: string @@ -41,11 +31,11 @@ export interface Profile extends ProfileCard { followers: number following: number visible: boolean - stats?: ProfileStats + /** Titres vus (absent si le profil n'est pas visible) */ + seen?: number top: MediaItem[] recent: MediaItem[] watching: MediaItem[] - watchlist: MediaItem[] } export interface FeedEntry { @@ -112,21 +102,10 @@ function toProfile(raw: unknown): Profile | null { followers: count(raw.followers), following: count(raw.following), visible: raw.visible === true, - stats: s - ? { - total: count(s.total), - finished: count(s.finished), - finishedYear: count(s.finished_year), - films: count(s.films), - series: count(s.series), - episodes: count(s.episodes), - rated: count(s.rated), - } - : undefined, + seen: s ? count(s.finished) : undefined, top: toItems(raw.top), recent: toItems(raw.recent), watching: toItems(raw.watching), - watchlist: toItems(raw.watchlist), } } diff --git a/supabase/migrations/20261128140000_profile_slim.sql b/supabase/migrations/20261128140000_profile_slim.sql new file mode 100644 index 0000000..41abc2d --- /dev/null +++ b/supabase/migrations/20261128140000_profile_slim.sql @@ -0,0 +1,71 @@ +-- Bobinoo — profil allégé (28 nov. 2026). Idempotent. +-- Le profil n'affiche plus les stats détaillées ni « À voir » (ils sont dans Stats et Bibliothèque), +-- et « Vus récemment » montre les 5 derniers : on n'envoie plus que ça. +create or replace function public.get_profile(p_username text) +returns jsonb language plpgsql stable security definer set search_path = '' as $$ +declare + p public.profiles; + me uuid := auth.uid(); + res jsonb; +begin + if me is null then + return null; + end if; + select * into p from public.profiles where username = lower(trim(p_username)); + if not found then + return null; + end if; + if p.suspended and p.id <> me and not public.is_admin() then + return null; + end if; + if p.id <> me and exists (select 1 from public.blocks b where b.blocker_id = p.id and b.blocked_id = me) then + return null; + end if; + res := public.profile_card(p) || jsonb_build_object( + 'bio', p.bio, + 'banner_url', p.banner_url, + 'is_me', p.id = me, + 'follows_me', exists (select 1 from public.follows where follower_id = p.id and following_id = me and status = 'accepted'), + 'followers', (select count(*) from public.follows where following_id = p.id and status = 'accepted'), + 'following', (select count(*) from public.follows where follower_id = p.id and status = 'accepted'), + 'visible', public.can_view(p.id) + ); + if public.can_view(p.id) then + res := res || jsonb_build_object( + 'stats', jsonb_build_object( + 'finished', (select count(*) from public.items where user_id = p.id and not deleted and data->>'status' = 'termine') + ), + 'top', ( + select coalesce(jsonb_agg(public.public_item(data) order by data->'top'->>'category', (data->'top'->>'rank')), '[]'::jsonb) + from public.items i + where i.user_id = p.id and not i.deleted and jsonb_typeof(i.data->'top') = 'object' + and coalesce( + (select s.data->'topCategories' ? (i.data->'top'->>'category') + from public.settings s where s.user_id = p.id and jsonb_typeof(s.data->'topCategories') = 'array'), + true) + ), + 'recent', ( + select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc nulls last), '[]'::jsonb) + from ( + select data, coalesce(data->>'endDate', data->>'startDate') as k + from public.items + where user_id = p.id and not deleted and data->>'status' = 'termine' + order by k desc nulls last limit 5 + ) s + ), + 'watching', ( + select coalesce(jsonb_agg(public.public_item(s.data) order by s.k desc nulls last), '[]'::jsonb) + from ( + select data, coalesce(data->>'startDate', left(data->>'updatedAt', 10)) as k + from public.items + where user_id = p.id and not deleted and data->>'status' = 'en_cours' + order by k desc nulls last limit 8 + ) s + ) + ); + end if; + return res; +end; +$$; +revoke execute on function public.get_profile(text) from public, anon; +grant execute on function public.get_profile(text) to authenticated;