mango-v4-ui/components/modals/CreateAccountModal.tsx

31 lines
817 B
TypeScript
Raw Normal View History

2022-08-01 20:43:17 -07:00
import { ModalProps } from '../../types/modal'
import Modal from '../shared/Modal'
2022-10-07 04:47:15 -07:00
import CreateAccountForm from '@components/account/CreateAccountForm'
import { useRouter } from 'next/router'
2022-11-18 09:09:39 -08:00
import useMangoAccount from 'hooks/useMangoAccount'
2022-08-01 20:43:17 -07:00
2022-10-07 04:47:15 -07:00
const CreateAccountModal = ({ isOpen, onClose }: ModalProps) => {
2022-11-18 09:09:39 -08:00
const { mangoAccount } = useMangoAccount()
const router = useRouter()
const handleClose = () => {
2022-11-18 09:09:39 -08:00
if (router.asPath !== '/') {
router.push('/')
}
onClose()
}
2022-08-01 20:43:17 -07:00
return (
<Modal isOpen={isOpen} onClose={onClose}>
2022-10-07 04:47:15 -07:00
<div className="flex min-h-[264px] flex-col items-center justify-center">
2022-10-30 05:02:59 -07:00
<CreateAccountForm
customClose={handleClose}
2022-10-30 05:02:59 -07:00
isFirstAccount={!mangoAccount}
/>
2022-08-01 20:43:17 -07:00
</div>
</Modal>
)
}
2022-08-11 21:20:17 -07:00
export default CreateAccountModal