feed bets: better prob display

This commit is contained in:
mantikoros 2022-07-20 17:04:11 -05:00
parent 75a1d606cb
commit 49dcd97d70

View File

@ -93,6 +93,24 @@ export function BetStatusText(props: {
bet.fills?.some((fill) => fill.matchedBetId === null)) ?? bet.fills?.some((fill) => fill.matchedBetId === null)) ??
false 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 ( return (
<div className="text-sm text-gray-500"> <div className="text-sm text-gray-500">
{bettor ? ( {bettor ? (
@ -112,22 +130,9 @@ export function BetStatusText(props: {
contract={contract} contract={contract}
truncate="short" truncate="short"
/>{' '} />{' '}
{isPseudoNumeric {fromProb === toProb
? ' from ' + formatNumericProbability(bet.probBefore, contract) ? `at ${fromProb}`
: ' from ' + : `from ${fromProb} to ${toProb}`}
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
)}
</> </>
)} )}
<RelativeTimestamp time={createdTime} /> <RelativeTimestamp time={createdTime} />