From 75c371bb77a5e64af7f8c73e952de6756349ce07 Mon Sep 17 00:00:00 2001 From: Ben Goldberg Date: Fri, 19 Jan 2024 10:25:57 -0800 Subject: [PATCH] Points: rank card fixes (#5332) * fixes * fix ens display --- .../points/components/LeaderboardRow.tsx | 2 +- src/screens/points/content/PointsContent.tsx | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/screens/points/components/LeaderboardRow.tsx b/src/screens/points/components/LeaderboardRow.tsx index af341472c0b..c58d653736d 100644 --- a/src/screens/points/components/LeaderboardRow.tsx +++ b/src/screens/points/components/LeaderboardRow.tsx @@ -242,7 +242,7 @@ export const LeaderboardRow = ({ numberOfLines={1} containsEmoji > - {ens ?? formattedAddress ?? ''} + {ens || formattedAddress || ''} diff --git a/src/screens/points/content/PointsContent.tsx b/src/screens/points/content/PointsContent.tsx index 7ce09d7ad66..dbad171bfdb 100644 --- a/src/screens/points/content/PointsContent.tsx +++ b/src/screens/points/content/PointsContent.tsx @@ -128,7 +128,8 @@ export default function PointsContent() { const totalUsers = points?.points?.leaderboard.stats.total_users; const rank = points?.points?.user.stats.position.current; - const lastWeekRank = points?.points?.user.stats.last_airdrop.position.current; + const lastWeekRank = + points?.points?.user.stats.last_airdrop?.position.current; const rankChange = rank && lastWeekRank ? rank - lastWeekRank : undefined; const isUnranked = !!points?.points?.user?.stats?.position?.unranked; @@ -150,18 +151,26 @@ export default function PointsContent() { if (rankChange === 0) return '􁘶'; - if (rankChange > 0) return '􀑁'; + if (rankChange < 0) return '􀑁'; return '􁘳'; }; const getRankChangeIconColor = () => { - if (rankChange === undefined || rankChange < 0) return colors.red; + if (rankChange === undefined || rankChange > 0) return colors.red; if (rankChange === 0) return colors.yellow; return colors.green; }; + + const getRankChangeText = () => { + if (rankChange !== undefined) { + return Math.abs(rankChange).toLocaleString('en-US'); + } + return ''; + }; + return (