'use client' import React from 'react' import { useRouter, usePathname, useSearchParams } from 'next/navigation' import { getCookie } from 'cookies-next' import { useTranslations } from 'next-intl' import { Hovercard, HovercardContent, HovercardTrigger, } from '~components/common/Hovercard' import Button from '~components/common/Button' import WeaponLabelIcon from '~components/weapon/WeaponLabelIcon' import UncapIndicator from '~components/uncap/UncapIndicator' import { overMastery, aetherialMastery, permanentMastery, } from '~data/overMastery' import { ExtendedMastery } from '~types' import styles from './index.module.scss' import HovercardHeader from '~components/HovercardHeader' interface Props { gridCharacter: GridCharacter children: React.ReactNode onTriggerClick: () => void } const CharacterHovercard = (props: Props) => { const router = useRouter() const pathname = usePathname() const searchParams = useSearchParams() const t = useTranslations('common') const routerLocale = getCookie('NEXT_LOCALE') const locale = routerLocale && ['en', 'ja'].includes(routerLocale) ? routerLocale : 'en' const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light'] const tintElement = Element[props.gridCharacter.object.element] function goTo() { const urlSafeName = props.gridCharacter.object.name.en.replaceAll(' ', '_') const url = `https://gbf.wiki/${urlSafeName}` window.open(url, '_blank') } function masteryElement(dictionary: ItemSkill[], mastery: ExtendedMastery) { const canonicalMastery = dictionary.find( (item) => item.id === mastery.modifier ) if (canonicalMastery) { return (
{canonicalMastery.name[locale]}
{`+${mastery.strength}${canonicalMastery.suffix}`}
)}
{`${gridAwakening.type.name[locale]}`}
{`Lv${gridAwakening.level}`}