display numeric resolution

This commit is contained in:
mantikoros 2022-05-16 17:21:45 -04:00
parent 6404b15d2a
commit ce52c834aa
2 changed files with 24 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import {
FreeResponse, FreeResponse,
FreeResponseContract, FreeResponseContract,
FullContract, FullContract,
NumericContract,
} from 'common/contract' } from 'common/contract'
import { import {
AnswerLabel, AnswerLabel,
@ -25,6 +26,7 @@ import {
} from '../outcome-label' } from '../outcome-label'
import { getOutcomeProbability, getTopAnswer } from 'common/calculate' import { getOutcomeProbability, getTopAnswer } from 'common/calculate'
import { AbbrContractDetails } from './contract-details' import { AbbrContractDetails } from './contract-details'
import { getValueFromBucket } from 'common/calculate-dpm'
export function ContractCard(props: { export function ContractCard(props: {
contract: Contract contract: Contract
@ -164,3 +166,20 @@ export function FreeResponseResolutionOrChance(props: {
</Col> </Col>
) )
} }
export function NumericResolution(props: {
contract: NumericContract
className?: string
}) {
const { contract, className } = props
const { resolution } = contract
const resolutionValue = getValueFromBucket(resolution, contract)
return (
<Col className={clsx(resolution ? 'text-3xl' : 'text-xl', className)}>
<div className={clsx('text-base text-gray-500')}>Resolved</div>
<div className="text-blue-400">{resolutionValue}</div>
</Col>
)
}

View File

@ -5,6 +5,7 @@ import { AnswersGraph } from 'web/components/answers/answers-graph'
import { import {
BinaryResolutionOrChance, BinaryResolutionOrChance,
FreeResponseResolutionOrChance, FreeResponseResolutionOrChance,
NumericResolution,
} from 'web/components/contract/contract-card' } from 'web/components/contract/contract-card'
import { ContractDetails } from 'web/components/contract/contract-details' import { ContractDetails } from 'web/components/contract/contract-details'
import { ContractProbGraph } from 'web/components/contract/contract-prob-graph' import { ContractProbGraph } from 'web/components/contract/contract-prob-graph'
@ -119,6 +120,10 @@ function ContractEmbed(props: { contract: Contract; bets: Bet[] }) {
truncate="long" truncate="long"
/> />
)} )}
{outcomeType === 'NUMERIC' && resolution && (
<NumericResolution contract={contract} />
)}
</Row> </Row>
<Spacer h={2} /> <Spacer h={2} />