GridRep should reflect changed element

This commit is contained in:
Justin Edmund 2022-03-22 00:49:32 -07:00
parent bc26f4b783
commit 517c414e2c

View file

@ -71,13 +71,33 @@ const GridRep = (props: Props) => {
}
function generateMainhandImage() {
let url = ''
if (mainhand) {
if (mainhand.element == 0 && props.grid[0].element) {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand.granblue_id}_${props.grid[0].element}.jpg`
} else {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand.granblue_id}.jpg`
}
}
return (mainhand) ?
<img alt={mainhand?.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-main/${mainhand?.granblue_id}.jpg`} /> : ''
<img alt={mainhand.name[locale]} src={url} /> : ''
}
function generateGridImage(position: number) {
let url = ''
if (weapons[position]) {
if (weapons[position].element == 0 && props.grid[position].element) {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}_${props.grid[position].element}.jpg`
} else {
url = `${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}.jpg`
}
}
return (weapons[position]) ?
<img alt={weapons[position]?.name[locale]} src={`${process.env.NEXT_PUBLIC_SIERO_IMG_URL}/weapon-grid/${weapons[position]?.granblue_id}.jpg`} /> : ''
<img alt={weapons[position].name[locale]} src={url} /> : ''
}
function sendSaveData() {