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 { getSession } from '@/lib/session'
|
||||||
|
import { getRealmName, realmSlug } from '@/lib/realm'
|
||||||
import { SiteHeader } from './SiteHeader'
|
import { SiteHeader } from './SiteHeader'
|
||||||
|
|
||||||
export async function Header() {
|
export async function Header() {
|
||||||
@@ -6,6 +7,8 @@ export async function Header() {
|
|||||||
const loggedIn = Boolean(session.username)
|
const loggedIn = Boolean(session.username)
|
||||||
// Django muestra bnet_email si existe, si no el username.
|
// Django muestra bnet_email si existe, si no el username.
|
||||||
const accountLabel = session.bnetEmail || session.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({
|
export function SiteHeader({
|
||||||
loggedIn,
|
loggedIn,
|
||||||
accountLabel,
|
accountLabel,
|
||||||
|
realmHref,
|
||||||
}: {
|
}: {
|
||||||
loggedIn: boolean
|
loggedIn: boolean
|
||||||
accountLabel: string
|
accountLabel: string
|
||||||
|
realmHref: string
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
@@ -83,7 +85,7 @@ export function SiteHeader({
|
|||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a href="/novawow-realm">REINO</a>
|
<a href={realmHref}>REINO</a>
|
||||||
</p>
|
</p>
|
||||||
{loggedIn && (
|
{loggedIn && (
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Reference in New Issue
Block a user