From 0ace1b89cd8845e0c882d91aa2eafbc898aef2d1 Mon Sep 17 00:00:00 2001
From: Adam Chambers
Date: Wed, 8 Nov 2023 15:20:46 -0500
Subject: [PATCH] feat: restrict funding wallet popup to once per user
---
.../src/components/common/Wallet/Wallet.tsx | 2 +-
.../common/Wallet/WalletIntroDialog.tsx | 28 ++++++++++++-------
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx
index 748c55da2e..c09d86a0bb 100644
--- a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx
+++ b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx
@@ -273,7 +273,7 @@ export const Wallet = () => {
-
+ {web3authConnected && }
>
);
};
diff --git a/apps/marginfi-v2-ui/src/components/common/Wallet/WalletIntroDialog.tsx b/apps/marginfi-v2-ui/src/components/common/Wallet/WalletIntroDialog.tsx
index 7eb9eaaa89..3de7402ec1 100644
--- a/apps/marginfi-v2-ui/src/components/common/Wallet/WalletIntroDialog.tsx
+++ b/apps/marginfi-v2-ui/src/components/common/Wallet/WalletIntroDialog.tsx
@@ -8,7 +8,20 @@ import { Button } from "~/components/ui/button";
import CopyToClipboard from "react-copy-to-clipboard";
export const WalletIntroDialog = () => {
- const [isWalletIntroOpen, setIsWalletIntroOpen] = React.useState(true);
+ const [isWalletIntroOpen, setIsWalletIntroOpen] = React.useState(false);
+
+ const handleDialogClose = () => {
+ localStorage.setItem("fundingWalletAcknowledged", "true");
+ setIsWalletIntroOpen(false);
+ setIsOpenWallet(true);
+ };
+
+ React.useEffect(() => {
+ if (!localStorage.getItem("fundingWalletAcknowledged")) {
+ setIsWalletIntroOpen(true);
+ }
+ }, []);
+
const [isCopied, setIsCopied] = React.useState(false);
const { wallet } = useWalletContext();
const { setIsOpenWallet } = useWeb3AuthWallet();
@@ -17,7 +30,9 @@ export const WalletIntroDialog = () => {
-
+