Show multi resolve options

This commit is contained in:
James Grugett 2022-04-18 17:35:01 -05:00
parent de9a7745a0
commit 7ec1ce174c
3 changed files with 15 additions and 16 deletions

View File

@ -31,7 +31,7 @@ export function AnswersPanel(props: {
resolutions ? -1 * resolutions[answer.id] : 0
),
..._.sortBy(
otherAnswers,
resolution ? [] : otherAnswers,
(answer) => -1 * getDpmOutcomeProbability(contract.totalShares, answer.id)
),
]
@ -82,7 +82,7 @@ export function AnswersPanel(props: {
return (
<Col className="gap-3">
{resolveOption &&
{(resolveOption || resolution === 'MKT') &&
sortedAnswers.map((answer) => (
<AnswerItem
key={answer.id}

View File

@ -12,16 +12,14 @@ import {
import { formatPercent } from '../../common/util/format'
export function OutcomeLabel(props: {
outcome: 'YES' | 'NO' | 'CANCEL' | 'MKT' | string
contract: Contract
outcome: 'YES' | 'NO' | 'CANCEL' | 'MKT' | string
truncate: 'short' | 'long' | 'none'
}) {
const { outcome, contract, truncate } = props
const binaryOutcomes = ['YES', 'NO', 'CANCEL', 'MKT']
if (binaryOutcomes.includes(outcome)) {
if (contract.outcomeType === 'BINARY')
return <BinaryOutcomeLabel outcome={outcome as any} />
}
return (
<FreeResponseOutcomeLabel

View File

@ -98,7 +98,7 @@ export function ContractPageContent(props: FirstArgument<typeof ContractPage>) {
return <Custom404 />
}
const { creatorId, isResolved, question, outcomeType } = contract
const { creatorId, isResolved, question, outcomeType, resolution } = contract
const isCreator = user?.id === creatorId
const isBinary = outcomeType === 'BINARY'
@ -145,15 +145,16 @@ export function ContractPageContent(props: FirstArgument<typeof ContractPage>) {
comments={comments ?? []}
/>
{outcomeType === 'FREE_RESPONSE' && !isResolved && (
<>
<Spacer h={4} />
<AnswersPanel
contract={contract as FullContract<DPM, FreeResponse>}
/>
<Spacer h={4} />
</>
)}
{outcomeType === 'FREE_RESPONSE' &&
(!isResolved || resolution === 'MKT') && (
<>
<Spacer h={4} />
<AnswersPanel
contract={contract as FullContract<DPM, FreeResponse>}
/>
<Spacer h={4} />
</>
)}
{contract.isResolved && (
<>