From 49dcd97d7061b1007744307d29c060cd705a0cef Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 20 Jul 2022 17:04:11 -0500 Subject: [PATCH] feed bets: better prob display --- web/components/feed/feed-bets.tsx | 37 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/web/components/feed/feed-bets.tsx b/web/components/feed/feed-bets.tsx index ea73fe7b..408404ba 100644 --- a/web/components/feed/feed-bets.tsx +++ b/web/components/feed/feed-bets.tsx @@ -93,6 +93,24 @@ export function BetStatusText(props: { bet.fills?.some((fill) => fill.matchedBetId === null)) ?? false + const fromProb = + hadPoolMatch || isFreeResponse + ? isPseudoNumeric + ? formatNumericProbability(bet.probBefore, contract) + : formatPercent(bet.probBefore) + : isPseudoNumeric + ? formatNumericProbability(bet.limitProb ?? bet.probBefore, contract) + : formatPercent(bet.limitProb ?? bet.probBefore) + + const toProb = + hadPoolMatch || isFreeResponse + ? isPseudoNumeric + ? formatNumericProbability(bet.probAfter, contract) + : formatPercent(bet.probAfter) + : isPseudoNumeric + ? formatNumericProbability(bet.limitProb ?? bet.probAfter, contract) + : formatPercent(bet.limitProb ?? bet.probAfter) + return (
{bettor ? ( @@ -112,22 +130,9 @@ export function BetStatusText(props: { contract={contract} truncate="short" />{' '} - {isPseudoNumeric - ? ' from ' + formatNumericProbability(bet.probBefore, contract) - : ' from ' + - formatPercent( - hadPoolMatch || isFreeResponse - ? bet.probBefore - : bet.limitProb ?? bet.probBefore - )} - {isPseudoNumeric - ? ' to ' + formatNumericProbability(bet.probAfter, contract) - : ' to ' + - formatPercent( - hadPoolMatch || isFreeResponse - ? bet.probAfter - : bet.limitProb ?? bet.probAfter - )} + {fromProb === toProb + ? `at ${fromProb}` + : `from ${fromProb} to ${toProb}`} )}