web-next: enlace REINO de la cabecera dinámico (/<slug>-realm)
El menú de la cabecera enlazaba a /novawow-realm fijo. Ahora Header (server) calcula el slug desde realmlist (getRealmName + realmSlug) y lo pasa a SiteHeader como realmHref → el enlace REINO apunta a /trinity-realm (o al reino que haya). Acompaña a la ruta dinámica [realm]. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getSession } from '@/lib/session'
|
||||
import { getRealmName, realmSlug } from '@/lib/realm'
|
||||
import { SiteHeader } from './SiteHeader'
|
||||
|
||||
export async function Header() {
|
||||
@@ -6,6 +7,8 @@ export async function Header() {
|
||||
const loggedIn = Boolean(session.username)
|
||||
// Django muestra bnet_email si existe, si no el username.
|
||||
const accountLabel = session.bnetEmail || session.username || ''
|
||||
// Enlace al reino según el nombre en realmlist (p. ej. /trinity-realm).
|
||||
const realmHref = `/${realmSlug(await getRealmName())}-realm`
|
||||
|
||||
return <SiteHeader loggedIn={loggedIn} accountLabel={accountLabel} />
|
||||
return <SiteHeader loggedIn={loggedIn} accountLabel={accountLabel} realmHref={realmHref} />
|
||||
}
|
||||
|
||||
@@ -16,9 +16,11 @@ const SERVER_NAME = 'NovaWoW'
|
||||
export function SiteHeader({
|
||||
loggedIn,
|
||||
accountLabel,
|
||||
realmHref,
|
||||
}: {
|
||||
loggedIn: boolean
|
||||
accountLabel: string
|
||||
realmHref: string
|
||||
}) {
|
||||
const router = useRouter()
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -83,7 +85,7 @@ export function SiteHeader({
|
||||
</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="/novawow-realm">REINO</a>
|
||||
<a href={realmHref}>REINO</a>
|
||||
</p>
|
||||
{loggedIn && (
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user