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

View File

@ -393,6 +393,7 @@ export function BuyPanel(props: {
{user && ( {user && (
<WarningConfirmationButton <WarningConfirmationButton
marketType="binary"
amount={betAmount} amount={betAmount}
outcome={outcome} outcome={outcome}
warning={warning} warning={warning}
@ -401,7 +402,7 @@ export function BuyPanel(props: {
openModalButtonClass={clsx( openModalButtonClass={clsx(
'btn mb-2 flex-1', 'btn mb-2 flex-1',
betDisabled betDisabled
? 'btn-disabled bg-greyscale-1' ? 'btn-disabled bg-greyscale-2'
: outcome === 'NO' : outcome === 'NO'
? 'border-none bg-red-400 hover:bg-red-500' ? 'border-none bg-red-400 hover:bg-red-500'
: 'border-none bg-teal-500 hover:bg-teal-600' : '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: { export function WarningConfirmationButton(props: {
amount: number | undefined amount: number | undefined
outcome?: 'YES' | 'NO' | undefined outcome?: 'YES' | 'NO' | undefined
marketType: 'freeResponse' | 'binary'
warning?: string warning?: string
onSubmit: () => void onSubmit: () => void
disabled?: boolean disabled?: boolean
@ -25,15 +26,24 @@ export function WarningConfirmationButton(props: {
openModalButtonClass, openModalButtonClass,
submitButtonClassName, submitButtonClassName,
outcome, outcome,
marketType,
} = props } = props
{
console.log(outcome)
}
if (!warning) { if (!warning) {
return ( return (
<button <button
className={clsx( className={clsx(
openModalButtonClass, openModalButtonClass,
isSubmitting ? 'loading' : '', isSubmitting ? 'loading btn-disabled' : '',
(disabled || !outcome) && 'btn-disabled bg-greyscale-2' disabled && 'btn-disabled',
marketType === 'binary'
? !outcome
? 'btn-disabled bg-greyscale-2'
: ''
: ''
)} )}
onClick={onSubmit} onClick={onSubmit}
> >