Don't show profit on leaderboards
This commit is contained in:
		
							parent
							
								
									272d5ec2e2
								
							
						
					
					
						commit
						9cc1a5199b
					
				| 
						 | 
					@ -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] = (
 | 
				
			||||||
 | 
					    await Promise.all([
 | 
				
			||||||
      queryLeaderboardUsers('allTime'),
 | 
					      queryLeaderboardUsers('allTime'),
 | 
				
			||||||
      queryLeaderboardUsers('monthly'),
 | 
					      queryLeaderboardUsers('monthly'),
 | 
				
			||||||
      queryLeaderboardUsers('weekly'),
 | 
					      queryLeaderboardUsers('weekly'),
 | 
				
			||||||
      queryLeaderboardUsers('daily'),
 | 
					      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>
 | 
				
			||||||
      </>
 | 
					      </>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user