Enlaces de ítems por wowhead (locale + tooltips) en toda la web
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>
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import { useTranslations } from 'next-intl'
|
||||
import { useTranslations, useLocale } from 'next-intl'
|
||||
import type { RecruitRewardView } from '@/lib/recruit-claim'
|
||||
import type { CharOption } from '@/components/CharacterSelect'
|
||||
|
||||
const ICON_BASE = 'https://wotlk.ultimowow.com/static/images/wow/icons/tiny'
|
||||
import { wowheadUrl, wowheadData, wowheadIcon } from '@/lib/wowhead'
|
||||
|
||||
function claimErrorKey(message?: string): string {
|
||||
switch (message) {
|
||||
@@ -40,6 +39,7 @@ export function RecruitPanel({
|
||||
recruitedCount: number
|
||||
}) {
|
||||
const t = useTranslations('UI')
|
||||
const locale = useLocale()
|
||||
const [character, setCharacter] = useState(characters[0]?.name ?? '')
|
||||
const selectedCss = characters.find((c) => c.name === character)?.classCss
|
||||
const [busyId, setBusyId] = useState<number | null>(null)
|
||||
@@ -77,11 +77,12 @@ export function RecruitPanel({
|
||||
return (
|
||||
<>
|
||||
<a
|
||||
href={r.item_link}
|
||||
href={wowheadUrl('item', r.item_id, locale)}
|
||||
data-wowhead={wowheadData('item', r.item_id)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={`icontinyl ${quality || ''}`}
|
||||
style={{ paddingLeft: '18px', background: `url('${ICON_BASE}/${icon}.gif') left center no-repeat` }}
|
||||
style={{ paddingLeft: '18px', background: `url('${wowheadIcon(icon, 'tiny')}') left center no-repeat` }}
|
||||
>
|
||||
{r.reward_name}
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user