hide profile page from onboarding until its farther along
This commit is contained in:
parent
581c02d0c6
commit
72191f62ef
|
@ -53,6 +53,8 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (connected && isOnboarded && !loadingMangoAccount && !mangoAccount) {
|
if (connected && isOnboarded && !loadingMangoAccount && !mangoAccount) {
|
||||||
setShowFirstAccountModal(true)
|
setShowFirstAccountModal(true)
|
||||||
|
} else {
|
||||||
|
setShowFirstAccountModal(false)
|
||||||
}
|
}
|
||||||
}, [connected, isOnboarded, loadingMangoAccount, mangoAccount])
|
}, [connected, isOnboarded, loadingMangoAccount, mangoAccount])
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,8 @@ const CloseAccountModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
txid: tx,
|
txid: tx,
|
||||||
})
|
})
|
||||||
set((state) => {
|
set((state) => {
|
||||||
state.mangoAccount.loading = true
|
|
||||||
state.mangoAccount.current = undefined
|
state.mangoAccount.current = undefined
|
||||||
})
|
})
|
||||||
setTimeout(() => wallet?.adapter?.disconnect(), 1000)
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|
|
@ -29,8 +29,8 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
const mangoAccountLoading = mangoStore((s) => s.mangoAccount.loading)
|
const mangoAccountLoading = mangoStore((s) => s.mangoAccount.loading)
|
||||||
const [accountName, setAccountName] = useState('')
|
const [accountName, setAccountName] = useState('')
|
||||||
const [loadingAccount, setLoadingAccount] = useState(false)
|
const [loadingAccount, setLoadingAccount] = useState(false)
|
||||||
const [profileName, setProfileName] = useState('')
|
// const [profileName, setProfileName] = useState('')
|
||||||
const [profileCategory, setProfileCategory] = useState('')
|
// const [profileCategory, setProfileCategory] = useState('')
|
||||||
const [showSetupStep, setShowSetupStep] = useState(0)
|
const [showSetupStep, setShowSetupStep] = useState(0)
|
||||||
// const [acceptRisks, setAcceptRisks] = useState(false)
|
// const [acceptRisks, setAcceptRisks] = useState(false)
|
||||||
const [depositToken, setDepositToken] = useState('')
|
const [depositToken, setDepositToken] = useState('')
|
||||||
|
@ -44,7 +44,6 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
|
|
||||||
const handleSaveProfile = () => {
|
const handleSaveProfile = () => {
|
||||||
// save profile details to db then:
|
// save profile details to db then:
|
||||||
|
|
||||||
setShowSetupStep(2)
|
setShowSetupStep(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
// actions.fetchMangoAccounts(wallet!.adapter as unknown as Wallet)
|
// actions.fetchMangoAccounts(wallet!.adapter as unknown as Wallet)
|
||||||
if (tx) {
|
if (tx) {
|
||||||
setLoadingAccount(false)
|
setLoadingAccount(false)
|
||||||
setShowSetupStep(4)
|
setShowSetupStep(3)
|
||||||
notify({
|
notify({
|
||||||
title: t('new-account-success'),
|
title: t('new-account-success'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
|
@ -231,7 +230,7 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
}}
|
}}
|
||||||
key={w.adapter.name}
|
key={w.adapter.name}
|
||||||
>
|
>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center text-th-fgd-4">
|
||||||
<img
|
<img
|
||||||
src={w.adapter.icon}
|
src={w.adapter.icon}
|
||||||
className="mr-2 h-5 w-5"
|
className="mr-2 h-5 w-5"
|
||||||
|
@ -249,7 +248,7 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</EnterRightExitLeft>
|
</EnterRightExitLeft>
|
||||||
<EnterRightExitLeft
|
{/* <EnterRightExitLeft
|
||||||
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
||||||
show={showSetupStep === 2}
|
show={showSetupStep === 2}
|
||||||
style={{ height: 'calc(100% - 12px)' }}
|
style={{ height: 'calc(100% - 12px)' }}
|
||||||
|
@ -296,10 +295,10 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
<LinkButton onClick={handleNextStep}>Skip for now</LinkButton>
|
<LinkButton onClick={handleNextStep}>Skip for now</LinkButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</EnterRightExitLeft>
|
</EnterRightExitLeft> */}
|
||||||
<EnterRightExitLeft
|
<EnterRightExitLeft
|
||||||
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
||||||
show={showSetupStep === 3}
|
show={showSetupStep === 2}
|
||||||
style={{ height: 'calc(100% - 12px)' }}
|
style={{ height: 'calc(100% - 12px)' }}
|
||||||
>
|
>
|
||||||
{loadingAccount ? (
|
{loadingAccount ? (
|
||||||
|
@ -342,7 +341,7 @@ const UserSetupModal = ({ isOpen, onClose }: ModalProps) => {
|
||||||
</EnterRightExitLeft>
|
</EnterRightExitLeft>
|
||||||
<EnterRightExitLeft
|
<EnterRightExitLeft
|
||||||
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
className="absolute top-0.5 left-0 z-20 w-full bg-th-bkg-1 p-6"
|
||||||
show={showSetupStep === 4}
|
show={showSetupStep === 3}
|
||||||
style={{ height: 'calc(100% - 12px)' }}
|
style={{ height: 'calc(100% - 12px)' }}
|
||||||
>
|
>
|
||||||
{submitDeposit ? (
|
{submitDeposit ? (
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useTranslation } from 'next-i18next'
|
||||||
import uniqBy from 'lodash/uniqBy'
|
import uniqBy from 'lodash/uniqBy'
|
||||||
import { notify } from '../../utils/notifications'
|
import { notify } from '../../utils/notifications'
|
||||||
import WalletSelect from './WalletSelect'
|
import WalletSelect from './WalletSelect'
|
||||||
|
import mangoStore from '../../store/state'
|
||||||
|
|
||||||
export const handleWalletConnect = (wallet: Wallet) => {
|
export const handleWalletConnect = (wallet: Wallet) => {
|
||||||
if (!wallet) {
|
if (!wallet) {
|
||||||
|
@ -47,7 +48,11 @@ export const ConnectWalletButton: React.FC = () => {
|
||||||
}, [wallets, installedWallets])
|
}, [wallets, installedWallets])
|
||||||
|
|
||||||
const handleConnect = useCallback(() => {
|
const handleConnect = useCallback(() => {
|
||||||
|
const set = mangoStore.getState().set
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
|
set((state) => {
|
||||||
|
state.mangoAccount.loading = true
|
||||||
|
})
|
||||||
handleWalletConnect(wallet)
|
handleWalletConnect(wallet)
|
||||||
}
|
}
|
||||||
}, [wallet])
|
}, [wallet])
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
"@blockworks-foundation/mango-v4@git+https://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:x-oauth-basic@github.com/blockworks-foundation/mango-v4.git#main":
|
"@blockworks-foundation/mango-v4@git+https://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:x-oauth-basic@github.com/blockworks-foundation/mango-v4.git#main":
|
||||||
version "0.0.1-beta.1"
|
version "0.0.1-beta.1"
|
||||||
resolved "git+https://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:x-oauth-basic@github.com/blockworks-foundation/mango-v4.git#a9c4f549171395bb8d32659e2c6803e43f1664d5"
|
resolved "git+https://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:x-oauth-basic@github.com/blockworks-foundation/mango-v4.git#3c06b718c6faaee861fdbc734399aa72547e8a5c"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@project-serum/anchor" "^0.25.0"
|
"@project-serum/anchor" "^0.25.0"
|
||||||
"@project-serum/serum" "^0.13.65"
|
"@project-serum/serum" "^0.13.65"
|
||||||
|
|
Loading…
Reference in New Issue