diff --git a/.gitignore b/.gitignore index 1ecada63..2c6a6ada 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ public/images/job* public/images/awakening* public/images/ax* public/images/accessory* +public/images/mastery* # Typescript v1 declaration files typings/ diff --git a/components/CharacterHovercard/index.scss b/components/CharacterHovercard/index.scss index e69de29b..1f1045dc 100644 --- a/components/CharacterHovercard/index.scss +++ b/components/CharacterHovercard/index.scss @@ -0,0 +1,68 @@ +.Character.HovercardContent { + .title .Image { + position: relative; + + .Perpetuity { + position: absolute; + background-image: url('/icons/perpetuity/filled.svg'); + background-size: $unit-3x $unit-3x; + z-index: 20; + top: $unit-half * -1; + right: $unit-3x; + width: $unit-3x; + height: $unit-3x; + } + } + + .Mastery { + display: flex; + flex-direction: column; + gap: $unit; + + ul { + display: flex; + flex-direction: column; + gap: $unit-half; + + .ExtendedMastery { + align-items: center; + display: flex; + gap: $unit-half; + + img { + width: $unit-3x; + } + + strong { + font-weight: $bold; + } + } + } + } + + .Awakening { + display: flex; + flex-direction: column; + gap: $unit; + + & > div { + align-items: center; + display: flex; + gap: $unit-half; + + img { + width: $unit-3x; + } + + strong { + font-weight: $bold; + } + } + } + + // .Footer { + // position: sticky; + // bottom: 0; + // left: 0; + // } +} diff --git a/components/CharacterHovercard/index.tsx b/components/CharacterHovercard/index.tsx index 0f9d16ac..23322203 100644 --- a/components/CharacterHovercard/index.tsx +++ b/components/CharacterHovercard/index.tsx @@ -1,17 +1,31 @@ import React from 'react' import { useRouter } from 'next/router' import { useTranslation } from 'next-i18next' +import jconv from 'jconv' -import * as HoverCard from '@radix-ui/react-hover-card' - +import { + Hovercard, + HovercardContent, + HovercardTrigger, +} from '~components/Hovercard' +import Button from '~components/Button' import WeaponLabelIcon from '~components/WeaponLabelIcon' import UncapIndicator from '~components/UncapIndicator' +import { + overMastery, + aetherialMastery, + permanentMastery, +} from '~data/overMastery' +import { characterAwakening } from '~data/awakening' +import { ExtendedMastery } from '~types' + import './index.scss' interface Props { gridCharacter: GridCharacter children: React.ReactNode + onTriggerClick: () => void } interface KeyNames { @@ -43,10 +57,19 @@ const CharacterHovercard = (props: Props) => { ] const tintElement = Element[props.gridCharacter.object.element] - const wikiUrl = `https://gbf.wiki/${props.gridCharacter.object.name.en.replaceAll( - ' ', - '_' - )}` + + function goTo() { + const urlSafeName = props.gridCharacter.object.name.en.replaceAll(' ', '_') + const url = `https://gbf.wiki/${urlSafeName}` + + window.open(url, '_blank') + } + + const perpetuity = () => { + if (props.gridCharacter && props.gridCharacter.perpetuity) { + return + } + } function characterImage() { let imgSrc = '' @@ -66,59 +89,194 @@ const CharacterHovercard = (props: Props) => { return imgSrc } + 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}`}
+
+
+ ) : (
+ ''
+ )}
+
+ {`${awakening.name[locale]}`}
+ {`Lv${gridAwakening.level}`}
+
+
+
+ {`${awakening.name[locale]}`}
+ {`Lv${gridAwakening.level}`}
+
+