diff --git a/apps/trading/client-pages/referrals/create-code-form.tsx b/apps/trading/client-pages/referrals/create-code-form.tsx index 84093fb59..dc5d6ac26 100644 --- a/apps/trading/client-pages/referrals/create-code-form.tsx +++ b/apps/trading/client-pages/referrals/create-code-form.tsx @@ -1,10 +1,13 @@ -import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { RainbowButton } from './buttons'; import { useState } from 'react'; import classNames from 'classnames'; export const CreateCodeForm = () => { const [err, setErr] = useState(null); + const openWalletDialog = useVegaWalletDialogStore( + (store) => store.openVegaWalletDialog + ); const { isReadOnly, pubKey, sendTx } = useVegaWallet(); const onSubmit = () => { if (isReadOnly || !pubKey) { @@ -25,28 +28,34 @@ export const CreateCodeForm = () => { } }; - const btn = ( - onSubmit()} - > - Create a referral code - - ); - return (
-

+

Create a referral code

Generate a referral code to share with your friends and start earning commission.

-
{btn}
+ {pubKey ? ( +
+ onSubmit()} + > + Create a referral code + +
+ ) : ( +
+ openWalletDialog()}> + Connect wallet + +
+ )}
); };