Skip to content

Commit

Permalink
feat: restrict funding wallet popup to once per user
Browse files Browse the repository at this point in the history
  • Loading branch information
chambaz committed Nov 8, 2023
1 parent d9efb9d commit 0ace1b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export const Wallet = () => {
</SheetContent>
</Sheet>
<WalletPkDialog pk={pk} resetPk={resetPk} />
<WalletIntroDialog />
{web3authConnected && <WalletIntroDialog />}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -17,7 +30,9 @@ export const WalletIntroDialog = () => {
<Dialog
open={isWalletIntroOpen}
onOpenChange={(open) => {
setIsWalletIntroOpen(open);
if (!open) {
handleDialogClose();
}
}}
>
<DialogContent className="md:max-w-[640px]">
Expand Down Expand Up @@ -62,14 +77,7 @@ export const WalletIntroDialog = () => {
on marginfi to be completed for a fraction of a penny. You must hold a balance of Solana in your wallet to
use the network (we recommend starting with $5 worth of SOL)..
</p>
<Button
onClick={() => {
setIsWalletIntroOpen(false);
setIsOpenWallet(true);
}}
>
Get Started
</Button>
<Button onClick={() => handleDialogClose()}>Get Started</Button>
</div>
</DialogContent>
</Dialog>
Expand Down

3 comments on commit 0ace1b8

@vercel
Copy link

@vercel vercel bot commented on 0ace1b8 Nov 8, 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-mrgn.vercel.app
marginfi.com
www.marginfi.com
marginfi-landing-page-git-production-mrgn.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0ace1b8 Nov 8, 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 0ace1b8 Nov 8, 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.