Fix Free Response card layouts

This commit is contained in:
Austin Chen 2022-05-21 13:50:34 -07:00
parent 98510f233d
commit 1b17d3a102

View File

@ -94,7 +94,7 @@ export function ContractCard(props: {
<div> <div>
<Col <Col
className={clsx( className={clsx(
'relative gap-3 rounded-lg bg-white p-6 pr-7 shadow-md hover:bg-gray-100', 'relative gap-3 rounded-lg bg-white py-4 pl-6 pr-7 shadow-md hover:bg-gray-100',
className className
)} )}
> >
@ -112,6 +112,13 @@ export function ContractCard(props: {
{question} {question}
</p> </p>
{outcomeType === 'FREE_RESPONSE' && (
<FreeResponseTopAnswer
contract={contract as FullContract<DPM, FreeResponse>}
truncate="long"
/>
)}
<MiscDetails <MiscDetails
contract={contract} contract={contract}
showHotVolume={showHotVolume} showHotVolume={showHotVolume}
@ -216,6 +223,25 @@ export function BinaryResolutionOrChance(props: {
) )
} }
function FreeResponseTopAnswer(props: {
contract: FreeResponseContract
truncate: 'short' | 'long' | 'none'
className?: string
}) {
const { contract, truncate, className } = props
const { resolution } = contract
const topAnswer = getTopAnswer(contract)
return topAnswer ? (
<AnswerLabel
className="!text-gray-600"
answer={topAnswer}
truncate={truncate}
/>
) : null
}
export function FreeResponseResolutionOrChance(props: { export function FreeResponseResolutionOrChance(props: {
contract: FreeResponseContract contract: FreeResponseContract
truncate: 'short' | 'long' | 'none' truncate: 'short' | 'long' | 'none'
@ -242,11 +268,6 @@ export function FreeResponseResolutionOrChance(props: {
) : ( ) : (
topAnswer && ( topAnswer && (
<Row className="items-center gap-6"> <Row className="items-center gap-6">
<AnswerLabel
className="!text-gray-600"
answer={topAnswer}
truncate={truncate}
/>
<Col className={clsx('text-3xl', textColor)}> <Col className={clsx('text-3xl', textColor)}>
<div> <div>
{formatPercent(getOutcomeProbability(contract, topAnswer.id))} {formatPercent(getOutcomeProbability(contract, topAnswer.id))}