From a4330cfdf2e4d57b82f796d83d7fb5b2cc440d9f Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 31 May 2022 10:49:07 -0700 Subject: [PATCH] Publicly display bets placed after 06-01-2022 --- web/components/bets-list.tsx | 9 ++++++--- web/components/user-page.tsx | 28 +++++++++++++++++++++------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/web/components/bets-list.tsx b/web/components/bets-list.tsx index 9ec28b14..0bcb3a61 100644 --- a/web/components/bets-list.tsx +++ b/web/components/bets-list.tsx @@ -52,9 +52,12 @@ import { NumericContract } from 'common/contract' type BetSort = 'newest' | 'profit' | 'closeTime' | 'value' type BetFilter = 'open' | 'sold' | 'closed' | 'resolved' | 'all' -export function BetsList(props: { user: User }) { - const { user } = props - const bets = useUserBets(user.id, { includeRedemptions: true }) +export function BetsList(props: { user: User; hideBetsBefore?: number }) { + const { user, hideBetsBefore } = props + let bets = useUserBets(user.id, { includeRedemptions: true }) + // Hide bets before 06-01-2022 if this isn't your own profile + // NOTE: This means profits shown are only starting 06-01-2022 as well. + bets = (bets ?? []).filter((bet) => bet.createdTime >= (hideBetsBefore ?? 0)) const [contracts, setContracts] = useState() const [sort, setSort] = useState('newest') diff --git a/web/components/user-page.tsx b/web/components/user-page.tsx index e1398fea..c1099ce8 100644 --- a/web/components/user-page.tsx +++ b/web/components/user-page.tsx @@ -44,6 +44,7 @@ export function UserLink(props: { } export const TAB_IDS = ['markets', 'comments', 'bets'] +const JUNE_1_2022 = new Date('2022-06-01T00:00:00.000Z').valueOf() export function UserPage(props: { user: User @@ -229,14 +230,27 @@ export function UserPage(props: { title: 'Bets', content: (
- + )} + - {isCurrentUser && } + {!isCurrentUser && ( + <> + + + + )}
), tabIcon: (