From ea51633caa4de25a9be697a09d901d258a39e27a Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 28 Mar 2022 22:22:08 -0500 Subject: [PATCH] Update bets table to show BUY or SELL --- web/components/bet-panel.tsx | 5 ++++- web/components/bets-list.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 9715a870..009bf1dc 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -340,8 +340,11 @@ function SellPanel(props: { setError(undefined) setIsSubmitting(true) + // Sell all shares if remaining shares would be < 1 + const sellAmount = amount === Math.floor(shares) ? shares : amount + const result = await sellShares({ - shares: amount, + shares: sellAmount, outcome: sharesOutcome, contractId: contract.id, }).then((r) => r.data) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 6eb74e5b..751b2691 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -472,6 +472,7 @@ export function ContractBetsTable(props: { + {isCPMM && Type} Outcome Amount {!isCPMM && {isResolved ? <>Payout : <>Sale price}} @@ -541,13 +542,14 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { )} + {isCPMM && {shares >= 0 ? 'BUY' : 'SELL'}} - {formatMoney(amount)} + {formatMoney(Math.abs(amount))} {!isCPMM && {saleDisplay}} {!isCPMM && !isResolved && {payoutIfChosenDisplay}} - {formatWithCommas(shares)} + {formatWithCommas(Math.abs(shares))} {formatPercent(probBefore)} → {formatPercent(probAfter)}