From c24007012cd9025023002f42deca8ed2745ebc18 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Tue, 22 Feb 2022 16:55:06 -0600 Subject: [PATCH] bets list: show message if no active bets --- web/components/bets-list.tsx | 42 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index aaa6a0cf..b23f1fa2 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -35,6 +35,7 @@ import { ConfirmationButton } from './confirmation-button' import { OutcomeLabel, YesLabel, NoLabel } from './outcome-label' import { filterDefined } from '../../common/util/array' import { LoadingIndicator } from './loading-indicator' +import { SiteLink } from './site-link' type BetSort = 'newest' | 'profit' | 'resolved' | 'value' @@ -67,17 +68,7 @@ export function BetsList(props: { user: User }) { return } - if (bets.length === 0) - return ( -
- You have not made any bets yet.{' '} - - - Find a prediction market! - - -
- ) + if (bets.length === 0) return // Decending creation time. bets.sort((bet1, bet2) => bet2.createdTime - bet1.createdTime) @@ -174,17 +165,32 @@ export function BetsList(props: { user: User }) { - {displayedContracts.map((contract) => ( - - ))} + {displayedContracts.length === 0 ? ( + + ) : ( + displayedContracts.map((contract) => ( + + )) + )} ) } +const NoBets = () => { + return ( +
+ You have not made any bets yet.{' '} + + Find a prediction market! + +
+ ) +} + function MyContractBets(props: { contract: Contract; bets: Bet[] }) { const { bets, contract } = props const { resolution, outcomeType } = contract