651d8deafc
Se externaliza el texto español hardcodeado de ~55 archivos a next-intl y se añaden traducciones al inglés, con paridad de claves es/en. Nuevos namespaces: History, CharService, CharServiceB, Points, Legal, UI, Misc (+ altas en Common/Admin). - Historiales (PD/PV, transacciones, sanciones, seguridad), servicios de personaje (transfer, send-gift, quest, restore-*, change-*, customize, level-up, gold, rename), PD/pagos (d-points, trade, promo, transfer-dp, rename-guild, DPointsTabs), páginas legales (cookies, privacidad, términos, reembolsos, aviso legal, contacto), layout (cabecera, footer, cookies, 2FA, descargas, jugadores, recluta) y páginas varias (home, reino, ayuda, addons, 2falogin). - Textos con markup inline via t.rich; interpolación con ICU. - Componente <NoteLegend/> para la leyenda NOTA/NOTE compartida. - payLabel/confirmText de los servicios de pago traducidos. - Verificado: tsc OK, next build OK, todas las claves t() resuelven en es y en, todos los t.rich casan etiquetas, páginas 200 en /es/ y /en/ sin claves crudas. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
56 lines
1.8 KiB
TypeScript
56 lines
1.8 KiB
TypeScript
import type { RowDataPacket } from 'mysql2'
|
|
import { NoteLegend } from '@/components/NoteLegend'
|
|
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { redirect } from '@/i18n/navigation'
|
|
import { getSession } from '@/lib/session'
|
|
import { db, DB } from '@/lib/db'
|
|
import { PageShell } from '@/components/PageShell'
|
|
import { ServiceBox } from '@/components/ServiceBox'
|
|
import { SecurityTokenForm } from './SecurityTokenForm'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export default async function SecurityTokenPage({ params }: { params: Promise<{ locale: string }> }) {
|
|
const { locale } = await params
|
|
setRequestLocale(locale)
|
|
const t = await getTranslations('SecurityToken')
|
|
const session = await getSession()
|
|
if (!session.bnetId) redirect({ href: '/login', locale })
|
|
if (!session.username) redirect({ href: '/select-account', locale })
|
|
|
|
let tokenDate: string | null = null
|
|
try {
|
|
const [rows] = await db(DB.default).query<RowDataPacket[]>(
|
|
'SELECT created_at FROM home_securitytoken WHERE user_id = ? ORDER BY created_at DESC LIMIT 1',
|
|
[session.accountId ?? 0],
|
|
)
|
|
if (rows[0]) tokenDate = new Date(rows[0].created_at).toISOString()
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
|
|
return (
|
|
<PageShell title={t('title')}>
|
|
<ServiceBox>
|
|
<br />
|
|
<p>{t.rich('info1', { b: (c) => <span>{c}</span> })}</p>
|
|
<p>{t('info2')}</p>
|
|
<br />
|
|
<p>{t('info3')}</p>
|
|
<p>{t('info4')}</p>
|
|
<br />
|
|
<p><span className="red-info2">{t('warning')}</span></p>
|
|
<br />
|
|
<fieldset>
|
|
<NoteLegend />
|
|
<div className="separate2">
|
|
<p>{t('note')}</p>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<SecurityTokenForm initialDate={tokenDate} />
|
|
</ServiceBox>
|
|
</PageShell>
|
|
)
|
|
}
|