import { Popover } from 'antd'
import { useCallback, useState } from 'react'
import {
ExternalLinkIcon,
InformationCircleIcon,
} from '@heroicons/react/outline'
import FloatingElement from './FloatingElement'
import { ElementTitle } from './styles'
import useMangoStore from '../stores/useMangoStore'
import useMarketList from '../hooks/useMarketList'
import { tokenPrecision } from '../utils/index'
import DepositModal from './DepositModal'
import WithdrawModal from './WithdrawModal'
import Button from './Button'
export default function MarginStats() {
const selectedMangoGroup = useMangoStore((s) => s.selectedMangoGroup.current)
const selectedMarginAccount = useMangoStore(
(s) => s.selectedMarginAccount.current
)
const connected = useMangoStore((s) => s.wallet.connected)
const { symbols } = useMarketList()
const [showDepositModal, setShowDepositModal] = useState(false)
const [showWithdrawModal, setShowWithdrawModal] = useState(false)
const handleCloseDeposit = useCallback(() => {
setShowDepositModal(false)
}, [])
const handleCloseWithdraw = useCallback(() => {
setShowWithdrawModal(false)
}, [])
return (
<>
) : null}
{Object.entries(symbols).map(([name], i) => (
Assets
Deposits
Borrows
Interest (APY)
))}
{name}
{selectedMarginAccount
? selectedMarginAccount
.getUiDeposit(selectedMangoGroup, i)
.toFixed(tokenPrecision[name])
: (0).toFixed(tokenPrecision[name])}
{selectedMarginAccount
? selectedMarginAccount
.getUiDeposit(selectedMangoGroup, i)
.toFixed(tokenPrecision[name])
: (0).toFixed(tokenPrecision[name])}
+{(selectedMangoGroup.getDepositRate(i) * 100).toFixed(2)}
%
{' / '}
-{(selectedMangoGroup.getBorrowRate(i) * 100).toFixed(2)}%