Administration retirée : signalements et bugs par e-mail, base allégée
deploy / deploy (push) Successful in 46s
deploy / deploy (push) Successful in 46s
- Écran d'administration supprimé (page, onglets de modération, alertes, appels admin). - « Signaler » (avis, commentaire, profil, liste) et « Signaler un bug » ouvrent un e-mail pré-rempli vers contact@bobinoo.org (motifs en rappel, références du contenu ; version et appareil pour un bug). - Remontée automatique des erreurs supprimée. À la place : une ancienne version ouverte qui ne trouve plus un fichier après une mise à jour se recharge d'elle-même (« Importing a module script failed »). - Base (20261130120000_remove_admin, appliquée) : 20 fonctions et 5 tables d'administration supprimées (admins, reports, bug_reports, client_errors, moderation_log) ; get_profile, get_review_comments, delete_review_comment, delete_shared_list et la garde de suspension réécrites sans « admin ». Suspension d'un compte : à la main dans Supabase. - 116 textes inutilisés retirés dans chacune des 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:
38 files changed
+299
-4008
No files matched your search
@@ -1,10 +1,30 @@
|
||||
import { Component, type ErrorInfo, type ReactNode } from 'react'
|
||||
import { Component, type ReactNode } from 'react'
|
||||
import { t } from '../i18n'
|
||||
import { reportError } from '../lib/errorReporter'
|
||||
|
||||
/** Fichier d'un écran introuvable : une nouvelle version a été mise en ligne pendant que l'app était ouverte. */
|
||||
const isOutdatedFile = (e: unknown) =>
|
||||
/Importing a module script failed|Failed to fetch dynamically imported module|error loading dynamically imported module|Unable to preload CSS/i.test(
|
||||
String((e as Error)?.message ?? e),
|
||||
)
|
||||
|
||||
/** Recharge l'app une seule fois par minute (jamais en boucle si le problème est ailleurs). */
|
||||
function reloadOnce(): boolean {
|
||||
const KEY = 'azuucine:reloaded-at'
|
||||
try {
|
||||
const last = Number(sessionStorage.getItem(KEY) ?? 0)
|
||||
if (Date.now() - last < 60_000) return false
|
||||
sessionStorage.setItem(KEY, String(Date.now()))
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
location.reload()
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Filet de sécurité global : si l'affichage plante, on montre un écran propre
|
||||
* (« Oups… ») au lieu d'une page blanche, et l'erreur est remontée (sans donnée perso).
|
||||
* Filet de sécurité global : si l'affichage plante, on montre un écran propre (« Oups… ») au lieu d'une page blanche.
|
||||
* Cas fréquent après une mise à jour : l'ancienne version ouverte cherche un fichier qui n'existe plus →
|
||||
* l'app se recharge d'elle-même sur la nouvelle version.
|
||||
*/
|
||||
export default class ErrorBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
|
||||
state = { failed: false }
|
||||
@@ -13,8 +33,8 @@ export default class ErrorBoundary extends Component<{ children: ReactNode }, {
|
||||
return { failed: true }
|
||||
}
|
||||
|
||||
componentDidCatch(error: unknown, info: ErrorInfo) {
|
||||
reportError(error, 'render', info.componentStack ?? '')
|
||||
componentDidCatch(error: unknown) {
|
||||
if (isOutdatedFile(error)) reloadOnce()
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import { Bug, Check, Loader2, Mail } from 'lucide-react'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { Bug, Mail } from 'lucide-react'
|
||||
import { t, type TKey } from '../../i18n'
|
||||
import { techInfo } from '../../lib/appInfo'
|
||||
import { useBackToClose } from '../../lib/backNav'
|
||||
import { BUG_DESCRIPTION_MAX, BUG_DESCRIPTION_MIN, submitBugReport } from '../../lib/cloud/moderation'
|
||||
import { useEscape } from '../../lib/escape'
|
||||
import { useScrollLock } from '../../lib/scrollLock'
|
||||
import { useMedia } from '../../store'
|
||||
|
||||
/** Contact de l'éditeur (sans compte, le formulaire n'est pas disponible). */
|
||||
export const SUPPORT_URL = 'mailto:contact@bobinoo.org'
|
||||
/** Adresse de contact de l'éditeur (bugs, signalements, questions). */
|
||||
export const CONTACT_EMAIL = 'contact@bobinoo.org'
|
||||
|
||||
/** Lien « mailto: » avec objet et texte pré-remplis. */
|
||||
export function mailto(subject: string, body: string): string {
|
||||
return `mailto:${CONTACT_EMAIL}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`
|
||||
}
|
||||
|
||||
const INFO_LABEL: Record<string, TKey> = {
|
||||
version: 'bug.info.version',
|
||||
@@ -25,143 +24,25 @@ const INFO_LABEL: Record<string, TKey> = {
|
||||
online: 'bug.info.online',
|
||||
}
|
||||
|
||||
/** Ligne « Signaler un bug » de la section « À propos » des réglages. */
|
||||
/**
|
||||
* Ligne « Signaler un bug » des réglages : ouvre un e-mail vers contact@bobinoo.org, avec la version de l'app
|
||||
* et l'appareil en bas du message (rien de personnel : ni compte, ni bibliothèque).
|
||||
*/
|
||||
export function BugReportRow() {
|
||||
const { account } = useMedia()
|
||||
const [open, setOpen] = useState(false)
|
||||
if (!account) {
|
||||
return (
|
||||
<a href={SUPPORT_URL} className="flex items-center gap-3.5 px-4 py-4 transition-colors active:bg-surface-2">
|
||||
<Bug size={19} className="text-ink-2" />
|
||||
<span className="flex-1">
|
||||
<span className="block font-medium">{t('bug.title')}</span>
|
||||
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hintLocal')}</span>
|
||||
</span>
|
||||
<Mail size={16} className="text-ink-3" />
|
||||
</a>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<button type="button" onClick={() => setOpen(true)} className="flex w-full items-center gap-3.5 px-4 py-4 text-start transition-colors active:bg-surface-2">
|
||||
<Bug size={19} className="text-ink-2" />
|
||||
<span className="flex-1">
|
||||
<span className="block font-medium">{t('bug.title')}</span>
|
||||
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hint')}</span>
|
||||
</span>
|
||||
<span className="text-ink-3">→</span>
|
||||
</button>
|
||||
{open && createPortal(<BugReportDialog onClose={() => setOpen(false)} />, document.body)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
/** Formulaire « Signaler un bug » : description + infos techniques (montrées avant l'envoi, rien de personnel). */
|
||||
function BugReportDialog({ onClose }: { onClose: () => void }) {
|
||||
const { settings } = useMedia()
|
||||
const info = useMemo(() => techInfo(settings.themeMode), [settings.themeMode])
|
||||
const [text, setText] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [error, setError] = useState<string>()
|
||||
const [done, setDone] = useState(false)
|
||||
useScrollLock()
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
|
||||
const tooShort = text.trim().length < BUG_DESCRIPTION_MIN
|
||||
|
||||
const submit = async () => {
|
||||
if (tooShort || busy) return
|
||||
setBusy(true)
|
||||
setError(undefined)
|
||||
try {
|
||||
await submitBugReport(text, info)
|
||||
setDone(true)
|
||||
} catch (e) {
|
||||
setError((e as Error).message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
// Infos calculées au toucher (page, fenêtre, réseau du moment)
|
||||
const open = () => {
|
||||
const info = Object.entries(techInfo(settings.themeMode)).map(([k, v]) => `${INFO_LABEL[k] ? t(INFO_LABEL[k]) : k} : ${v}`)
|
||||
window.location.href = mailto(`${t('bug.title')} · Bobinoo`, `${t('bug.intro')}\n\n\n\n—\n${info.join('\n')}`)
|
||||
}
|
||||
|
||||
return (
|
||||
<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"
|
||||
aria-labelledby="bug-title"
|
||||
className="sheet-in safe-bottom max-h-[92dvh] w-full max-w-lg touch-pan-y overflow-y-auto overscroll-contain rounded-t-3xl border border-line-strong bg-surface p-5 sm:rounded-3xl"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{done ? (
|
||||
<div className="flex flex-col items-center py-4 text-center">
|
||||
<span className="grid size-12 place-items-center rounded-full border border-line-strong text-accent">
|
||||
<Check size={22} />
|
||||
</span>
|
||||
<h2 id="bug-title" className="mt-4 text-lg font-semibold">
|
||||
{t('bug.thanks')}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm leading-relaxed text-ink-2">{t('bug.thanksText')}</p>
|
||||
<button type="button" onClick={onClose} className="btn btn-ghost mt-6 w-full" autoFocus>
|
||||
{t('common.close')}
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<h2 id="bug-title" className="flex items-center gap-2 text-lg font-semibold">
|
||||
<Bug size={18} className="text-accent" />
|
||||
{t('bug.title')}
|
||||
</h2>
|
||||
<p className="mt-1.5 text-sm text-ink-3">{t('bug.intro')}</p>
|
||||
|
||||
<label className="mt-4 block">
|
||||
<span className="label">{t('bug.description')}</span>
|
||||
<textarea
|
||||
className="field min-h-32 resize-y text-sm"
|
||||
maxLength={BUG_DESCRIPTION_MAX}
|
||||
value={text}
|
||||
onChange={(e) => setText(e.target.value)}
|
||||
placeholder={t('bug.placeholder')}
|
||||
autoFocus
|
||||
/>
|
||||
<span className="mt-1 block text-end text-[11px] tabular-nums text-ink-3">
|
||||
{text.length}/{BUG_DESCRIPTION_MAX}
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<details className="mt-2 rounded-xl border border-line px-3.5 py-2.5 text-sm" open>
|
||||
<summary className="cursor-pointer font-medium text-ink-2">{t('bug.techTitle')}</summary>
|
||||
<dl className="mt-2 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-xs">
|
||||
{Object.entries(info).map(([k, v]) => (
|
||||
<div key={k} className="contents">
|
||||
<dt className="text-ink-3">{INFO_LABEL[k] ? t(INFO_LABEL[k]) : k}</dt>
|
||||
<dd className="min-w-0 break-words text-ink-2" dir="ltr">
|
||||
{v}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<p className="mt-2 text-[11px] leading-relaxed text-ink-3">{t('bug.techPrivacy')}</p>
|
||||
</details>
|
||||
|
||||
{error && (
|
||||
<p role="alert" className="mt-3 rounded-xl border border-accent px-3 py-2 text-sm text-ink">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="mt-4 grid grid-cols-2 gap-2">
|
||||
<button type="button" onClick={onClose} className="btn btn-ghost">
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button type="button" onClick={submit} disabled={tooShort || busy} className="btn btn-primary">
|
||||
{busy && <Loader2 size={16} className="animate-spin" />}
|
||||
{t('bug.send')}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" onClick={open} className="flex w-full items-center gap-3.5 px-4 py-4 text-start transition-colors active:bg-surface-2">
|
||||
<Bug size={19} className="text-ink-2" />
|
||||
<span className="flex-1">
|
||||
<span className="block font-medium">{t('bug.title')}</span>
|
||||
<span className="mt-0.5 block text-xs text-ink-3">{t('bug.hintLocal')}</span>
|
||||
</span>
|
||||
<Mail size={16} className="text-ink-3" />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -1,12 +1,38 @@
|
||||
import { Flag, MoreHorizontal } from 'lucide-react'
|
||||
import { useState, type ReactNode } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { t } from '../../i18n'
|
||||
import { t, type TKey } from '../../i18n'
|
||||
import { useBackToClose } from '../../lib/backNav'
|
||||
import type { ReportTarget } from '../../lib/cloud/moderation'
|
||||
import { REPORT_REASONS, type ReportReason, type ReportTarget } from '../../lib/cloud/moderation'
|
||||
import { useEscape } from '../../lib/escape'
|
||||
import { cx } from '../../lib/utils'
|
||||
import ReportDialog from './ReportDialog'
|
||||
import { mailto } from './BugReport'
|
||||
|
||||
const REASON_LABEL: Record<ReportReason, TKey> = {
|
||||
spoiler: 'report.reason.spoiler',
|
||||
harassment: 'report.reason.harassment',
|
||||
hate: 'report.reason.hate',
|
||||
sexual: 'report.reason.sexual',
|
||||
spam: 'report.reason.spam',
|
||||
impersonation: 'report.reason.impersonation',
|
||||
other: 'report.reason.other',
|
||||
}
|
||||
|
||||
const TITLE: Record<ReportTarget['type'], TKey> = {
|
||||
review: 'report.titleReview',
|
||||
profile: 'report.titleProfile',
|
||||
comment: 'report.titleComment',
|
||||
list: 'report.titleList',
|
||||
}
|
||||
|
||||
/** Signalement par e-mail vers contact@bobinoo.org : motifs possibles en rappel, références du contenu en bas. */
|
||||
function reportMail(target: ReportTarget): string {
|
||||
const reasons = REPORT_REASONS.map((r) => t(REASON_LABEL[r])).join(' · ')
|
||||
return mailto(
|
||||
`${t(TITLE[target.type])} · Bobinoo`,
|
||||
`${t('report.reason')} (${reasons}) :\n\n\n${t('report.details')} :\n\n\n—\n${target.type} · ${target.id} · ${target.userId}`,
|
||||
)
|
||||
}
|
||||
|
||||
export interface MenuAction {
|
||||
icon: ReactNode
|
||||
@@ -15,8 +41,8 @@ export interface MenuAction {
|
||||
}
|
||||
|
||||
/**
|
||||
* Bouton « ⋯ » réutilisable : ouvre un petit menu avec « Signaler » (+ actions en plus,
|
||||
* ex. « Bloquer »), puis la fenêtre de signalement. Cible générique : avis, profil, commentaire, liste.
|
||||
* Bouton « ⋯ » réutilisable : ouvre un petit menu avec « Signaler » (+ actions en plus, ex. « Bloquer »).
|
||||
* « Signaler » ouvre un e-mail pré-rempli. Cible générique : avis, profil, commentaire, liste.
|
||||
*/
|
||||
export default function ReportButton({
|
||||
target,
|
||||
@@ -30,7 +56,6 @@ export default function ReportButton({
|
||||
size?: number
|
||||
}) {
|
||||
const [menu, setMenu] = useState(false)
|
||||
const [report, setReport] = useState(false)
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
@@ -66,7 +91,7 @@ export default function ReportButton({
|
||||
danger
|
||||
onClick={() => {
|
||||
setMenu(false)
|
||||
setReport(true)
|
||||
window.location.href = reportMail(target)
|
||||
}}
|
||||
>
|
||||
{t('report.action')}
|
||||
@@ -74,7 +99,6 @@ export default function ReportButton({
|
||||
</ActionMenu>,
|
||||
document.body,
|
||||
)}
|
||||
{report && createPortal(<ReportDialog target={target} onClose={() => setReport(false)} />, document.body)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
import { Check, Flag, Loader2 } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { t, type TKey } from '../../i18n'
|
||||
import { useBackToClose } from '../../lib/backNav'
|
||||
import { REPORT_DETAILS_MAX, REPORT_REASONS, reportContent, type ReportReason, type ReportTarget } from '../../lib/cloud/moderation'
|
||||
import { useEscape } from '../../lib/escape'
|
||||
import { useScrollLock } from '../../lib/scrollLock'
|
||||
import { cx } from '../../lib/utils'
|
||||
|
||||
const REASON_LABEL: Record<ReportReason, TKey> = {
|
||||
spoiler: 'report.reason.spoiler',
|
||||
harassment: 'report.reason.harassment',
|
||||
hate: 'report.reason.hate',
|
||||
sexual: 'report.reason.sexual',
|
||||
spam: 'report.reason.spam',
|
||||
impersonation: 'report.reason.impersonation',
|
||||
other: 'report.reason.other',
|
||||
}
|
||||
export const reasonLabel = (r: ReportReason) => t(REASON_LABEL[r])
|
||||
|
||||
const TITLE: Record<ReportTarget['type'], TKey> = {
|
||||
review: 'report.titleReview',
|
||||
profile: 'report.titleProfile',
|
||||
comment: 'report.titleComment',
|
||||
list: 'report.titleList',
|
||||
}
|
||||
|
||||
/**
|
||||
* Fenêtre « Signaler » générique (avis, profil, commentaire, liste partagée) :
|
||||
* motif + précision facultative (500 caractères), envoyée à l'équipe de modération.
|
||||
*/
|
||||
export default function ReportDialog({ target, onClose }: { target: ReportTarget; onClose: () => void }) {
|
||||
const [reason, setReason] = useState<ReportReason>()
|
||||
const [details, setDetails] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [error, setError] = useState<string>()
|
||||
const [done, setDone] = useState<'sent' | 'duplicate'>()
|
||||
useScrollLock()
|
||||
useEscape(onClose)
|
||||
useBackToClose(onClose)
|
||||
|
||||
const submit = async () => {
|
||||
if (!reason || busy) return
|
||||
setBusy(true)
|
||||
setError(undefined)
|
||||
try {
|
||||
const r = await reportContent(target, reason, details)
|
||||
setDone(r.duplicate ? 'duplicate' : 'sent')
|
||||
} catch (e) {
|
||||
setError((e as Error).message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<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"
|
||||
aria-labelledby="report-title"
|
||||
className="sheet-in safe-bottom max-h-[90dvh] w-full max-w-md touch-pan-y overflow-y-auto overscroll-contain rounded-t-3xl border border-line-strong bg-surface p-5 sm:rounded-3xl"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{done ? (
|
||||
<div className="flex flex-col items-center py-4 text-center">
|
||||
<span className="grid size-12 place-items-center rounded-full border border-line-strong text-accent">
|
||||
<Check size={22} />
|
||||
</span>
|
||||
<h2 id="report-title" className="mt-4 text-lg font-semibold">
|
||||
{done === 'sent' ? t('report.thanks') : t('report.already')}
|
||||
</h2>
|
||||
<p className="mt-2 text-sm leading-relaxed text-ink-2">{t('report.thanksText')}</p>
|
||||
<button type="button" onClick={onClose} className="btn btn-ghost mt-6 w-full" autoFocus>
|
||||
{t('common.close')}
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<h2 id="report-title" className="flex items-center gap-2 text-lg font-semibold">
|
||||
<Flag size={18} className="text-accent" />
|
||||
{t(TITLE[target.type])}
|
||||
</h2>
|
||||
<p className="mt-1.5 text-sm text-ink-3">{t('report.intro')}</p>
|
||||
|
||||
<fieldset className="mt-4">
|
||||
<legend className="label">{t('report.reason')}</legend>
|
||||
<div className="space-y-1.5">
|
||||
{REPORT_REASONS.map((r) => (
|
||||
<label
|
||||
key={r}
|
||||
className={cx(
|
||||
'flex cursor-pointer items-center gap-3 rounded-xl border px-3.5 py-2.5 text-sm transition-colors',
|
||||
reason === r ? 'border-accent text-ink' : 'border-line text-ink-2',
|
||||
)}
|
||||
>
|
||||
<input type="radio" name="report-reason" value={r} checked={reason === r} onChange={() => setReason(r)} className="accent-accent-fill" />
|
||||
{reasonLabel(r)}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<label className="mt-4 block">
|
||||
<span className="label">{t('report.details')}</span>
|
||||
<textarea
|
||||
className="field min-h-24 resize-y text-sm"
|
||||
maxLength={REPORT_DETAILS_MAX}
|
||||
value={details}
|
||||
onChange={(e) => setDetails(e.target.value)}
|
||||
placeholder={t('report.detailsPlaceholder')}
|
||||
/>
|
||||
<span className="mt-1 block text-end text-[11px] tabular-nums text-ink-3">
|
||||
{details.length}/{REPORT_DETAILS_MAX}
|
||||
</span>
|
||||
</label>
|
||||
|
||||
{error && (
|
||||
<p role="alert" className="mt-2 rounded-xl border border-accent px-3 py-2 text-sm text-ink">
|
||||
{error}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="mt-4 grid grid-cols-2 gap-2">
|
||||
<button type="button" onClick={onClose} className="btn btn-ghost">
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button type="button" onClick={submit} disabled={!reason || busy} className="btn btn-primary">
|
||||
{busy && <Loader2 size={16} className="animate-spin" />}
|
||||
{t('report.send')}
|
||||
</button>
|
||||
</div>
|
||||
<p className="mt-3 text-[11px] leading-relaxed text-ink-3">{t('report.privacy')}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { t } from '../../i18n'
|
||||
import { adminAlerts, type AdminAlerts } from '../../lib/cloud/adminModeration'
|
||||
|
||||
/** Compteurs « à traiter » de l'administration (signalements ouverts, nouveaux bugs, nouvelles erreurs). */
|
||||
export function useAdminAlerts(enabled: boolean, refreshKey: unknown = 0): AdminAlerts | null {
|
||||
const [alerts, setAlerts] = useState<AdminAlerts | null>(null)
|
||||
useEffect(() => {
|
||||
if (!enabled) return setAlerts(null)
|
||||
let alive = true
|
||||
adminAlerts()
|
||||
.then((a) => alive && setAlerts(a))
|
||||
.catch(() => alive && setAlerts(null))
|
||||
return () => {
|
||||
alive = false
|
||||
}
|
||||
}, [enabled, refreshKey])
|
||||
return alerts
|
||||
}
|
||||
|
||||
/** Résumé court pour la ligne « Administration » des réglages (undefined s'il n'y a rien à traiter). */
|
||||
export function alertsSummary(a: AdminAlerts | null): string | undefined {
|
||||
if (!a) return undefined
|
||||
const parts = [
|
||||
a.reports ? t('adminMod.alertReports', { count: a.reports }) : '',
|
||||
a.bugs ? t('adminMod.alertBugs', { count: a.bugs }) : '',
|
||||
a.errors ? t('adminMod.alertErrors', { count: a.errors }) : '',
|
||||
].filter(Boolean)
|
||||
return parts.length ? parts.join(' · ') : undefined
|
||||
}
|
||||
Reference in new issue
Block a user