diff --git a/CLAUDE.md b/CLAUDE.md index 095121a..af36673 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,8 +61,8 @@ 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'à `20261128170000_mfa_reads_and_fixes.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. +- **Toutes les migrations de `supabase/migrations/` sont appliquées en ligne**, jusqu'à `20261128180000_social_notifications.sql` incluse. +- **Notifications** (dans l'app, pas de push) : abonnements (`new_follower`, `follow_request`, `unfollow`, `follow_accepted`, trigger `follows_notify`), réaction / commentaire sur mon avis (`reaction`, `review_comment`, triggers sur `review_reactions` / `review_comments`), activité des comptes suivis (`friend_review`, `friend_started`, `friend_added`, trigger `items_notify` → `azuu_notify_followers`, rafales regroupées sur 3 h). Pas de notification pour les listes perso (privées). RPC `get_notifications` (avec le titre lié) / `unread_notifications` / `mark_notifications_read`. 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). - **Double authentification (TOTP)** : optionnelle, Réglages → Mon compte (`src/components/TwoFactor.tsx`, fonctions dans `src/lib/cloud/auth.ts`). À la connexion, `Root.tsx` demande le code (`MfaScreen`) si le compte a un facteur vérifié. Côté serveur, `azuu_mfa_ok()` : règles RLS restrictives « mfa required » (items, lists, settings, follows, profiles, activity), `is_admin()` et `azuu_me_active()` ; les fonctions Edge (`_shared/auth.ts`) refusent un jeton « aal1 » d'un compte protégé. - **Dépendances figées** : versions exactes dans `package.json` + `.npmrc` (`save-exact=true`), CI en `npm ci`. diff --git a/src/components/social/NotificationsSheet.tsx b/src/components/social/NotificationsSheet.tsx index ad92a63..fae967b 100644 --- a/src/components/social/NotificationsSheet.tsx +++ b/src/components/social/NotificationsSheet.tsx @@ -1,7 +1,8 @@ import { Loader2 } from 'lucide-react' import { useEffect, useState } from 'react' import { t, type TKey } from '../../i18n' -import { acceptFollower, getNotifications, markNotificationsRead, removeFollower, type FollowNotification } from '../../lib/cloud/social' +import { acceptFollower, getNotifications, markNotificationsRead, MINE_ITEM_KINDS, removeFollower, type FollowNotification } from '../../lib/cloud/social' +import Poster from '../Poster' import { timeAgo } from '../../lib/timeAgo' import { cx } from '../../lib/utils' import Avatar from './Avatar' @@ -13,9 +14,17 @@ const TEXT: Record = { follow_request: 'notif.followRequest', unfollow: 'notif.unfollow', follow_accepted: 'notif.followAccepted', + reaction: 'notif.reaction', + review_comment: 'notif.reviewComment', + friend_review: 'notif.friendReview', + friend_started: 'notif.friendStarted', + friend_added: 'notif.friendAdded', } -/** Qui s'est abonné, désabonné, a demandé à s'abonner ou a accepté ma demande. Ouvrir la liste la marque comme lue. */ +/** + * Abonnements (qui s'abonne, se désabonne, demande, accepte), réactions et commentaires sur mes avis, + * et activité des comptes que je suis (avis, série commencée, titre ajouté). Ouvrir la liste la marque comme lue. + */ export default function NotificationsSheet({ onClose, onSeen }: { onClose: () => void; onSeen: () => void }) { const social = useSocial() const [list, setList] = useState() @@ -38,6 +47,13 @@ export default function NotificationsSheet({ onClose, onSeen }: { onClose: () => // eslint-disable-next-line react-hooks/exhaustive-deps }, []) + // Toucher une notification : le titre concerné s'il y en a un (le mien ou celui de la personne), sinon son profil + const open = (n: FollowNotification) => { + if (!n.item) return social.openProfile(n.actor.username) + if (MINE_ITEM_KINDS.includes(n.kind)) social.openItem(n.item) + else social.openItem(n.item, { username: n.actor.username, displayName: n.actor.displayName, avatarUrl: n.actor.avatarUrl }) + } + const pending = new Set(social.requests.map((r) => r.id)) const answer = async (id: string, accept: boolean) => { setBusy(id) @@ -68,20 +84,25 @@ export default function NotificationsSheet({ onClose, onSeen }: { onClose: () =>