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>
83 lines
2.9 KiB
TypeScript
83 lines
2.9 KiB
TypeScript
import { notFound } from 'next/navigation'
|
|
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { Link } from '@/i18n/navigation'
|
|
import { getForum, getTopics, countTopics } from '@/lib/forum'
|
|
import { getSession } from '@/lib/session'
|
|
import { PageShell } from '@/components/PageShell'
|
|
import { NewTopicForm } from '@/components/NewTopicForm'
|
|
import { Pagination } from '@/components/Pagination'
|
|
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
const PER_PAGE = 20
|
|
|
|
export default async function ForumPage({
|
|
params,
|
|
searchParams,
|
|
}: {
|
|
params: Promise<{ locale: string; forumId: string }>
|
|
searchParams: Promise<{ page?: string }>
|
|
}) {
|
|
const { locale, forumId } = await params
|
|
setRequestLocale(locale)
|
|
const t = await getTranslations('Forum')
|
|
|
|
const id = Number(forumId)
|
|
const forum = await getForum(id)
|
|
if (!forum) notFound()
|
|
const total = await countTopics(id)
|
|
const totalPages = Math.max(1, Math.ceil(total / PER_PAGE))
|
|
const page = Math.min(Math.max(1, Number((await searchParams).page) || 1), totalPages)
|
|
const topics = await getTopics(id, (page - 1) * PER_PAGE, PER_PAGE)
|
|
const session = await getSession()
|
|
const canPost = Boolean(session.username)
|
|
|
|
return (
|
|
<PageShell title={forum!.name}>
|
|
<div className="box-content">
|
|
<div className="body-box-content">
|
|
<p>
|
|
<Link href="/forum">← {t('backToForum')}</Link>
|
|
</p>
|
|
{forum!.description && <p className="second-brown">{forum!.description}</p>}
|
|
<br />
|
|
|
|
{topics.length === 0 ? (
|
|
<p className="second-brown centered">{t('noTopics')}</p>
|
|
) : (
|
|
<table className="max-center-table">
|
|
<tbody>
|
|
{topics.map((topic) => (
|
|
<tr key={topic.id} className="team-center-table-tr">
|
|
<td className="lefted separate">
|
|
<Link href={`/forum/topic/${topic.id}`} className="yellow-info">
|
|
{topic.sticky && <span className="second-yellow small-font">[{t('sticky')}] </span>}
|
|
{topic.locked && <span className="red-info2 small-font">[{t('locked')}] </span>}
|
|
{topic.name}
|
|
</Link>
|
|
<p className="third-brown small-font">
|
|
{t('by')} {topic.poster}
|
|
</p>
|
|
</td>
|
|
<td className="real-info-box no-wrap-td second-brown small-font">
|
|
{topic.views} {t('views')}
|
|
</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
)}
|
|
|
|
<Pagination page={page} totalPages={totalPages} hrefFor={(p) => `/forum/${id}?page=${p}`} />
|
|
|
|
{canPost ? (
|
|
<NewTopicForm forumId={id} />
|
|
) : (
|
|
<p className="second-brown centered separate">{t('loginToPost')}</p>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</PageShell>
|
|
)
|
|
}
|