2021-12-10 14:56:17 +00:00
|
|
|
import React from 'react'
|
|
|
|
import { Contract } from '../lib/firebase/contracts'
|
|
|
|
import { Col } from './layout/col'
|
|
|
|
import { Row } from './layout/row'
|
|
|
|
import { Spacer } from './layout/spacer'
|
2021-12-11 04:09:32 +00:00
|
|
|
import { formatWithCommas } from '../lib/util/format'
|
2021-12-12 22:14:52 +00:00
|
|
|
import { ContractProbGraph } from './contract-prob-graph'
|
2021-12-10 14:56:17 +00:00
|
|
|
|
2021-12-12 22:14:52 +00:00
|
|
|
export const ContractOverview = (props: {
|
|
|
|
contract: Contract
|
|
|
|
className?: string
|
|
|
|
}) => {
|
|
|
|
const { contract, className } = props
|
2021-12-11 04:09:32 +00:00
|
|
|
const { pot, seedAmounts } = contract
|
|
|
|
|
|
|
|
const volume = pot.YES + pot.NO - seedAmounts.YES - seedAmounts.NO
|
2021-12-10 14:56:17 +00:00
|
|
|
|
|
|
|
return (
|
2021-12-12 22:14:52 +00:00
|
|
|
<Col className={className}>
|
2021-12-10 14:56:17 +00:00
|
|
|
<div className="text-3xl font-medium p-2">{contract.question}</div>
|
|
|
|
|
2021-12-10 22:56:26 +00:00
|
|
|
<Row className="flex-wrap text-sm text-gray-600">
|
2021-12-10 18:52:11 +00:00
|
|
|
<div className="p-2 whitespace-nowrap">By {contract.creatorName}</div>
|
2021-12-10 14:56:17 +00:00
|
|
|
<div className="py-2">•</div>
|
2021-12-10 18:52:11 +00:00
|
|
|
<div className="p-2 whitespace-nowrap">Dec 9</div>
|
2021-12-10 14:56:17 +00:00
|
|
|
<div className="py-2">•</div>
|
2021-12-12 22:14:52 +00:00
|
|
|
<div className="p-2 whitespace-nowrap">
|
|
|
|
{formatWithCommas(volume)} volume
|
|
|
|
</div>
|
2021-12-10 14:56:17 +00:00
|
|
|
</Row>
|
|
|
|
|
|
|
|
<Spacer h={4} />
|
|
|
|
|
2021-12-12 22:14:52 +00:00
|
|
|
<ContractProbGraph contract={contract} />
|
2021-12-10 14:56:17 +00:00
|
|
|
|
|
|
|
<Spacer h={12} />
|
|
|
|
|
2021-12-10 22:56:26 +00:00
|
|
|
<div className="text-gray-600">{contract.description}</div>
|
2021-12-10 14:56:17 +00:00
|
|
|
</Col>
|
|
|
|
)
|
|
|
|
}
|