import { Transition } from '@headlessui/react' import { useTranslation } from 'next-i18next' import { ChangeEvent, useEffect, useState } from 'react' import { ModalProps } from '../../types/modal' import { PROFILE_CATEGORIES } from '../../utils/profile' import Input from '../forms/Input' import Label from '../forms/Label' import Select from '../forms/Select' import Button, { LinkButton } from '../shared/Button' import InlineNotification from '../shared/InlineNotification' import Modal from '../shared/Modal' import useLocalStorageState from '../../hooks/useLocalStorageState' import Checkbox from '../forms/Checkbox' import { CheckCircleIcon } from '@heroicons/react/solid' import WalletSelect from '../wallet/WalletSelect' import { useWallet } from '@solana/wallet-adapter-react' import { handleWalletConnect } from '../../utils/wallet' import mangoStore from '../../store/state' import Image from 'next/image' import { formatDecimal } from '../../utils/numbers' import { IS_ONBOARDED_KEY } from '../shared/Layout' const UserSetupModal = ({ isOpen, onClose }: ModalProps) => { const { t } = useTranslation() const { connected, wallet } = useWallet() const group = mangoStore((s) => s.group) const mangoAccount = mangoStore((s) => s.mangoAccount) const [profileName, setProfileName] = useState('') const [accountName, setAccountName] = useState('') const [profileCategory, setProfileCategory] = useState('') const [showSetupStep, setShowSetupStep] = useState(0) const [acceptRisks, setAcceptRisks] = useState(false) const [depositToken, setDepositToken] = useState('') const [, setIsOnboarded] = useLocalStorageState(IS_ONBOARDED_KEY) const banks = group?.banksMap ? Array.from(group?.banksMap, ([key, value]) => ({ key, value })) : [] const handleNextStep = () => { setShowSetupStep(showSetupStep + 1) } const handleSaveProfile = () => { // save profile details to db then: setShowSetupStep(3) } const handleCreateAccount = () => { // create account then: setShowSetupStep(4) } const handleDeposit = () => { // deposit funds then: setIsOnboarded(true) onClose() } const handleEndOnboarding = () => { setIsOnboarded(true) onClose() } const connectWallet = () => { if (wallet) { handleWalletConnect(wallet) } } useEffect(() => { if (connected && mangoAccount) { onClose() } if (connected && !mangoAccount) { setShowSetupStep(2) } }, [mangoAccount, connected]) return (

Step {showSetupStep + 1}/5

Welcome.

You're seconds away from trading the most liquid dex markets on Solana.

Trusted by 1,000s of DeFi users

Deeply liquid markets

Up to 20x leverage across 100s of tokens

Earn interest on your deposits

Borrow 100s of tokens with many collateral options

Choose Wallet

Create Profile

Your public facing identity on Mango...

Skip for now

Account Setup

You need a Mango Account to DeFi on Mango

{/* Not sure if we need to name the first account or if every users first account should have the same name "Main Account" or something similar */}

Fund Your Account

Token

Deposit Rate (APR)

Collateral Weight

{banks.map((bank) => ( ))}
Skip for now
) } export default UserSetupModal