import type { Metadata } from 'next' import { getTranslations, setRequestLocale } from 'next-intl/server' import { getSession } from '@/lib/session' import { PageShell } from '@/components/PageShell' import { RegisterForm } from './RegisterForm' // Lee la sesión (cookies), así que no se puede prerenderizar. export const dynamic = 'force-dynamic' export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise { const { locale } = await params const t = await getTranslations({ locale, namespace: 'Register' }) return { title: t('title') } } export default async function CreateAccountPage({ params }: { params: Promise<{ locale: string }> }) { const { locale } = await params setRequestLocale(locale) const t = await getTranslations('Register') // El cuadro informativo se queda: sigue explicando cómo son las cuentas aunque // ya tengas sesión. Lo que se sustituye es el formulario. const session = await getSession() return (

{t('bnetType')}

{t('passwordRule')}

{t('emailRule')}


{t('activation1')}

{t('activation2')}

{t('loginHint')}

{session.bnetId ? ( <>

{t('alreadyLogged')}


{/* `` plano, NUNCA : /log-out es un GET que destruye la sesión, y lo prefetcharía al entrar en pantalla, cerrándola sola sin que nadie pulse. SiteHeader lo enlaza así por lo mismo. */}

{t.rich('alreadyLoggedCreate', { logout: (c) => {c} })}

) : ( )}
) }