Update bets table to show BUY or SELL

This commit is contained in:
James Grugett 2022-03-28 22:22:08 -05:00
parent 43b404e7ed
commit ea51633caa
2 changed files with 8 additions and 3 deletions

View File

@ -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)

View File

@ -472,6 +472,7 @@ export function ContractBetsTable(props: {
<thead>
<tr className="p-2">
<th></th>
{isCPMM && <th>Type</th>}
<th>Outcome</th>
<th>Amount</th>
{!isCPMM && <th>{isResolved ? <>Payout</> : <>Sale price</>}</th>}
@ -541,13 +542,14 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
<SellButton contract={contract} bet={bet} />
)}
</td>
{isCPMM && <td>{shares >= 0 ? 'BUY' : 'SELL'}</td>}
<td>
<OutcomeLabel outcome={outcome} />
</td>
<td>{formatMoney(amount)}</td>
<td>{formatMoney(Math.abs(amount))}</td>
{!isCPMM && <td>{saleDisplay}</td>}
{!isCPMM && !isResolved && <td>{payoutIfChosenDisplay}</td>}
<td>{formatWithCommas(shares)}</td>
<td>{formatWithCommas(Math.abs(shares))}</td>
<td>
{formatPercent(probBefore)} {formatPercent(probAfter)}
</td>