diff --git a/web/pages/create.tsx b/web/pages/create.tsx index 835a7e2d..8e8ddb91 100644 --- a/web/pages/create.tsx +++ b/web/pages/create.tsx @@ -122,7 +122,8 @@ export function NewContract(props: { const [outcomeType, setOutcomeType] = useState( (params?.outcomeType as outcomeType) ?? 'BINARY' ) - const [initialProb] = useState(50) + const [initialProb, setInitialProb] = useState(50) + const [probErrorText, setProbErrorText] = useState('') const [minString, setMinString] = useState(params?.min ?? '') const [maxString, setMaxString] = useState(params?.max ?? '') const [isLogScale, setIsLogScale] = useState(!!params?.isLogScale) @@ -294,6 +295,56 @@ export function NewContract(props: { + {outcomeType === 'BINARY' && ( +
+ + How likely is it to happen? + + + { + setProbErrorText('') + setInitialProb(option as number) + }} + choicesMap={{ + Unlikely: 25, + 'Not Sure': 50, + Likely: 75, + }} + isSubmitting={isSubmitting} + className={'col-span-4 sm:col-span-3'} + > + + { + // show error if prob is less than 5 or greater than 95: + const prob = parseInt(e.target.value) + setInitialProb(prob) + if (prob < 5 || prob > 95) + setProbErrorText('Probability must be between 5% and 95%') + else setProbErrorText('') + }} + /> + % + + + + {probErrorText && ( +
{probErrorText}
+ )} + +
+ )} + {outcomeType === 'MULTIPLE_CHOICE' && ( )}