import type { Metadata } from 'next' import { setRequestLocale, getTranslations } from 'next-intl/server' import { redirect } from '@/i18n/navigation' import { getSession } from '@/lib/session' import { getPaymentTransactions, type PaymentTx } from '@/lib/trans-history' import { PageShell } from '@/components/PageShell' import { ServiceBox } from '@/components/ServiceBox' export const dynamic = 'force-dynamic' export const metadata: Metadata = { title: 'Historial de transacciones' } /** 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 StatusBadge({ status }: { status: PaymentTx['status'] }) { return {status} } /** Caja de una pasarela con su tabla de transacciones (o "No hay movimientos"). */ async function PlatformBox({ name, logo, note, txs, }: { name: string logo: string note: string txs: PaymentTx[] }) { const t = await getTranslations('History') return (
{t.rich('trans.paidNote', { s: (c) => {c} })}
{t('trans.important')} {note}
| {t('trans.noMovements')} |
| {t('trans.thTxId')} | {t('trans.thStatus')} | {t('trans.thConcept')} | {t('trans.thCreatedAt')} | {t('trans.thAmount')} |
|---|---|---|---|---|
| {t.id} |
|
{t.concept} | {fmt(t.createdAt)} | {t.amount.toFixed(2)} € |
{t('trans.intro1')}
{t('trans.intro2')}
{t.rich('trans.intro3', { mail: (c) => {c}, })}