From a2eece5f5c63d6e3fb67d908dc91759cde7fd0ce Mon Sep 17 00:00:00 2001 From: James Grugett Date: Wed, 8 Jun 2022 23:03:03 -0500 Subject: [PATCH] Reveal all bets in Bets tab from June 1st onward --- web/components/feed/feed-bets.tsx | 13 +++++++++---- web/pages/[username]/[contractSlug].tsx | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/components/feed/feed-bets.tsx b/web/components/feed/feed-bets.tsx index d2fe7025..7f3e8f76 100644 --- a/web/components/feed/feed-bets.tsx +++ b/web/components/feed/feed-bets.tsx @@ -1,7 +1,8 @@ +import dayjs from 'dayjs' import { Contract } from 'common/contract' import { Bet } from 'common/bet' import { User } from 'common/user' -import { useUser } from 'web/hooks/use-user' +import { useUser, useUserById } from 'web/hooks/use-user' import { Row } from 'web/components/layout/row' import { Avatar } from 'web/components/avatar' import clsx from 'clsx' @@ -18,10 +19,14 @@ export function FeedBet(props: { bet: Bet hideOutcome: boolean smallAvatar: boolean - bettor?: User // If set: reveal bettor identity }) { - const { contract, bet, hideOutcome, smallAvatar, bettor } = props - const { userId } = bet + const { contract, bet, hideOutcome, smallAvatar } = props + const { userId, createdTime } = bet + + const isBeforeJune2022 = dayjs(createdTime).isBefore('2022-06-01') + // eslint-disable-next-line react-hooks/rules-of-hooks + const bettor = isBeforeJune2022 ? undefined : useUserById(userId) + const user = useUser() const isSelf = user?.id === userId diff --git a/web/pages/[username]/[contractSlug].tsx b/web/pages/[username]/[contractSlug].tsx index bf3571ff..5a915a37 100644 --- a/web/pages/[username]/[contractSlug].tsx +++ b/web/pages/[username]/[contractSlug].tsx @@ -331,7 +331,6 @@ function ContractTopTrades(props: { bet={betsById[topBetId]} hideOutcome={false} smallAvatar={false} - bettor={topBettor} />