// import { useEffect, useState, useMemo } from 'react' // import { groupBy } from '../utils' // import useTradeHistory from '../hooks/useTradeHistory' import { I80F48 } from '@blockworks-foundation/mango-client/lib/src/fixednum' import useMangoStore, { mangoClient } from '../stores/useMangoStore' import FloatingElement from './FloatingElement' import Tooltip from './Tooltip' // import Button from './Button' // import AlertsModal from './AlertsModal' export default function MarginInfo() { const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const mangoCache = useMangoStore((s) => s.selectedMangoGroup.cache) const selectedMangoAccount = useMangoStore( (s) => s.selectedMangoAccount.current ) // TODO move out of component let initHealth = I80F48.fromString('0') let maintHealth = I80F48.fromString('0') if (selectedMangoAccount) { initHealth = selectedMangoAccount.getHealth(mangoGroup, mangoCache, 'Init') maintHealth = selectedMangoAccount.getHealth( mangoGroup, mangoCache, 'Maint' ) } // const tradeHistory = useTradeHistory() // const tradeHistoryLength = useMemo(() => tradeHistory.length, [tradeHistory]) return ( <>
Init Health
{initHealth.toFixed(3)}
Maint Health
{maintHealth.toFixed(3)}
{/* {openAlertModal ? ( setOpenAlertModal(false)} mangoAccount={selectedMangoAccount} /> ) : null} */}
) }