Make Yes/No buttons flex. Estimated winnings => Max payout (estimated)

This commit is contained in:
jahooma 2021-12-15 22:55:03 -06:00
parent 36591539d3
commit 81d3c09e60
2 changed files with 7 additions and 14 deletions

View File

@ -38,14 +38,7 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
const amount = parseInt(str)
if (
(str && isNaN(amount)) ||
// Don't update to amount that is rendered in exponential notation.
// e.g. '1e21'
amount.toString().includes('e')
) {
return
}
if (str && isNaN(amount)) return
setBetAmount(str ? amount : undefined)
@ -68,7 +61,7 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
amount: betAmount,
outcome: betChoice,
contractId: contract.id,
}).then(r => r.data as any)
}).then((r) => r.data as any)
console.log('placed bet. Result:', result)
@ -111,7 +104,7 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
<div className="mt-2 mb-1 text-sm text-gray-400">Outcome</div>
<YesNoSelector
className="mx-auto my-2"
className="my-2"
selected={betChoice}
onSelect={(choice) => onBetChoice(choice)}
/>
@ -149,7 +142,7 @@ export function BetPanel(props: { contract: Contract; className?: string }) {
<div>{formatPercent(resultProb)}</div>
</Row>
<div className="mt-2 mb-1 text-sm text-gray-400">Estimated winnings</div>
<div className="mt-2 mb-1 text-sm text-gray-400">Max payout (estimated)</div>
<div>
{formatMoney(estimatedWinnings)} &nbsp; (+{estimatedReturnPercent})
</div>

View File

@ -79,7 +79,7 @@ function Button(props: {
<button
type="button"
className={clsx(
'inline-flex items-center px-8 py-3 border border-transparent rounded-md shadow-sm text-sm font-medium text-white',
'flex-1 inline-flex justify-center items-center px-8 py-3 border border-transparent rounded-md shadow-sm text-sm font-medium text-white',
color === 'green' && 'btn-primary',
color === 'red' && 'bg-red-400 hover:bg-red-500',
color === 'yellow' && 'bg-yellow-400 hover:bg-yellow-500',