diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index b23f1fa2..c9822688 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -37,7 +37,7 @@ import { filterDefined } from '../../common/util/array' import { LoadingIndicator } from './loading-indicator' import { SiteLink } from './site-link' -type BetSort = 'newest' | 'profit' | 'resolved' | 'value' +type BetSort = 'newest' | 'profit' | 'settled' | 'value' export function BetsList(props: { user: User }) { const { user } = props @@ -106,23 +106,20 @@ export function BetsList(props: { user: User }) { contracts, (c) => -1 * Math.max(...contractBets[c.id].map((bet) => bet.createdTime)) ) - else if (sort === 'resolved') + else if (sort === 'settled') sortedContracts = _.sortBy(contracts, (c) => -1 * (c.resolutionTime ?? 0)) - const [resolved, unresolved] = _.partition( + const [settled, unsettled] = _.partition( sortedContracts, - (c) => c.isResolved + (c) => c.isResolved || contractsInvestment[c.id] === 0 ) - const displayedContracts = sort === 'resolved' ? resolved : unresolved + const displayedContracts = sort === 'settled' ? settled : unsettled - const currentInvestment = _.sumBy( - unresolved, - (c) => contractsInvestment[c.id] - ) + const currentInvestment = _.sumBy(unsettled, (c) => contractsInvestment[c.id]) const currentBetsValue = _.sumBy( - unresolved, + unsettled, (c) => contractsCurrentValue[c.id] ) @@ -161,7 +158,7 @@ export function BetsList(props: { user: User }) { - + @@ -228,7 +225,7 @@ function MyContractBets(props: { contract: Contract; bets: Bet[] }) { /> - + {isBinary && ( <> {resolution ? (