import { useMemo, useState } from 'react' import { SwitchHorizontalIcon } from '@heroicons/react/outline' import { getWeights } from '@blockworks-foundation/mango-client' import useMangoStore from '../../stores/useMangoStore' import AdvancedTradeForm from './AdvancedTradeForm' import SimpleTradeForm from './SimpleTradeForm' import { FlipCard, FlipCardBack, FlipCardFront, FlipCardInner, StyledFloatingElement, } from '../FlipCard' export default function TradeForm() { const [showAdvancedFrom, setShowAdvancedForm] = useState(true) const marketConfig = useMangoStore((s) => s.selectedMarket.config) const mangoGroup = useMangoStore((s) => s.selectedMangoGroup.current) const connected = useMangoStore((s) => s.wallet.connected) const handleFormChange = () => { setShowAdvancedForm(!showAdvancedFrom) } const initLeverage = useMemo(() => { if (!mangoGroup || !marketConfig) return 1 const ws = getWeights(mangoGroup, marketConfig.marketIndex, 'Init') const w = marketConfig.kind === 'perp' ? ws.perpAssetWeight : ws.spotAssetWeight return Math.round((100 * -1) / (w.toNumber() - 1)) / 100 }, [mangoGroup, marketConfig]) return ( {showAdvancedFrom ? (
{/* */}
) : (
)}
) }