Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mfi-v2-ui): semi-generic LM display #240

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added apps/marginfi-v2-ui/public/blze.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@ import { useWalletContext } from "~/components/useWalletContext";

const CLOSE_BALANCE_TOAST_ID = "close-balance";
const BORROW_OR_LEND_TOAST_ID = "borrow-or-lend";
const EMISSION_MINT_INFO_MAP = new Map<string, { tokenSymbol: string; tokenLogoUri: string }>([
[
"UXD",
{
tokenSymbol: "UXP",
tokenLogoUri: "/uxp-icon-white.png",
},
],
[
"bSOL",
{
tokenSymbol: "BLZE",
tokenLogoUri: "/blze.png",
},
],
]);

const HtmlTooltip = styled(({ className, ...props }: TooltipProps) => (
<Tooltip {...props} classes={{ popper: className }} />
Expand Down Expand Up @@ -394,7 +410,7 @@ const AssetRow: FC<{
}}
>
<div className="h-full w-full flex justify-end items-center gap-3">
{bank.meta.tokenSymbol === "UXD" && isInLendingMode && (
{bank.info.state.emissionsRate > 0 && EMISSION_MINT_INFO_MAP.get(bank.meta.tokenSymbol) !== undefined && isInLendingMode && (
<div className="w-1/2 flex justify-center sm:justify-end">
<HtmlTooltip
title={
Expand All @@ -404,7 +420,7 @@ const AssetRow: FC<{
</Typography>
{`${percentFormatter.format(bank.info.state.lendingRate)} Supply APY + ${percentFormatter.format(
bank.info.state.emissionsRate
)} UXP rewards.`}
)} ${EMISSION_MINT_INFO_MAP.get(bank.meta.tokenSymbol)!.tokenSymbol} rewards.`}
<br />
<a href="https://docs.marginfi.com">
<u>Learn more.</u>
Expand All @@ -413,7 +429,13 @@ const AssetRow: FC<{
}
placement="left"
>
<Image src="/uxp-icon-white.png" alt="info" height={16} width={16} className="pulse" />
<Image
src={EMISSION_MINT_INFO_MAP.get(bank.meta.tokenSymbol)!.tokenLogoUri}
alt="info"
height={16}
width={16}
className="pulse"
/>
</HtmlTooltip>
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/marginfi-v2-ui-state/src/lib/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const getPointsDataForUser = async (wallet: string | undefined): Promise<UserPoi
depositPoints,
borrowPoints,
referralPoints,
referralLink: pointsData.referral_link,
referralLink: userReferralCode,
isCustomReferralLink,
userRank,
totalPoints,
Expand Down