import { getTranslations, setRequestLocale } from 'next-intl/server' import { Link } from '@/i18n/navigation' import { getNoticias, getServerStatus, type Noticia, type ServerStatus } from '@/lib/home' // SSR por petición: los datos se leen DIRECTAMENTE de MySQL desde el servidor Next. export const dynamic = 'force-dynamic' async function getData(): Promise<{ noticias: Noticia[]; status: ServerStatus | null }> { const [news, status] = await Promise.allSettled([getNoticias(), getServerStatus()]) return { noticias: news.status === 'fulfilled' ? news.value : [], status: status.status === 'fulfilled' ? status.value : null, } } export default async function HomePage({ params }: { params: Promise<{ locale: string }> }) { const { locale } = await params setRequestLocale(locale) const t = await getTranslations('Home') const { noticias, status } = await getData() return (
{/* Hero */}
{/* eslint-disable-next-line @next/next/no-img-element */} Nova WoW

WotLK Classic 3.4.3

Nova WoW

{t('tagline')}

{t('ctaRegister')} {t('ctaForum')}
{/* Estado del servidor */} {/* Noticias */}

{t('news')}

{noticias.length === 0 ? (

{t('noNews')}

) : (
{noticias.map((n) => (

{n.titulo}

{n.fecha && ( {new Date(n.fecha).toLocaleString(locale)} )}
{n.enlace && (

{t('link')}:{' '} {t('here')}

)}
))}
)}
) }