import clsx from 'clsx' import { Contract } from 'common/contract' import { formatMoney } from 'common/util/format' import Link from 'next/link' import { contractPath, getBinaryProbPercent } from 'web/lib/firebase/contracts' import { fromNow } from 'web/lib/util/time' import { BinaryContractOutcomeLabel } from '../outcome-label' import { getColor } from './quick-bet' export function ContractMention(props: { contract: Contract }) { const { contract } = props const { outcomeType, resolution } = contract const probTextColor = `text-${getColor(contract)}` return ( {contract.question} {outcomeType === 'BINARY' && ( {resolution ? ( ) : ( getBinaryProbPercent(contract) )} )} {/* TODO: numeric? */} ) } function tooltipLabel(contract: Contract) { const { resolutionTime, creatorName, volume, closeTime = 0 } = contract const dateFormat = resolutionTime ? `Resolved ${fromNow(resolutionTime)}` : `${closeTime < Date.now() ? 'Closed' : 'Closes'} ${fromNow(closeTime)}` return `By ${creatorName}. ${formatMoney(volume)} bet. ${dateFormat}` }