smoother onboarding
This commit is contained in:
parent
1d5e9416d1
commit
8f39fb2272
|
@ -27,7 +27,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||
const { width } = useViewport()
|
||||
const [isOnboarded] = useLocalStorageState(IS_ONBOARDED_KEY)
|
||||
const [showUserSetupModal, setShowUserSetupModal] = useState(false)
|
||||
const [showFirstAccountModal, setShowFirstAccountModal] = useState(false)
|
||||
const [showCreateAccountModal, setShowCreateAccountModal] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (mangoAccount) {
|
||||
|
@ -48,14 +48,6 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||
}
|
||||
}, [width])
|
||||
|
||||
useEffect(() => {
|
||||
if (connected && isOnboarded && !loadingMangoAccount && !mangoAccount) {
|
||||
setShowFirstAccountModal(true)
|
||||
} else {
|
||||
setShowFirstAccountModal(false)
|
||||
}
|
||||
}, [connected, isOnboarded, loadingMangoAccount, mangoAccount])
|
||||
|
||||
const handleCloseModal = useCallback(() => {
|
||||
setShowUserSetupModal(false)
|
||||
}, [])
|
||||
|
@ -122,7 +114,7 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||
<div className="hidden items-center md:flex">
|
||||
🥭
|
||||
<LinkButton
|
||||
onClick={() => setShowFirstAccountModal(true)}
|
||||
onClick={() => setShowCreateAccountModal(true)}
|
||||
>
|
||||
<span className="ml-2">{t('create-account')}</span>
|
||||
</LinkButton>
|
||||
|
@ -159,10 +151,10 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||
onClose={handleCloseModal}
|
||||
/>
|
||||
) : null}
|
||||
{showFirstAccountModal ? (
|
||||
{showCreateAccountModal ? (
|
||||
<CreateAccountModal
|
||||
isOpen={showFirstAccountModal}
|
||||
onClose={() => setShowFirstAccountModal(false)}
|
||||
isOpen={showCreateAccountModal}
|
||||
onClose={() => setShowCreateAccountModal(false)}
|
||||
isFirstAccount
|
||||
/>
|
||||
) : null}
|
||||
|
|
|
@ -60,6 +60,7 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
|||
try {
|
||||
await handleWalletConnect(wallet)
|
||||
setShowSetupStep(2)
|
||||
setIsOnboarded(true)
|
||||
} catch (e) {
|
||||
notify({
|
||||
title: 'Setup failed. Refresh and try again.',
|
||||
|
@ -126,7 +127,6 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
|||
})
|
||||
|
||||
await actions.reloadAccount()
|
||||
setIsOnboarded(true)
|
||||
onClose()
|
||||
setSubmitDeposit(false)
|
||||
} catch (e: any) {
|
||||
|
|
Loading…
Reference in New Issue