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

View File

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

View File

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