7d1abab9f1
Sustituye la base de datos de ítems del sistema antiguo (AoWoW en wotlk.novawow/wotlk.ultimowow) y los iconos de mirrors por wowhead / zamimg, con el idioma del tooltip según el locale de la web (es. / www.). Sistema reutilizable para rutas actuales y futuras: - lib/wowhead.ts: wowheadUrl/wowheadItemUrl/wowheadWotlkHome (subdominio por locale), wowheadIcon (zamimg) y wowheadData (atributo data-wowhead, rama WotLK). - components/WowheadLink.tsx: enlace con tooltip en el locale actual. - layout raíz: config whTooltips (solo tooltips) + script tooltips.js global; funciona con contenido añadido por React (carrito, búsquedas). Aplicado en: send-gift (catálogo + carrito), restore-items, recruit (RecruitPanel, enlace por item_id + icono zamimg), quest-character (misión/npc/ facción + iconos), y el enlace "WOTLK DB" de la cabecera. Verificado en prod (:3001): /es -> es.wowhead.com, /en -> www.wowhead.com, data-wowhead presente, iconos por zamimg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
96 lines
3.5 KiB
TypeScript
96 lines
3.5 KiB
TypeScript
import type { Metadata } from 'next'
|
|
import Script from 'next/script'
|
|
import { notFound } from 'next/navigation'
|
|
import { NextIntlClientProvider, hasLocale } from 'next-intl'
|
|
import { getTranslations, setRequestLocale } from 'next-intl/server'
|
|
import { routing } from '@/i18n/routing'
|
|
import { Header } from '@/components/Header'
|
|
import { Video } from '@/components/Video'
|
|
import { Social } from '@/components/Social'
|
|
import { Footer } from '@/components/Footer'
|
|
import { CookieBanner } from '@/components/CookieConsent'
|
|
import '../globals.css'
|
|
|
|
export function generateStaticParams() {
|
|
return routing.locales.map((locale) => ({ locale }))
|
|
}
|
|
|
|
// SEO por idioma (SSR) vía Metadata API.
|
|
export async function generateMetadata({
|
|
params,
|
|
}: {
|
|
params: Promise<{ locale: string }>
|
|
}): Promise<Metadata> {
|
|
const { locale } = await params
|
|
const t = await getTranslations({ locale, namespace: 'Metadata' })
|
|
return {
|
|
title: t('title'),
|
|
description: t('description'),
|
|
openGraph: {
|
|
siteName: 'NovaWoW',
|
|
title: t('title'),
|
|
description: t('description'),
|
|
type: 'website',
|
|
locale: locale === 'es' ? 'es_ES' : 'en_US',
|
|
url: 'https://www.nightspire.gg/',
|
|
},
|
|
}
|
|
}
|
|
|
|
export default async function LocaleLayout({
|
|
children,
|
|
params,
|
|
}: {
|
|
children: React.ReactNode
|
|
params: Promise<{ locale: string }>
|
|
}) {
|
|
const { locale } = await params
|
|
if (!hasLocale(routing.locales, locale)) notFound()
|
|
setRequestLocale(locale)
|
|
|
|
return (
|
|
<html lang={locale}>
|
|
<head>
|
|
{/* Iconos del sitio (idénticos a la web Django) */}
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
|
<link rel="icon" type="image/png" sizes="194x194" href="/favicon-194x194.png" />
|
|
<link rel="icon" type="image/png" sizes="192x192" href="/android-chrome-192x192.png" />
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
|
<link rel="manifest" href="/site.webmanifest" />
|
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#47210a" />
|
|
<link rel="shortcut icon" href="/favicon.ico" />
|
|
{/* Font Awesome (mismos iconos que la web Django) */}
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
|
|
/>
|
|
{/* Tema real de NovaWoW (nw-ryu). Va el ÚLTIMO para ganar la cascada. */}
|
|
<link rel="stylesheet" href="/nw-themes/nw-ryu/nw-css/novawow-style.css?v=2" />
|
|
{/* Config de los tooltips de wowhead (debe definirse antes de tooltips.js).
|
|
Solo tooltips: no recolorea/renombra/iconiza nuestros enlaces. El idioma
|
|
del tooltip lo da el subdominio del enlace (es./www.). */}
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: 'const whTooltips={colorLinks:false,iconizeLinks:false,renameLinks:false};',
|
|
}}
|
|
/>
|
|
</head>
|
|
<body>
|
|
<NextIntlClientProvider>
|
|
<Header />
|
|
<Video />
|
|
{children}
|
|
<Social />
|
|
<Footer />
|
|
<CookieBanner />
|
|
</NextIntlClientProvider>
|
|
{/* Tooltips de wowhead (WotLK) en todos los enlaces .../wowhead.com/... y
|
|
elementos con data-wowhead. Funciona con contenido añadido por React
|
|
(carrito, búsquedas) porque delega el hover en el documento. */}
|
|
<Script src="https://wow.zamimg.com/js/tooltips.js" strategy="afterInteractive" />
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|