Show AX section in WeaponHovercard
Was testing truthy/falsy which meant id 0 made it not display
This commit is contained in:
parent
9b098a15d8
commit
a72f6ac7a9
1 changed files with 24 additions and 59 deletions
|
|
@ -37,19 +37,6 @@ const WeaponHovercard = (props: Props) => {
|
||||||
const { t } = useTranslation('common')
|
const { t } = useTranslation('common')
|
||||||
|
|
||||||
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
const Element = ['null', 'wind', 'fire', 'water', 'earth', 'dark', 'light']
|
||||||
const Proficiency = [
|
|
||||||
'none',
|
|
||||||
'sword',
|
|
||||||
'dagger',
|
|
||||||
'axe',
|
|
||||||
'spear',
|
|
||||||
'bow',
|
|
||||||
'staff',
|
|
||||||
'fist',
|
|
||||||
'harp',
|
|
||||||
'gun',
|
|
||||||
'katana',
|
|
||||||
]
|
|
||||||
const WeaponKeyNames: KeyNames = {
|
const WeaponKeyNames: KeyNames = {
|
||||||
'2': {
|
'2': {
|
||||||
en: 'Pendulum',
|
en: 'Pendulum',
|
||||||
|
|
@ -74,11 +61,6 @@ const WeaponHovercard = (props: Props) => {
|
||||||
? Element[props.gridWeapon.element]
|
? Element[props.gridWeapon.element]
|
||||||
: Element[props.gridWeapon.object.element]
|
: Element[props.gridWeapon.object.element]
|
||||||
|
|
||||||
const wikiUrl = `https://gbf.wiki/${props.gridWeapon.object.name.en.replaceAll(
|
|
||||||
' ',
|
|
||||||
'_'
|
|
||||||
)}`
|
|
||||||
|
|
||||||
function goTo() {
|
function goTo() {
|
||||||
const urlSafeName = props.gridWeapon.object.name.en.replaceAll(' ', '_')
|
const urlSafeName = props.gridWeapon.object.name.en.replaceAll(' ', '_')
|
||||||
const url = `https://gbf.wiki/${urlSafeName}`
|
const url = `https://gbf.wiki/${urlSafeName}`
|
||||||
|
|
@ -134,38 +116,22 @@ const WeaponHovercard = (props: Props) => {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function weaponImage() {
|
const awakeningSection = (
|
||||||
const weapon = props.gridWeapon.object
|
<section className={styles.awakening}>
|
||||||
|
<h5 className={tintElement}>{t('modals.weapon.subtitles.awakening')}</h5>
|
||||||
if (props.gridWeapon.object.element == 0 && props.gridWeapon.element)
|
<div className={styles.skill}>
|
||||||
return `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}_${props.gridWeapon.element}.jpg`
|
<img
|
||||||
else
|
alt={props.gridWeapon.awakening?.type.name[locale]}
|
||||||
return `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapon.granblue_id}.jpg`
|
src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/awakening/${props.gridWeapon.awakening?.type.slug}.png`}
|
||||||
}
|
/>
|
||||||
|
<span>
|
||||||
const awakeningSection = () => {
|
<strong>{`${props.gridWeapon.awakening?.type.name[locale]}`}</strong>
|
||||||
const gridAwakening = props.gridWeapon.awakening
|
|
||||||
|
{`Lv${props.gridWeapon.awakening?.level}`}
|
||||||
if (gridAwakening) {
|
</span>
|
||||||
return (
|
</div>
|
||||||
<section className={styles.awakening}>
|
</section>
|
||||||
<h5 className={tintElement}>
|
)
|
||||||
{t('modals.weapon.subtitles.awakening')}
|
|
||||||
</h5>
|
|
||||||
<div className={styles.skill}>
|
|
||||||
<img
|
|
||||||
alt={gridAwakening.type.name[locale]}
|
|
||||||
src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/awakening/${gridAwakening.type.slug}.png`}
|
|
||||||
/>
|
|
||||||
<span>
|
|
||||||
<strong>{`${gridAwakening.type.name[locale]}`}</strong>
|
|
||||||
{`Lv${gridAwakening.level}`}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const keysSection = (
|
const keysSection = (
|
||||||
<section className={styles.weaponKeys}>
|
<section className={styles.weaponKeys}>
|
||||||
|
|
@ -262,15 +228,14 @@ const WeaponHovercard = (props: Props) => {
|
||||||
type="weapon"
|
type="weapon"
|
||||||
/>
|
/>
|
||||||
{props.gridWeapon.object.ax &&
|
{props.gridWeapon.object.ax &&
|
||||||
props.gridWeapon.ax &&
|
props.gridWeapon.ax &&
|
||||||
props.gridWeapon.ax[0].modifier &&
|
props.gridWeapon.ax[0].modifier !== undefined &&
|
||||||
props.gridWeapon.ax[0].strength
|
props.gridWeapon.ax[0].strength !== undefined &&
|
||||||
? axSection
|
axSection}
|
||||||
: ''}
|
{props.gridWeapon.awakening && awakeningSection}
|
||||||
{awakeningSection()}
|
{props.gridWeapon.weapon_keys &&
|
||||||
{props.gridWeapon.weapon_keys && props.gridWeapon.weapon_keys.length > 0
|
props.gridWeapon.weapon_keys.length > 0 &&
|
||||||
? keysSection
|
keysSection}
|
||||||
: ''}
|
|
||||||
{wikiButton}
|
{wikiButton}
|
||||||
</HovercardContent>
|
</HovercardContent>
|
||||||
</Hovercard>
|
</Hovercard>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue