From 4ff259fcb35d3ce2e0fd90e0d2b9ddc49d2149c5 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 7 Jun 2024 19:18:41 +0500 Subject: [PATCH 1/2] updated logic for rendering voter percent in users list --- src/components/votersDisplay/view/votersDisplayView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/votersDisplay/view/votersDisplayView.js b/src/components/votersDisplay/view/votersDisplayView.js index d4f61ce3f..06677e571 100644 --- a/src/components/votersDisplay/view/votersDisplayView.js +++ b/src/components/votersDisplay/view/votersDisplayView.js @@ -29,7 +29,7 @@ const VotersDisplayView = ({ votes, createdAt = '2010-01-01T00:00:00' }) => { const _renderItem = ({ item, index }) => { const value = item.reward && `$ ${item.reward}`; - const percent = item.percent100 && `${item.percent100}%`; + const percent = !isNaN(item.percent100) && `${item.percent100}%`; // snippet to avoid rendering time form long past const minTimestamp = new Date(createdAt).getTime(); From 3428e712501c726cea9f6568b9ad6ee473b408c8 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 7 Jun 2024 19:19:09 +0500 Subject: [PATCH 2/2] added null check redundency to userListItem --- .../basicUIElements/view/userListItem/userListItem.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/basicUIElements/view/userListItem/userListItem.tsx b/src/components/basicUIElements/view/userListItem/userListItem.tsx index 3200c22d0..d03b88393 100644 --- a/src/components/basicUIElements/view/userListItem/userListItem.tsx +++ b/src/components/basicUIElements/view/userListItem/userListItem.tsx @@ -49,7 +49,7 @@ const UserListItem = ({ > {leftItemRenderer && leftItemRenderer()} - {itemIndex && {itemIndex}} + {!!itemIndex && {itemIndex}} {!searchValue && {text || username}} @@ -80,7 +80,7 @@ const UserListItem = ({ {description} )} - {middleText && ( + {!!middleText && ( {rightText} - {subRightText && {subRightText}} + {!!subRightText && {subRightText}}