cc158d3819
Reescritura completa del frontend Next.js del sistema visual Tailwind "simulado" al tema Django original (nw-ryu), para paridad pixel con la web actual antes del cutover. - Tema real: copia de static/nw-themes/nw-ryu + favicons a public/, el layout carga el novavow-style.css real de ultimo (gana la cascada sobre Tailwind) + Font Awesome. - Shell replicando los partials Django: SiteHeader, Video, Social, Footer, ServerClock; home con estructura real (main-page/middle-content/...). - Helpers reutilizables: PageShell (main-page > middle-content > body-content > title-content) y ServiceBox (title-box-content + back-to-account). - Paginas migradas a clases reales del tema (fieldset/tool-button/char-box/ item-box/info-box-light/max-center-table/alert-message/botones reales), eliminando el markup Tailwind (.nw-btn/.nw-card/.nw-input): auth (login/register/recover/reset/select-account/activate), cuenta + servicios de personaje (revive/unstuck/rename/customize/ change-race/change-faction/level-up/gold/transfer + pago Stripe), ajustes (change-password/change-email/security-token), comunidad (vote-points/recruit/battlepay), foro completo, y admin (indice + 7 secciones + los Admin*Manager). - Se conserva el bilingue (next-intl); claves nuevas en messages/es|en.json. Verificado: typecheck + build OK; rutas protegidas 307->login; sin MISSING_MESSAGE; cero Tailwind residual (solo .nw-tool-btn/.nw-page, clases propias en globals.css). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { getTranslations } from 'next-intl/server'
|
|
import { Link } from '@/i18n/navigation'
|
|
|
|
/**
|
|
* Paginación por número de página. `hrefFor(p)` construye la ruta de cada página
|
|
* (p.ej. `/forum/5?page=2`). No renderiza nada si solo hay una página.
|
|
*/
|
|
export async function Pagination({
|
|
page,
|
|
totalPages,
|
|
hrefFor,
|
|
}: {
|
|
page: number
|
|
totalPages: number
|
|
hrefFor: (page: number) => string
|
|
}) {
|
|
if (totalPages <= 1) return null
|
|
const t = await getTranslations('Common')
|
|
|
|
// Ventana de páginas alrededor de la actual.
|
|
const from = Math.max(1, page - 2)
|
|
const to = Math.min(totalPages, page + 2)
|
|
const pages: number[] = []
|
|
for (let p = from; p <= to; p++) pages.push(p)
|
|
|
|
const cls = (active: boolean) => `nw-page-link${active ? ' nw-page-current' : ''}`
|
|
|
|
return (
|
|
<nav className="centered separate" aria-label="pagination">
|
|
{page > 1 && (
|
|
<Link href={hrefFor(page - 1)} className="nw-page-link">
|
|
← {t('prev')}
|
|
</Link>
|
|
)}
|
|
{from > 1 && (
|
|
<>
|
|
<Link href={hrefFor(1)} className="nw-page-link">
|
|
1
|
|
</Link>
|
|
{from > 2 && <span className="third-brown">…</span>}
|
|
</>
|
|
)}
|
|
{pages.map((p) => (
|
|
<Link key={p} href={hrefFor(p)} className={cls(p === page)} aria-current={p === page ? 'page' : undefined}>
|
|
{p}
|
|
</Link>
|
|
))}
|
|
{to < totalPages && (
|
|
<>
|
|
{to < totalPages - 1 && <span className="third-brown">…</span>}
|
|
<Link href={hrefFor(totalPages)} className="nw-page-link">
|
|
{totalPages}
|
|
</Link>
|
|
</>
|
|
)}
|
|
{page < totalPages && (
|
|
<Link href={hrefFor(page + 1)} className="nw-page-link">
|
|
{t('next')} →
|
|
</Link>
|
|
)}
|
|
</nav>
|
|
)
|
|
}
|