From ba93a146ade7e211ed82a4dfa72f7c05542f1fea Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 10 Jul 2023 02:12:26 -0700 Subject: [PATCH] Fix Lyria in CharacterRep --- components/character/CharacterUnit/index.tsx | 4 ++-- components/reps/CharacterRep/index.tsx | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/components/character/CharacterUnit/index.tsx b/components/character/CharacterUnit/index.tsx index 83191784..8fcf7083 100644 --- a/components/character/CharacterUnit/index.tsx +++ b/components/character/CharacterUnit/index.tsx @@ -192,11 +192,11 @@ const CharacterUnit = ({ else if (gridCharacter.uncap_level > 2) suffix = '02' // Special casing for Lyria (and Young Cat eventually) - if (gridCharacter.object.granblue_id === '3030182000') { + if (character.element === 0) { let element = 1 if (grid.weapons.mainWeapon && grid.weapons.mainWeapon.element) { element = grid.weapons.mainWeapon.element - } else if (party.element != 0) { + } else if (party.element !== 0) { element = party.element } diff --git a/components/reps/CharacterRep/index.tsx b/components/reps/CharacterRep/index.tsx index 1c72fac5..3df1180d 100644 --- a/components/reps/CharacterRep/index.tsx +++ b/components/reps/CharacterRep/index.tsx @@ -17,10 +17,7 @@ const CHARACTERS_COUNT = 3 const CharacterRep = (props: Props) => { // Localization for alt tags - const router = useRouter() - const { t } = useTranslation('common') - const locale = - router.locale && ['en', 'ja'].includes(router.locale) ? router.locale : 'en' + const locale = useRouter().locale || 'en' // Component state const [characters, setCharacters] = useState>({}) @@ -95,8 +92,15 @@ const CharacterRep = (props: Props) => { else if (gridCharacter.uncap_level >= 5) suffix = '03' else if (gridCharacter.uncap_level > 2) suffix = '02' - if (character.element == 0) { - url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${props.element}.jpg` + let element = props.element + if (element === 0 && character.element !== 0) { + element = character.element + } else if (element === 0 && character.element === 0) { + element = 1 + } + + if (character.element === 0) { + url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${suffix}_0${element}.jpg` } else { url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/character-main/${character.granblue_id}_${suffix}.jpg` }