Fix card showing 0% for multi contracts

This commit is contained in:
James Grugett 2022-02-16 15:04:31 -06:00
parent 68428c76a7
commit 9c9b328860
2 changed files with 12 additions and 10 deletions

View File

@ -111,7 +111,7 @@ function AnswerItem(props: {
return ( return (
<Col <Col
className={clsx( className={clsx(
'p-4 sm:flex-row rounded', 'p-4 sm:flex-row rounded gap-4',
wasResolvedTo wasResolvedTo
? 'bg-green-50 mb-8' ? 'bg-green-50 mb-8'
: isChosen : isChosen

View File

@ -25,8 +25,7 @@ export function ContractCard(props: {
className?: string className?: string
}) { }) {
const { contract, showHotVolume, showCloseTime, className } = props const { contract, showHotVolume, showCloseTime, className } = props
const { question, resolution } = contract const { question } = contract
const probPercent = getBinaryProbPercent(contract)
return ( return (
<div> <div>
@ -67,7 +66,8 @@ export function ResolutionOrChance(props: {
className?: string className?: string
}) { }) {
const { contract, large, className } = props const { contract, large, className } = props
const { resolution } = contract const { resolution, outcomeType } = contract
const isBinary = outcomeType === 'BINARY'
const marketClosed = (contract.closeTime || Infinity) < Date.now() const marketClosed = (contract.closeTime || Infinity) < Date.now()
const resolutionColor = const resolutionColor =
@ -102,12 +102,14 @@ export function ResolutionOrChance(props: {
<div className={resolutionColor}>{resolutionText}</div> <div className={resolutionColor}>{resolutionText}</div>
</> </>
) : ( ) : (
<> isBinary && (
<div className={probColor}>{getBinaryProbPercent(contract)}</div> <>
<div className={clsx(probColor, large ? 'text-xl' : 'text-base')}> <div className={probColor}>{getBinaryProbPercent(contract)}</div>
chance <div className={clsx(probColor, large ? 'text-xl' : 'text-base')}>
</div> chance
</> </div>
</>
)
)} )}
</Col> </Col>
) )