diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 4638435e..4bc0147c 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -457,6 +457,7 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { shares, isSold, isAnte, + loanAmount, } = bet const { isResolved, closeTime } = contract @@ -464,7 +465,7 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { const saleAmount = saleBet?.sale?.amount - const saleDisplay = bet.isAnte ? ( + const saleDisplay = isAnte ? ( 'ANTE' ) : saleAmount !== undefined ? ( <>{formatMoney(saleAmount)} (sold) @@ -491,7 +492,10 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { - {formatMoney(amount)} + + {formatMoney(amount)} + {loanAmount ? ` (${formatMoney(loanAmount ?? 0)} loan)` : ''} + {saleDisplay} {!isResolved && {payoutIfChosenDisplay}} @@ -510,18 +514,19 @@ function SellButton(props: { contract: Contract; bet: Bet }) { }, []) const { contract, bet } = props - const isBinary = contract.outcomeType === 'BINARY' + const { outcome, shares, loanAmount } = bet + const [isSubmitting, setIsSubmitting] = useState(false) const initialProb = getOutcomeProbability( contract.totalShares, - bet.outcome === 'NO' ? 'YES' : bet.outcome + outcome === 'NO' ? 'YES' : outcome ) const outcomeProb = getProbabilityAfterSale( contract.totalShares, - bet.outcome, - bet.shares + outcome, + shares ) const saleAmount = calculateSaleAmount(contract, bet) @@ -544,14 +549,19 @@ function SellButton(props: { contract: Contract; bet: Bet }) { Sell
- Do you want to sell {formatWithCommas(bet.shares)} shares of{' '} - for {formatMoney(saleAmount)}? + Do you want to sell {formatWithCommas(shares)} shares of{' '} + for {formatMoney(saleAmount)}?
+ {!!loanAmount && ( +
+ You will also pay back {formatMoney(loanAmount)} of your loan for a + net of {formatMoney(saleAmount - loanAmount)}. +
+ )} -
- ({isBinary ? 'Updated' : }{' '} - probability: {formatPercent(initialProb)} → {formatPercent(outcomeProb)} - ) +
+ (Updated probability: {formatPercent(initialProb)} →{' '} + {formatPercent(outcomeProb)})
)