multiple choice betting fix

This commit is contained in:
ingawei 2022-09-26 21:40:56 -07:00
parent e17a59ae23
commit fd90bc353b
3 changed files with 16 additions and 5 deletions

View File

@ -184,6 +184,7 @@ export function AnswerBetPanel(props: {
<Spacer h={6} />
{user ? (
<WarningConfirmationButton
marketType="freeResponse"
amount={betAmount}
warning={warning}
onSubmit={submitBet}
@ -191,8 +192,7 @@ export function AnswerBetPanel(props: {
disabled={!!betDisabled}
openModalButtonClass={clsx(
'btn self-stretch',
betDisabled ? 'btn-disabled' : 'btn-primary',
isSubmitting ? 'loading' : ''
betDisabled ? 'btn-disabled' : 'btn-primary'
)}
/>
) : (

View File

@ -393,6 +393,7 @@ export function BuyPanel(props: {
{user && (
<WarningConfirmationButton
marketType="binary"
amount={betAmount}
outcome={outcome}
warning={warning}
@ -401,7 +402,7 @@ export function BuyPanel(props: {
openModalButtonClass={clsx(
'btn mb-2 flex-1',
betDisabled
? 'btn-disabled bg-greyscale-1'
? 'btn-disabled bg-greyscale-2'
: outcome === 'NO'
? 'border-none bg-red-400 hover:bg-red-500'
: 'border-none bg-teal-500 hover:bg-teal-600'

View File

@ -9,6 +9,7 @@ import { formatMoney } from 'common/util/format'
export function WarningConfirmationButton(props: {
amount: number | undefined
outcome?: 'YES' | 'NO' | undefined
marketType: 'freeResponse' | 'binary'
warning?: string
onSubmit: () => void
disabled?: boolean
@ -25,15 +26,24 @@ export function WarningConfirmationButton(props: {
openModalButtonClass,
submitButtonClassName,
outcome,
marketType,
} = props
{
console.log(outcome)
}
if (!warning) {
return (
<button
className={clsx(
openModalButtonClass,
isSubmitting ? 'loading' : '',
(disabled || !outcome) && 'btn-disabled bg-greyscale-2'
isSubmitting ? 'loading btn-disabled' : '',
disabled && 'btn-disabled',
marketType === 'binary'
? !outcome
? 'btn-disabled bg-greyscale-2'
: ''
: ''
)}
onClick={onSubmit}
>