Files
NightSpire/web-next/components/PlayersBoard.tsx
T
Inna 651d8deafc i18n: traducir toda la app (ES + EN) — páginas y componentes con texto hardcodeado
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>
2026-07-14 18:58:54 +00:00

149 lines
6.0 KiB
TypeScript

import { getTranslations } from 'next-intl/server'
import {
getPlayersData,
CLASS_INFO,
raceBig,
classMedium,
classChest,
ALLIANCE_ICON,
HORDE_ICON,
} from '@/lib/players'
/* eslint-disable @next/next/no-img-element */
export async function PlayersBoard() {
const t = await getTranslations('UI')
const data = await getPlayersData()
return (
<>
<div className="box-content">
<div className="body-box-content centered">
<p><i className="fas fa-exclamation-triangle"></i> {t('players.updateNotice')}</p>
</div>
</div>
{/* Personajes creados por clase */}
<div className="box-content">
<div className="title-box-content centered"><h2>{t('players.charsByClass')}</h2></div>
<div className="body-box-content centered">
<div className="show-players">
{data.classStats.map((s) => (
<div className="inline-div" key={s.id}>
<table className="players-table">
<tbody>
<tr><td><img className="img-med-icon chest-medium" src={classChest(s.id)} alt={CLASS_INFO[s.id].label} /></td></tr>
<tr><td><span className={s.key}>{t('players.total')} <span>{s.total}</span></span></td></tr>
<tr><td><hr /></td></tr>
<tr><td className="lefted"><img className="img-small-icon-m img-align" src={ALLIANCE_ICON} alt={t('players.allianceAlt')} /> <span className={s.key}>{t('players.alliances')} <span>{s.alliance}</span></span></td></tr>
<tr><td className="lefted"><img className="img-small-icon-m img-align" src={HORDE_ICON} alt={t('players.hordeAlt')} /> <span className={s.key}>{t('players.hordes')} <span>{s.horde}</span></span></td></tr>
</tbody>
</table>
</div>
))}
<table className="max-center-table2">
<tbody>
<tr>
<td>{t('players.totalChars')} <span>{data.totals.total}</span></td>
<td><span className="alliance-color">{t('players.allianceChars')}</span> <span>{data.totals.alliance}</span></td>
<td><span className="horde-color">{t('players.hordeChars')}</span> <span>{data.totals.horde}</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<br /><hr /><br />
{/* Primeros del Reino - Nivel 80 */}
<div className="box-content">
<div className="title-box-content centered"><h2>{t('players.firstsTitle')}</h2></div>
<div className="body-box-content justified">
{data.firsts.length === 0 ? (
<p className="centered second-brown">{t('players.noLevel80')}</p>
) : (
<table className="max-left-table2">
<tbody>
<tr>
<th>{t('players.thAchievement')}</th>
<th>{t('players.thCharacter')}</th>
<th className="responsive-td">{t('players.thDate')}</th>
</tr>
{data.firsts.map((f, i) => (
<tr key={i}>
<td>
<img className="img-small-icon img-small-icon-h img-align" src={f.icon} alt="" />{' '}
<span className="yellow-info"><span className="yellow-info responsive-td">{t('players.firstOfRealm')}</span><span className="yellow-info"> {f.label}</span></span>
</td>
<td className={`${f.classKey} big-font`}>{f.name}</td>
<td className="responsive-td"><span>{f.date}</span></td>
</tr>
))}
</tbody>
</table>
)}
</div>
</div>
<br /><hr /><br />
{/* Top de logros */}
<div className="box-content">
<div className="title-box-content centered"><h2>{t('players.topAchTitle')}</h2></div>
<div className="body-box-content centered">
<p>{t('players.topAchSub')}</p>
<table className="char-center-table">
<tbody>
<tr>
<th>{t('players.thName')}</th>
<th>{t('players.thRace')}</th>
<th>{t('players.thClass')}</th>
<th>{t('players.thAchPoints')}</th>
</tr>
{data.topAch.map((r, i) => (
<tr key={i}>
<td className={`${r.classKey} big-font`}>{r.name}</td>
<td><img className="img-small-icon img-small-icon-h" src={raceBig(r.race, 0)} alt="" /></td>
<td><img className="img-small-icon img-small-icon-h" src={classMedium(r.class)} alt="" /></td>
<td><span>{r.value}</span></td>
</tr>
))}
</tbody>
</table>
</div>
</div>
<br /><hr /><br />
{/* Top de muertes con honor */}
<div className="box-content">
<div className="title-box-content centered"><h2>{t('players.topHonorTitle')}</h2></div>
<div className="body-box-content centered">
<p>{t('players.topHonorSub')}</p>
<table className="char-center-table">
<tbody>
<tr>
<th>{t('players.thName')}</th>
<th>{t('players.thRace')}</th>
<th>{t('players.thClass')}</th>
<th>{t('players.thTotalKills')}</th>
<th>{t('players.thTodayKills')}</th>
</tr>
{data.topHonor.map((r, i) => (
<tr key={i}>
<td className={`${r.classKey} big-font`}>{r.name}</td>
<td><img className="img-small-icon img-small-icon-h" src={raceBig(r.race, 0)} alt="" /></td>
<td><img className="img-small-icon img-small-icon-h" src={classMedium(r.class)} alt="" /></td>
<td><span>{r.total}</span></td>
<td><span>{r.today}</span></td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</>
)
}