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

fix(mfi-v2-ui): various fixes #542

Merged
merged 2 commits into from
Feb 5, 2024
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Image from "next/image";
import React from "react";

import { PublicKey } from "@solana/web3.js";
import Image from "next/image";

import { ActionType, ExtendedBankInfo } from "@mrgnlabs/marginfi-v2-ui-state";
import { LendingModes } from "~/types";
Expand All @@ -14,6 +14,21 @@ type NewAssetBannerProps = {
};

export const NewAssetBanner = ({ bankInfo }: NewAssetBannerProps) => {
const [isBannerVisible, setIsBannerVisible] = React.useState(false);

const handleBannerAcknowledgement = React.useCallback(() => {
window.sessionStorage.setItem("mrgnNewAssetBannerAcknowledged", "true");
setIsBannerVisible(false);
}, []);

React.useEffect(() => {
if (window.sessionStorage.getItem("mrgnNewAssetBannerAcknowledged") !== "true") {
setIsBannerVisible(true);
}
}, []);

if (!isBannerVisible) return null;

return (
<div className="bg-muted text-white/80 py-4 pl-5 pr-12 rounded-sm max-w-fit relative">
<div className="flex gap-6 items-center">
Expand Down Expand Up @@ -48,7 +63,7 @@ export const NewAssetBanner = ({ bankInfo }: NewAssetBannerProps) => {
</ul>
</div>
</div>
<button className="absolute top-3 right-3">
<button className="absolute top-3 right-3" onClick={handleBannerAcknowledgement}>
<IconX className="text-white/80" size={16} />
</button>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/marginfi-v2-ui-state/src/lib/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ const getPointsDataForUser = async (wallet: string | undefined): Promise<UserPoi
if (!pointsData) {
return {
...DEFAULT_USER_POINTS_DATA,
referralLink: userReferralCode,
owner: wallet,
};
}
Expand Down
Loading