import type { Metadata } from 'next' import { setRequestLocale, getTranslations } from 'next-intl/server' import { redirect, Link } from '@/i18n/navigation' import { getSession } from '@/lib/session' import { getSanctions, type Sanction } from '@/lib/ban-history' import { PageShell } from '@/components/PageShell' import { ServiceBox } from '@/components/ServiceBox' export const dynamic = 'force-dynamic' export const metadata: Metadata = { title: 'Historial de sanciones' } /** Fecha en formato DD-MM-YYYY HH:MM:SS. */ function fmt(d: Date): string { const p = (n: number) => String(n).padStart(2, '0') return `${p(d.getDate())}-${p(d.getMonth() + 1)}-${d.getFullYear()} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}` } function StatusCell({ s }: { s: Sanction }) { return {s.status} } /** Caja con la tabla de sanciones (baneos o muteos), o el vacío del diseño. */ async function SanctionBox({ title, emptyText, rows, showScope, }: { title: string emptyText: string rows: Sanction[] showScope: boolean }) { const t = await getTranslations('History') return (
| {emptyText} |
| {t('ban.thScope')} | }{t('ban.thReason')} | {t('ban.thBy')} | {t('ban.thDate')} | {t('ban.thExpires')} | {t('ban.thStatus')} |
|---|---|---|---|---|---|
| {s.scope} | )}{s.reason} | {s.by} | {fmt(s.date)} | {s.expires ? fmt(s.expires) : t('ban.permanent')} |
|
{t('ban.intro1')}
{t.rich('ban.intro2', { s: (c) => {c} })}
{t('ban.intro3')}
{t('ban.important')}
{t('ban.autoBlock1')}
{t('ban.autoBlock2')}
{t.rich('ban.claim', { link: (c) => {c} })}