import { useState } from 'react' import Link from 'next/link' import { Menu } from '@headlessui/react' import { DotsHorizontalIcon } from '@heroicons/react/outline' import FloatingElement from './FloatingElement' import { ElementTitle } from './styles' import useMangoStore from '../stores/useMangoStore' import DepositModal from './DepositModal' import WithdrawModal from './WithdrawModal' import Button from './Button' import AccountsModal from './AccountsModal' export default function MarginBalances() { const mangoAccount = useMangoStore((s) => s.selectedMangoAccount.current) const loadingMangoAccount = useMangoStore( (s) => s.selectedMangoAccount.initialLoad ) const connected = useMangoStore((s) => s.wallet.connected) const [showDepositModal, setShowDepositModal] = useState(false) const [showWithdrawModal, setShowWithdrawModal] = useState(false) const [showAccountsModal, setShowAccountsModal] = useState(false) return ( <>
{mangoAccount?.name || 'Mango Account'}
{mangoAccount ? ( {mangoAccount?.publicKey.toString()} ) : connected ? (
Deposit funds to get started
) : null}
{showDepositModal && ( setShowDepositModal(false)} /> )} {showWithdrawModal && ( setShowWithdrawModal(false)} /> )} {showAccountsModal ? ( setShowAccountsModal(false)} isOpen={showAccountsModal} /> ) : null} ) }