From 2caa09691718237cfaa3855dc67bef283652d363 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Fri, 18 Sep 2020 04:54:45 -0700 Subject: [PATCH] Pull weapon images from different sources depending on env --- src/components/WeaponGridMainhand/WeaponGridMainhand.tsx | 7 ++++++- src/components/WeaponGridUnit/WeaponGridUnit.tsx | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/WeaponGridMainhand/WeaponGridMainhand.tsx b/src/components/WeaponGridMainhand/WeaponGridMainhand.tsx index 1f042a90..15328ce9 100644 --- a/src/components/WeaponGridMainhand/WeaponGridMainhand.tsx +++ b/src/components/WeaponGridMainhand/WeaponGridMainhand.tsx @@ -18,7 +18,12 @@ function WeaponGridMainhand(props: WeaponGridProps) { let imgSrc if (props.weapon) { const weapon = props.weapon! - imgSrc = mainhandImages[weapon.granblue_id] + + if (process.env.NODE_ENV === 'development') { + imgSrc = mainhandImages[weapon.granblue_id] + } else if (process.env.NODE_ENV === 'production') { + imgSrc = `${process.env.SIERO_IMG_URL}/mainhand/${weapon.granblue_id}.jpg` + } } const openModalIfEditable = (props.editable) ? openModal : () => {} diff --git a/src/components/WeaponGridUnit/WeaponGridUnit.tsx b/src/components/WeaponGridUnit/WeaponGridUnit.tsx index 4c1b40e8..dbd42918 100644 --- a/src/components/WeaponGridUnit/WeaponGridUnit.tsx +++ b/src/components/WeaponGridUnit/WeaponGridUnit.tsx @@ -14,7 +14,12 @@ function WeaponGridUnit(props: WeaponGridProps) { let imgSrc if (props.weapon) { const weapon = props.weapon! - imgSrc = gridImages[weapon.granblue_id] + + if (process.env.NODE_ENV === 'development') { + imgSrc = gridImages[weapon.granblue_id] + } else if (process.env.NODE_ENV === 'production') { + imgSrc = `${process.env.SIERO_IMG_URL}/grid/${weapon.granblue_id}.jpg` + } } const openModalIfEditable = (props.editable) ? openModal : () => {}