From fb1013e69fd32e0b7249d8c285ed41df6707107a Mon Sep 17 00:00:00 2001 From: Adam Chambers Date: Fri, 13 Oct 2023 23:12:13 -0400 Subject: [PATCH] feat: highlight sol domains, fix solscan links --- .../desktop/Points/PointsLeaderBoard.tsx | 8 +++-- .../marginfi-v2-ui-state/src/lib/points.ts | 33 ++++++++----------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/apps/marginfi-v2-ui/src/components/desktop/Points/PointsLeaderBoard.tsx b/apps/marginfi-v2-ui/src/components/desktop/Points/PointsLeaderBoard.tsx index c4b829ed2d..2a2725bc77 100644 --- a/apps/marginfi-v2-ui/src/components/desktop/Points/PointsLeaderBoard.tsx +++ b/apps/marginfi-v2-ui/src/components/desktop/Points/PointsLeaderBoard.tsx @@ -322,9 +322,13 @@ export const PointsLeaderBoard: FC = ({ currentUserId }) target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none", color: "inherit" }} - className={clsx("hover:text-[#DCE85D]")} + className={clsx( + "hover:text-[#DCE85D] hover:opacity-100 transition", + data.domain && "font-bold", + !data.domain && "opacity-80" + )} > - {data.id} + {data.domain || data.shortAddress || data.id} ; total_activity_deposit_points: number; total_activity_borrow_points: number; @@ -76,40 +78,31 @@ async function fetchLeaderboardData({ const leaderboardFinalSliceWithDomains: LeaderboardRow[] = await Promise.all( leaderboardFinalSlice.map(async (value) => { + const newValue = { ...value, shortAddress: shortAddress(value.id) }; // attempt to get favorite domain try { const { reverse } = await getFavoriteDomain(connection, new PublicKey(value.id)); - if (reverse) { - return { - ...value, - id: `${reverse}.sol`, - }; - } + return { + ...newValue, + domain: `${reverse}.sol`, + }; } catch (e) { // attempt to get all domains try { const domains = await getAllDomains(connection, new PublicKey(value.id)); if (domains.length > 0) { const reverse = await reverseLookup(connection, domains[0]); - if (reverse) { - return { - ...value, - id: `${reverse}.sol`, - }; - } + return { + ...newValue, + domain: `${reverse}.sol`, + }; } } catch (e) { - return { - ...value, - id: shortAddress(value.id), - }; + return newValue; } } - return { - ...value, - id: shortAddress(value.id), - }; + return newValue; }) );