Don't show profit on leaderboards

This commit is contained in:
James Grugett 2022-08-08 21:50:15 -05:00
parent 272d5ec2e2
commit 9cc1a5199b

View File

@ -8,7 +8,6 @@ import {
Period, Period,
User, User,
} from 'web/lib/firebase/users' } from 'web/lib/firebase/users'
import { formatMoney } from 'common/util/format'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import { Title } from 'web/components/title' import { Title } from 'web/components/title'
import { Tabs } from 'web/components/layout/tabs' import { Tabs } from 'web/components/layout/tabs'
@ -25,12 +24,20 @@ export async function getStaticProps() {
} }
const fetchProps = async () => { const fetchProps = async () => {
const [allTime, monthly, weekly, daily] = await Promise.all([ const [allTime, monthly, weekly, daily] = (
queryLeaderboardUsers('allTime'), await Promise.all([
queryLeaderboardUsers('monthly'), queryLeaderboardUsers('allTime'),
queryLeaderboardUsers('weekly'), queryLeaderboardUsers('monthly'),
queryLeaderboardUsers('daily'), queryLeaderboardUsers('weekly'),
]) queryLeaderboardUsers('daily'),
])
).map((leaderboard) => {
// Hide profit for now.
leaderboard.topTraders.forEach((user) => {
user.profitCached.allTime = 0
})
return leaderboard
})
const topFollowed = await getTopFollowed() const topFollowed = await getTopFollowed()
return { return {
@ -73,19 +80,21 @@ export default function Leaderboards(_props: {
const LeaderboardWithPeriod = (period: Period) => { const LeaderboardWithPeriod = (period: Period) => {
const { topTraders } = props[period] const { topTraders } = props[period]
return ( return (
<> <>
<Col className="mx-4 items-center gap-10 lg:flex-row"> <Col className="mx-4 max-w-sm items-center gap-10 lg:flex-row">
<Leaderboard <Leaderboard
title="🏅 Top traders" title="🏅 Top traders"
users={topTraders} users={topTraders}
columns={[ columns={
{ [
header: 'Total profit', // Hide profit for now.
renderCell: (user) => formatMoney(user.profitCached[period]), // {
}, // header: 'Total profit',
]} // renderCell: (user) => formatMoney(user.profitCached[period]),
// },
]
}
/> />
</Col> </Col>
</> </>