Réglages : choisir ses notifications ; journal de la console lisible
deploy / deploy (push) Successful in 1m12s

- Réglages → Notifications (comptes connectés) : un interrupteur par type, en 3 groupes (abonnements,
  mes avis, activité des comptes suivis), 18 langues. Choix synchronisé (settings.notifOff).
- Serveur (20261201110000, appliquée) : une notification d'un type désactivé n'est pas créée (trigger
  notifications_wanted) ; celles déjà reçues sont masquées de la liste et du compteur.
- Console : les détails des connexions étaient enregistrés comme texte JSON et affichés lettre par
  lettre. Enregistrement corrigé (sql.json), anciennes lignes remises en forme à la lecture
  (20261201100000), appareil affiché en clair (« Chrome · Windows »).

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-12-01 10:10:33 +00:00
1 parent 7903064147
commit 43e2ecd589
28 files changed
+432 -10

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
import { t, type TKey } from '../i18n'
import { cx } from '../lib/utils'
import { useMedia } from '../store'
import { NOTIF_KINDS, type NotifKind } from '../types'
import { SectionTitle } from './ui'
const GROUPS: { title: TKey; kinds: [NotifKind, TKey][] }[] = [
{
title: 'notifPrefs.follows',
kinds: [
['new_follower', 'notifPrefs.new_follower'],
['follow_request', 'notifPrefs.follow_request'],
['follow_accepted', 'notifPrefs.follow_accepted'],
['unfollow', 'notifPrefs.unfollow'],
],
},
{
title: 'notifPrefs.reviews',
kinds: [
['reaction', 'notifPrefs.reaction'],
['review_comment', 'notifPrefs.review_comment'],
],
},
{
title: 'notifPrefs.friends',
kinds: [
['friend_review', 'notifPrefs.friend_review'],
['friend_started', 'notifPrefs.friend_started'],
['friend_added', 'notifPrefs.friend_added'],
],
},
]
/**
* Réglages → Notifications : ce qu'on veut recevoir dans la cloche.
* Les types désactivés sont dans les réglages synchronisés (notifOff) : le serveur ne les crée plus
* et masque ceux déjà reçus (migration 20261201110000_notification_prefs).
*/
export default function NotificationSettings() {
const { settings, updateSettings } = useMedia()
const off = new Set(settings.notifOff ?? [])
const toggle = (kind: NotifKind) => {
const next = new Set(off)
if (next.has(kind)) next.delete(kind)
else next.add(kind)
updateSettings({ notifOff: NOTIF_KINDS.filter((k) => next.has(k)) })
}
return (
<>
<SectionTitle>{t('notif.title')}</SectionTitle>
<p className="-mt-1 mb-3 text-xs text-ink-3">{t('notifPrefs.hint')}</p>
<div className="card divide-y divide-line overflow-hidden">
{GROUPS.map((g) => (
<div key={g.title} className="px-4 pb-1.5 pt-3">
<p className="text-xs font-semibold uppercase tracking-wide text-ink-3">{t(g.title)}</p>
{g.kinds.map(([kind, label]) => {
const on = !off.has(kind)
return (
<button key={kind} type="button" role="switch" aria-checked={on} onClick={() => toggle(kind)} className="flex w-full items-center gap-3 py-2.5 text-start">
<span className="flex-1 text-sm">{t(label)}</span>
<span className={cx('relative h-6 w-11 shrink-0 rounded-full transition-colors', on ? 'bg-accent-fill' : 'border border-line-strong bg-surface-2')}>
<span className={cx('absolute top-0.5 size-5 rounded-full', on ? 'start-[22px] bg-on-accent' : 'start-0.5 bg-ink')} />
</span>
</button>
)
})}
</div>
))}
</div>
</>
)
}