From 1b5e33ca54db4e460ff1d06b483ce148ec1add37 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Wed, 19 Jan 2022 16:36:55 -0600 Subject: [PATCH] no ante selling --- common/antes.ts | 2 ++ common/bet.ts | 1 + web/components/bets-list.tsx | 30 ++++++++++++++++++------------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/common/antes.ts b/common/antes.ts index e2c7028c..3604d941 100644 --- a/common/antes.ts +++ b/common/antes.ts @@ -43,6 +43,7 @@ export function getAnteBets( probBefore: p, probAfter: p, createdTime, + isAnte: true, } const noBet: Bet = { @@ -55,6 +56,7 @@ export function getAnteBets( probBefore: p, probAfter: p, createdTime, + isAnte: true, } return { yesBet, noBet } diff --git a/common/bet.ts b/common/bet.ts index 9cbecc9d..a875102c 100644 --- a/common/bet.ts +++ b/common/bet.ts @@ -17,6 +17,7 @@ export type Bet = { } isSold?: boolean // true if this BUY bet has been sold + isAnte?: boolean createdTime: number } diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index c375e167..c237d17c 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -312,10 +312,26 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { probAfter, shares, isSold, + isAnte, } = bet + const { isResolved, closeTime } = contract const isClosed = closeTime && Date.now() > closeTime + const saleAmount = saleBet?.sale?.amount + + const saleDisplay = bet.isAnte ? ( + 'ANTE' + ) : saleAmount !== undefined ? ( + <>{formatMoney(saleAmount)} (sold) + ) : ( + formatMoney( + isResolved + ? resolvedPayout(contract, bet) + : calculateSaleAmount(contract, bet) + ) + ) + return ( {dayjs(createdTime).format('MMM D, h:mma')} @@ -327,19 +343,9 @@ function BetRow(props: { bet: Bet; contract: Contract; saleBet?: Bet }) { {formatPercent(probBefore)} → {formatPercent(probAfter)} {formatWithCommas(shares)} - - {saleBet?.sale ? ( - <>{formatMoney(Math.abs(saleBet.sale.amount))} (sold) - ) : ( - formatMoney( - isResolved - ? resolvedPayout(contract, bet) - : calculateSaleAmount(contract, bet) - ) - )} - + {saleDisplay} - {!isResolved && !isClosed && !isSold && ( + {!isResolved && !isClosed && !isSold && !isAnte && (