diff --git a/web/components/bet-summary.tsx b/web/components/bet-summary.tsx index afeeb3fd..7460c83d 100644 --- a/web/components/bet-summary.tsx +++ b/web/components/bet-summary.tsx @@ -2,14 +2,9 @@ import { sumBy } from 'lodash' import clsx from 'clsx' import { Bet } from 'web/lib/firebase/bets' -import { - formatMoney, - formatWithCommas, -} from 'common/util/format' +import { formatMoney, formatWithCommas } from 'common/util/format' import { Col } from './layout/col' -import { - Contract, -} from 'web/lib/firebase/contracts' +import { Contract } from 'web/lib/firebase/contracts' import { Row } from './layout/row' import { YesLabel, NoLabel } from './outcome-label' import { @@ -17,22 +12,20 @@ import { getContractBetMetrics, getProbability, } from 'common/calculate' -import { floatingEqual } from 'common/util/math' import { InfoTooltip } from './info-tooltip' import { ProfitBadge } from './profit-badge' export function BetsSummary(props: { contract: Contract - bets: Bet[] - isYourBets: boolean + userBets: Bet[] className?: string }) { const { contract, className } = props const { resolution, outcomeType } = contract const isBinary = outcomeType === 'BINARY' - const bets = props.bets.filter((b) => !b.isAnte) - const { profitPercent, payout, profit, totalShares } = getContractBetMetrics( + const bets = props.userBets.filter((b) => !b.isAnte) + const { profitPercent, payout, profit, invested } = getContractBetMetrics( contract, bets ) @@ -48,12 +41,7 @@ export function BetsSummary(props: { const prob = isBinary ? getProbability(contract) : 0 const expectation = prob * yesWinnings + (1 - prob) * noWinnings - if ( - isBinary && - floatingEqual(totalShares.YES ?? 0, 0) && - floatingEqual(totalShares.NO ?? 0, 0) - ) - return <>> + if (bets.length === 0) return <>> return (