import React, { useState } from 'react' import { Contract } from '../lib/firebase/contracts' import { Col } from './layout/col' import { Row } from './layout/row' import { Spacer } from './layout/spacer' import { YesNoSelector } from './yes-no-selector' export function BetPanel(props: { contract: Contract; className?: string }) { const { contract, className } = props const [betChoice, setBetChoice] = useState<'YES' | 'NO'>('YES') const [betAmount, setBetAmount] = useState(undefined) return (
Pick outcome
Bet amount
setBetAmount(parseInt(e.target.value) || 0)} onFocus={(e) => e.target.select()} />
points
{!!betAmount && ( <>
Average price
{betChoice === 'YES' ? 0.57 : 0.43} points
Estimated winnings
{Math.floor(betAmount / (betChoice === 'YES' ? 0.57 : 0.43))} points
)} ) }