From 154dbc1a66f1d33e096d1297bc0e5c7c5a716e3d Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Tue, 17 Nov 2020 18:46:19 +0200 Subject: [PATCH] fix avatar sens not showing if 0 --- components/u/AvatarWithInfo.tsx | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/components/u/AvatarWithInfo.tsx b/components/u/AvatarWithInfo.tsx index 4a4d2cee0..a62154a57 100644 --- a/components/u/AvatarWithInfo.tsx +++ b/components/u/AvatarWithInfo.tsx @@ -41,9 +41,10 @@ const AvatarWithInfo: React.FC = ({ const stickSensString = `${stick > 0 ? "+" : ""}${stick} ${t( "users;Stick" )}`; - const motionSensString = !!motion - ? ` ${motion > 0 ? "+" : ""}${motion} ${t("users;Motion")}` - : ""; + const motionSensString = + typeof motion === "number" + ? ` ${motion > 0 ? "+" : ""}${motion} ${t("users;Motion")}` + : ""; return `${stickSensString} ${motionSensString}`; } @@ -126,23 +127,22 @@ const AvatarWithInfo: React.FC = ({ ))} )} - {user.profile?.sensStick && - (!!user.profile.sensStick || user.profile.sensStick === 0) && ( - - - {getSensString( - user.profile.sensMotion, - user.profile.sensStick - )} - - )} + {typeof user.profile?.sensStick === "number" && ( + + + {getSensString( + user.profile.sensMotion, + user.profile.sensStick + )} + + )} {Object.keys(peakXPowers).length > 0 && ( {(["SZ", "TC", "RM", "CB"] as RankedMode[]).map((mode, i) => (