()
useEffect(() => {
if (challengeSlug) {
getChallenge(challengeSlug, contract.id).then((c) => {
setChallenge(c)
})
}
}, [challengeSlug, contract.id])
const bought = amount >= 0 ? 'bought' : 'sold'
const money = formatMoney(Math.abs(amount))
const outOfTotalAmount =
bet.limitProb !== undefined && bet.orderAmount !== undefined
? ` of ${bet.isCancelled ? money : formatMoney(bet.orderAmount)}`
: ''
const hadPoolMatch =
(bet.limitProb === undefined ||
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 (
{!hideUser ? (
) : (
{self?.id === bet.userId ? 'You' : `A ${BETTOR}`}
)}{' '}
{bought} {money}
{outOfTotalAmount}
{!hideOutcome && (
<>
{' '}
{' '}
{fromProb === toProb
? `at ${fromProb}`
: `from ${fromProb} to ${toProb}`}
{challengeSlug && (
[challenge]
)}
>
)}
)
}