2021-12-10 14:56:17 +00:00
|
|
|
import React from 'react'
|
2021-12-14 10:23:32 +00:00
|
|
|
import { compute, Contract } from '../lib/firebase/contracts'
|
2021-12-10 14:56:17 +00:00
|
|
|
import { Col } from './layout/col'
|
|
|
|
import { Spacer } from './layout/spacer'
|
2021-12-12 22:14:52 +00:00
|
|
|
import { ContractProbGraph } from './contract-prob-graph'
|
2021-12-14 10:23:32 +00:00
|
|
|
import { ContractDetails } from '../pages/markets'
|
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-14 10:23:32 +00:00
|
|
|
const { probPercent } = compute(contract)
|
2021-12-10 14:56:17 +00:00
|
|
|
|
|
|
|
return (
|
2021-12-12 22:14:52 +00:00
|
|
|
<Col className={className}>
|
2021-12-14 04:54:51 +00:00
|
|
|
<Col className="justify-between md:flex-row">
|
2021-12-12 22:51:44 +00:00
|
|
|
<Col>
|
2021-12-14 10:23:32 +00:00
|
|
|
<div className="text-3xl text-indigo-700 mt-2 mb-4">
|
|
|
|
{contract.question}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<ContractDetails contract={contract} />
|
2021-12-12 22:51:44 +00:00
|
|
|
</Col>
|
|
|
|
|
2021-12-14 06:56:36 +00:00
|
|
|
<Col className="text-4xl mt-4 md:mt-2 md:ml-4 md:mr-6 text-primary items-end self-center md:self-start">
|
2021-12-12 22:51:44 +00:00
|
|
|
{probPercent}
|
|
|
|
<div className="text-xl">chance</div>
|
|
|
|
</Col>
|
2021-12-14 04:54:51 +00:00
|
|
|
</Col>
|
2021-12-10 14:56:17 +00:00
|
|
|
|
|
|
|
<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-14 07:30:09 +00:00
|
|
|
<div className="text-gray-600 whitespace-pre-line">
|
|
|
|
{contract.description}
|
|
|
|
</div>
|
2021-12-10 14:56:17 +00:00
|
|
|
</Col>
|
|
|
|
)
|
|
|
|
}
|