diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx
index a306a020..25cd00ad 100644
--- a/web/components/bets-list.tsx
+++ b/web/components/bets-list.tsx
@@ -3,6 +3,7 @@ import { groupBy, mapValues, sortBy, partition, sumBy } from 'lodash'
import dayjs from 'dayjs'
import { useEffect, useMemo, useState } from 'react'
import clsx from 'clsx'
+import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/solid'
import { Bet } from 'web/lib/firebase/bets'
import { User } from 'web/lib/firebase/users'
@@ -277,13 +278,7 @@ function ContractBets(props: {
bets
)
return (
-
+
setCollapsed((collapsed) => !collapsed)}
@@ -300,10 +295,11 @@ function ContractBets(props: {
{/* Show carrot for collapsing. Hack the positioning. */}
-
+ {collapsed ? (
+
+ ) : (
+
+ )}
@@ -335,55 +331,42 @@ function ContractBets(props: {
-
-
-
- {formatMoney(metric === 'profit' ? profit : payout)}
-
-
-
-
+
+
+ {formatMoney(metric === 'profit' ? profit : payout)}
+
+
+
-
-
+ {!collapsed && (
+
+
-
-
-
-
- {contract.mechanism === 'cpmm-1' && limitBets.length > 0 && (
- <>
+ {contract.mechanism === 'cpmm-1' && limitBets.length > 0 && (
-
Limit orders
+
Limit orders
- >
- )}
+ )}
-
-
-
Bets
-
-
+
Bets
+
+
+ )}
)
}
@@ -427,107 +410,92 @@ export function BetsSummary(props: {
return (
-
- {!isCpmm && (
-
-
- Invested
-
- {formatMoney(invested)}
-
- )}
- {resolution ? (
-
- Payout
-
- {formatMoney(payout)}{' '}
-
-
-
- ) : (
- <>
- {isBinary ? (
- <>
-
-
- Payout if
-
-
- {formatMoney(yesWinnings)}
-
-
-
-
- Payout if
-
-
- {formatMoney(noWinnings)}
-
-
- >
- ) : isPseudoNumeric ? (
- <>
-
-
- Payout if {'>='} {formatLargeNumber(contract.max)}
-
-
- {formatMoney(yesWinnings)}
-
-
-
-
- Payout if {'<='} {formatLargeNumber(contract.min)}
-
-
- {formatMoney(noWinnings)}
-
-
- >
- ) : (
-
-
- Current value
-
- {formatMoney(payout)}
-
- )}
- >
- )}
+ {!isCpmm && (
- Profit
+
+ Invested
+
+ {formatMoney(invested)}
+
+ )}
+ {resolution ? (
+
+ Payout
- {formatMoney(profit)}
- {isYourBets &&
- isCpmm &&
- (isBinary || isPseudoNumeric) &&
- !isClosed &&
- !resolution &&
- hasShares &&
- sharesOutcome &&
- user && (
- <>
-
- {showSellModal && (
-
- )}
- >
- )}
+ {formatMoney(payout)}
-
+ ) : isBinary ? (
+ <>
+
+
+ Payout if
+
+ {formatMoney(yesWinnings)}
+
+
+
+ Payout if
+
+ {formatMoney(noWinnings)}
+
+ >
+ ) : isPseudoNumeric ? (
+ <>
+
+
+ Payout if {'>='} {formatLargeNumber(contract.max)}
+
+ {formatMoney(yesWinnings)}
+
+
+
+ Payout if {'<='} {formatLargeNumber(contract.min)}
+
+ {formatMoney(noWinnings)}
+
+ >
+ ) : (
+
+
+ Current value
+
+ {formatMoney(payout)}
+
+ )}
+
+ Profit
+
+ {formatMoney(profit)}
+ {isYourBets &&
+ isCpmm &&
+ (isBinary || isPseudoNumeric) &&
+ !isClosed &&
+ !resolution &&
+ hasShares &&
+ sharesOutcome &&
+ user && (
+ <>
+
+ {showSellModal && (
+
+ )}
+ >
+ )}
+
+
)
}
@@ -689,7 +657,13 @@ function BetRow(props: {
!isClosed &&
!isSold &&
!isAnte &&
- !isNumeric &&
}
+ !isNumeric && (
+
+ )}
{isCPMM &&
{shares >= 0 ? 'BUY' : 'SELL'} | }
@@ -729,8 +703,12 @@ function BetRow(props: {
)
}
-function SellButton(props: { contract: Contract; bet: Bet }) {
- const { contract, bet } = props
+function SellButton(props: {
+ contract: Contract
+ bet: Bet
+ unfilledBets: LimitBet[]
+}) {
+ const { contract, bet, unfilledBets } = props
const { outcome, shares, loanAmount } = bet
const [isSubmitting, setIsSubmitting] = useState(false)
@@ -740,8 +718,6 @@ function SellButton(props: { contract: Contract; bet: Bet }) {
outcome === 'NO' ? 'YES' : outcome
)
- const unfilledBets = useUnfilledBets(contract.id) ?? []
-
const outcomeProb = getProbabilityAfterSale(
contract,
outcome,
@@ -787,8 +763,8 @@ function SellButton(props: { contract: Contract; bet: Bet }) {
)
}
-function ProfitBadge(props: { profitPercent: number }) {
- const { profitPercent } = props
+function ProfitBadge(props: { profitPercent: number; className?: string }) {
+ const { profitPercent, className } = props
if (!profitPercent) return null
const colors =
profitPercent > 0
@@ -799,7 +775,8 @@ function ProfitBadge(props: { profitPercent: number }) {
{(profitPercent > 0 ? '+' : '') + profitPercent.toFixed(1) + '%'}
|