PseudoNumeric markets store resolveValue in resolved notification and render it

This commit is contained in:
James Grugett 2022-07-10 14:52:31 -05:00
parent 900fc75506
commit f2df32e710
3 changed files with 14 additions and 1 deletions

View File

@ -24,6 +24,9 @@ export const onUpdateContract = functions.firestore
if (resolutionText === 'MKT' && contract.resolutionProbability) if (resolutionText === 'MKT' && contract.resolutionProbability)
resolutionText = `${contract.resolutionProbability}%` resolutionText = `${contract.resolutionProbability}%`
else if (resolutionText === 'MKT') resolutionText = 'PROB' else if (resolutionText === 'MKT') resolutionText = 'PROB'
} else if (contract.outcomeType === 'PSEUDO_NUMERIC') {
if (resolutionText === 'MKT' && contract.resolutionValue)
resolutionText = `${contract.resolutionValue}`
} }
await createNotification( await createNotification(

View File

@ -9,7 +9,7 @@ import {
FreeResponseContract, FreeResponseContract,
resolution, resolution,
} from 'common/contract' } from 'common/contract'
import { formatPercent } from 'common/util/format' import { formatLargeNumber, formatPercent } from 'common/util/format'
import { ClientRender } from './client-render' import { ClientRender } from './client-render'
export function OutcomeLabel(props: { export function OutcomeLabel(props: {
@ -140,6 +140,11 @@ export function ProbPercentLabel(props: { prob: number }) {
return <span className="text-blue-400">{formatPercent(prob)}</span> return <span className="text-blue-400">{formatPercent(prob)}</span>
} }
export function NumericValueLabel(props: { value: number }) {
const { value } = props
return <span className="text-blue-400">{formatLargeNumber(value)}</span>
}
export function AnswerNumberLabel(props: { number: string }) { export function AnswerNumberLabel(props: { number: string }) {
return <span className="text-primary">#{props.number}</span> return <span className="text-primary">#{props.number}</span>
} }

View File

@ -21,7 +21,9 @@ import {
BinaryOutcomeLabel, BinaryOutcomeLabel,
CancelLabel, CancelLabel,
MultiLabel, MultiLabel,
NumericValueLabel,
ProbPercentLabel, ProbPercentLabel,
PseudoNumericOutcomeLabel,
} from 'web/components/outcome-label' } from 'web/components/outcome-label'
import { import {
NotificationGroup, NotificationGroup,
@ -828,6 +830,9 @@ function NotificationTextLabel(props: {
) )
if (sourceText === 'CANCEL') return <CancelLabel /> if (sourceText === 'CANCEL') return <CancelLabel />
if (sourceText === 'MKT' || sourceText === 'PROB') return <MultiLabel /> if (sourceText === 'MKT' || sourceText === 'PROB') return <MultiLabel />
if (contract?.outcomeType === 'PSEUDO_NUMERIC') {
return <NumericValueLabel value={parseFloat(sourceText)} />
}
} }
} }
// Close date will be a number - it looks better without it // Close date will be a number - it looks better without it