Skip to content

Commit

Permalink
feat: highlight sol domains, fix solscan links
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Oct 16, 2023
1 parent 1cd84b6 commit fb1013e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,13 @@ export const PointsLeaderBoard: FC<PointsLeaderBoardProps> = ({ 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}
</a>
</TableCell>
<TableCell
Expand Down
33 changes: 13 additions & 20 deletions packages/marginfi-v2-ui-state/src/lib/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { firebaseApi } from ".";

type LeaderboardRow = {
id: string;
shortAddress?: string;
domain?: string;
doc: QueryDocumentSnapshot<DocumentData>;
total_activity_deposit_points: number;
total_activity_borrow_points: number;
Expand Down Expand Up @@ -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;
})
);

Expand Down

3 comments on commit fb1013e

@vercel
Copy link

@vercel vercel bot commented on fb1013e Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marginfi-landing-page – ./apps/marginfi-landing-page

marginfi-landing-page.vercel.app
marginfi-landing-page-git-production-mrgn.vercel.app
marginfi-landing-page-mrgn.vercel.app
marginfi.com
www.marginfi.com

@vercel
Copy link

@vercel vercel bot commented on fb1013e Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

omni – ./apps/omni

omni-git-production-mrgn.vercel.app
omni-one.vercel.app
omni-mrgn.vercel.app
omni.marginfi.com

@vercel
Copy link

@vercel vercel bot commented on fb1013e Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.