Hide profit from user page

This commit is contained in:
James Grugett 2022-08-08 22:29:10 -05:00
parent 9cc1a5199b
commit 3878b08d77
2 changed files with 25 additions and 32 deletions

View File

@ -39,9 +39,6 @@ import { PortfolioValueSection } from './portfolio/portfolio-value-section'
import { filterDefined } from 'common/util/array' import { filterDefined } from 'common/util/array'
import { useUserBets } from 'web/hooks/use-user-bets' import { useUserBets } from 'web/hooks/use-user-bets'
import { ReferralsButton } from 'web/components/referrals-button' import { ReferralsButton } from 'web/components/referrals-button'
import { formatMoney } from 'common/util/format'
import { ShareIconButton } from 'web/components/share-icon-button'
import { ENV_CONFIG } from 'common/envs/constants'
export function UserLink(props: { export function UserLink(props: {
name: string name: string
@ -122,7 +119,6 @@ export function UserPage(props: { user: User; currentUser?: User }) {
const yourFollows = useFollows(currentUser?.id) const yourFollows = useFollows(currentUser?.id)
const isFollowing = yourFollows?.includes(user.id) const isFollowing = yourFollows?.includes(user.id)
const profit = user.profitCached.allTime
const onFollow = () => { const onFollow = () => {
if (!currentUser) return if (!currentUser) return
@ -187,17 +183,6 @@ export function UserPage(props: { user: User; currentUser?: User }) {
<Col className="mx-4 -mt-6"> <Col className="mx-4 -mt-6">
<span className="text-2xl font-bold">{user.name}</span> <span className="text-2xl font-bold">{user.name}</span>
<span className="text-gray-500">@{user.username}</span> <span className="text-gray-500">@{user.username}</span>
<span className="text-gray-500">
<span
className={clsx(
'text-md',
profit >= 0 ? 'text-green-600' : 'text-red-400'
)}
>
{formatMoney(profit)}
</span>{' '}
profit
</span>
<Spacer h={4} /> <Spacer h={4} />
@ -303,23 +288,29 @@ export function UserPage(props: { user: User; currentUser?: User }) {
</span> </span>
), ),
}, },
{ ...(isCurrentUser
title: 'Bets', ? [
content: ( {
<div> title: 'Bets',
<PortfolioValueSection content: (
portfolioHistory={portfolioHistory} <div>
/> <PortfolioValueSection
<BetsList portfolioHistory={portfolioHistory}
user={user} />
bets={userBets} <BetsList
hideBetsBefore={isCurrentUser ? 0 : JUNE_1_2022} user={user}
contractsById={contractsById} bets={userBets}
/> hideBetsBefore={isCurrentUser ? 0 : JUNE_1_2022}
</div> contractsById={contractsById}
), />
tabIcon: <span className="px-0.5 font-bold">{betCount}</span>, </div>
}, ),
tabIcon: (
<span className="px-0.5 font-bold">{betCount}</span>
),
},
]
: []),
]} ]}
/> />
) : ( ) : (

View File

@ -13,6 +13,8 @@ export async function getStaticPropz(props: { params: { username: string } }) {
const { username } = props.params const { username } = props.params
const user = await getUserByUsername(username) const user = await getUserByUsername(username)
if (user) user.profitCached.allTime = 0
return { return {
props: { props: {
user, user,