diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 5fd9b1f4..a30c2c1b 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -41,13 +41,14 @@ export function BetPanel(props: { className?: string title?: string // Set if BetPanel is on a feed modal selected?: 'YES' | 'NO' + onBetSuccess?: () => void }) { useEffect(() => { // warm up cloud function placeBet({}).catch() }, []) - const { contract, className, title, selected } = props + const { contract, className, title, selected, onBetSuccess } = props const user = useUser() @@ -96,6 +97,7 @@ export function BetPanel(props: { setIsSubmitting(false) setWasSubmitted(true) setBetAmount(undefined) + if (onBetSuccess) onBetSuccess() } else { setError(result?.error || 'Error placing bet') setIsSubmitting(false) diff --git a/web/components/bet-row.tsx b/web/components/bet-row.tsx index ad442a20..a3f7c70b 100644 --- a/web/components/bet-row.tsx +++ b/web/components/bet-row.tsx @@ -38,6 +38,7 @@ export default function BetRow(props: { contract={props.contract} title={props.contract.question} selected={betChoice} + onBetSuccess={() => setOpen(false)} />