restore your bets for numeric markets

This commit is contained in:
mantikoros 2022-05-16 18:51:40 -04:00
parent e834cf2557
commit a16c4f099e
2 changed files with 15 additions and 8 deletions

View File

@ -431,8 +431,9 @@ export function ContractBetsTable(props: {
(bet) => bet.loanAmount ?? 0 (bet) => bet.loanAmount ?? 0
) )
const { isResolved, mechanism } = contract const { isResolved, mechanism, outcomeType } = contract
const isCPMM = mechanism === 'cpmm-1' const isCPMM = mechanism === 'cpmm-1'
const isNumeric = outcomeType === 'NUMERIC'
return ( return (
<div className={clsx('overflow-x-auto', className)}> <div className={clsx('overflow-x-auto', className)}>
@ -462,7 +463,9 @@ export function ContractBetsTable(props: {
{isCPMM && <th>Type</th>} {isCPMM && <th>Type</th>}
<th>Outcome</th> <th>Outcome</th>
<th>Amount</th> <th>Amount</th>
{!isCPMM && <th>{isResolved ? <>Payout</> : <>Sale price</>}</th>} {!isCPMM && !isNumeric && (
<th>{isResolved ? <>Payout</> : <>Sale price</>}</th>
)}
{!isCPMM && !isResolved && <th>Payout if chosen</th>} {!isCPMM && !isResolved && <th>Payout if chosen</th>}
<th>Shares</th> <th>Shares</th>
<th>Probability</th> <th>Probability</th>
@ -497,11 +500,12 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
isAnte, isAnte,
} = bet } = bet
const { isResolved, closeTime, mechanism } = contract const { isResolved, closeTime, mechanism, outcomeType } = contract
const isClosed = closeTime && Date.now() > closeTime const isClosed = closeTime && Date.now() > closeTime
const isCPMM = mechanism === 'cpmm-1' const isCPMM = mechanism === 'cpmm-1'
const isNumeric = outcomeType === 'NUMERIC'
const saleAmount = saleBet?.sale?.amount const saleAmount = saleBet?.sale?.amount
@ -525,9 +529,12 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
return ( return (
<tr> <tr>
<td className="text-neutral"> <td className="text-neutral">
{!isCPMM && !isResolved && !isClosed && !isSold && !isAnte && ( {!isCPMM &&
<SellButton contract={contract} bet={bet} /> !isResolved &&
)} !isClosed &&
!isSold &&
!isAnte &&
!isNumeric && <SellButton contract={contract} bet={bet} />}
</td> </td>
{isCPMM && <td>{shares >= 0 ? 'BUY' : 'SELL'}</td>} {isCPMM && <td>{shares >= 0 ? 'BUY' : 'SELL'}</td>}
<td> <td>
@ -542,7 +549,7 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) {
)} )}
</td> </td>
<td>{formatMoney(Math.abs(amount))}</td> <td>{formatMoney(Math.abs(amount))}</td>
{!isCPMM && <td>{saleDisplay}</td>} {!isCPMM && !isNumeric && <td>{saleDisplay}</td>}
{!isCPMM && !isResolved && <td>{payoutIfChosenDisplay}</td>} {!isCPMM && !isResolved && <td>{payoutIfChosenDisplay}</td>}
<td>{formatWithCommas(Math.abs(shares))}</td> <td>{formatWithCommas(Math.abs(shares))}</td>
<td> <td>

View File

@ -85,7 +85,7 @@ export function ContractTabs(props: {
...(outcomeType === 'NUMERIC' ...(outcomeType === 'NUMERIC'
? [] ? []
: [{ title: 'Bets', content: betActivity }]), : [{ title: 'Bets', content: betActivity }]),
...(!user || !userBets?.length || outcomeType === 'NUMERIC' ...(!user || !userBets?.length // || outcomeType === 'NUMERIC'
? [] ? []
: [{ title: 'Your bets', content: yourTrades }]), : [{ title: 'Your bets', content: yourTrades }]),
]} ]}