import React from 'react' import dayjs from 'dayjs' import { Contract } from '../lib/firebase/contracts' import { Col } from './layout/col' import { Row } from './layout/row' import { Spacer } from './layout/spacer' import { formatWithCommas } from '../lib/util/format' import { ContractProbGraph } from './contract-prob-graph' export const ContractOverview = (props: { contract: Contract className?: string }) => { const { contract, className } = props const { pot, seedAmounts, createdTime } = contract const volume = pot.YES + pot.NO - seedAmounts.YES - seedAmounts.NO const prob = pot.YES ** 2 / (pot.YES ** 2 + pot.NO ** 2) const probPercent = Math.round(prob * 100) + '%' return (
{contract.question}
By {contract.creatorName}
{dayjs(createdTime).format('MMM D')}
{formatWithCommas(volume)} volume
{probPercent}
chance
{contract.description}
) }