import { notFound } from 'next/navigation' import { getTranslations, setRequestLocale } from 'next-intl/server' import { Link } from '@/i18n/navigation' import { getCharacter, getCharacterEquipment } from '@/lib/armory' import { raceName, className, classColor, factionOf, EQUIP_SLOTS } from '@/lib/wow-data' import { wowheadUrl, wowheadData } from '@/lib/wowhead' import { PageShell } from '@/components/PageShell' import { WowheadRefresh } from '@/components/WowheadRefresh' import { ArmoryModel3D } from '@/components/ArmoryModel3D' export const dynamic = 'force-dynamic' export default async function CharacterPage({ params, }: { params: Promise<{ locale: string; guid: string }> }) { const { locale, guid } = await params setRequestLocale(locale) const t = await getTranslations('Armory') const id = Number(guid) const character = await getCharacter(id) if (!character) notFound() const equipment = await getCharacterEquipment(id, locale) const bySlot = new Map(equipment.map((e) => [e.slot, e])) const faction = factionOf(character.race) const factionLabel = faction === 'alliance' ? t('alliance') : faction === 'horde' ? t('horde') : '' // Modelo 3D: raza, género y equipo (entry + display; transmog si lo hay). const modelEquip = equipment .map((e) => ({ slot: e.slot, entry: e.transmogEntry ?? e.entry, displayid: e.transmogDisplayId ?? e.displayId ?? 0, })) .filter((e) => e.displayid > 0) return (

← {t('backToArmory')}

{/* Columna izquierda: identidad + modelo 3D */}

{character.name}

{t('level')} {character.level} · {raceName(character.race, locale)} ·{' '} {className(character.class, locale)}
{factionLabel && {factionLabel}} {character.online ? t('online') : t('offline')} {character.guildName && character.guildId && ( <{character.guildName}> )}
{/* Columna derecha: equipo */}

{t('equipment')}

{equipment.length === 0 ? (

{t('noEquipment')}

) : (
{EQUIP_SLOTS.map(({ slot, es, en }) => { const item = bySlot.get(slot) const slotName = locale === 'en' ? en : es if (!item) { return (
{slotName}
) } return (
{item.name} {slotName} {item.itemLevel ? ` · ${item.itemLevel}` : ''}
) })}
)}
) }