import { useState } from 'react' import clsx from 'clsx' import { Button } from 'web/components/button' import { formatMoney, shortFormatNumber } from 'common/util/format' import { Col } from 'web/components/layout/col' import { Tooltip } from '../tooltip' import { CPMMContract } from 'common/contract' import { User } from 'common/user' import { useLiquidity } from 'web/hooks/use-liquidity' import { LiquidityModal } from './liquidity-modal' export function LiquidityButton(props: { contract: CPMMContract user: User | undefined | null }) { const { contract, user } = props const { totalLiquidity: total } = contract const lp = useLiquidity(contract.id) const userActive = lp?.find((l) => l.userId === user?.id) !== undefined const [open, setOpen] = useState(false) const disabled = contract.isResolved || (contract.closeTime ?? Infinity) < Date.now() return ( setOpen(true)} disabled={disabled} /> ) } function LiquidityIconButton(props: { total: number onClick: () => void userActive: boolean isCompact?: boolean disabled?: boolean }) { const { total, userActive, isCompact, onClick, disabled } = props return ( ) }