From 2fa5a63a6dfe2543f09a5641efb1623453ce1c5a Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sun, 18 Sep 2022 14:44:19 +0300 Subject: [PATCH] Make sure main weapon category isn't rendered empty --- app/routes/analyzer.tsx | 94 ++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/app/routes/analyzer.tsx b/app/routes/analyzer.tsx index 90865c162..bd48ca4cd 100644 --- a/app/routes/analyzer.tsx +++ b/app/routes/analyzer.tsx @@ -84,6 +84,51 @@ export default function BuildAnalyzerPage() { return
Coming soon :)
; } + const mainWeaponCategoryItems = [ + analyzed.stats.shotSpreadAir && ( + + ), + typeof analyzed.stats.shotSpreadGround === "number" && ( + + ), + typeof analyzed.stats.mainWeaponWhiteInkSeconds === "number" && ( + + ), + typeof analyzed.weapon.brellaCanopyHp === "number" && ( + + ), + typeof analyzed.weapon.fullChargeSeconds === "number" && ( + + ), + typeof analyzed.weapon.maxChargeHoldSeconds === "number" && ( + + ), + ].filter(Boolean); + return (
@@ -133,50 +178,11 @@ export default function BuildAnalyzerPage() {
- - {analyzed.stats.shotSpreadAir && ( - - )} - {typeof analyzed.stats.shotSpreadGround === "number" && ( - - )} - {typeof analyzed.stats.mainWeaponWhiteInkSeconds === "number" && ( - - )} - {typeof analyzed.weapon.brellaCanopyHp === "number" && ( - - )} - {typeof analyzed.weapon.fullChargeSeconds === "number" && ( - - )} - {typeof analyzed.weapon.maxChargeHoldSeconds === "number" && ( - - )} - + {mainWeaponCategoryItems.length > 0 && ( + + {mainWeaponCategoryItems} + + )}