import _ from 'lodash' import { Col } from '../components/layout/col' import { Leaderboard } from '../components/leaderboard' import { Page } from '../components/page' import { getTopCreators, getTopTraders, User } from '../lib/firebase/users' import { formatMoney } from '../../common/util/format' import { usePropz } from '../hooks/use-propz' export async function getStaticPropz() { const [topTraders, topCreators] = await Promise.all([ getTopTraders().catch((_) => {}), getTopCreators().catch((_) => {}), ]) return { props: { topTraders, topCreators, }, revalidate: 60, // regenerate after a minute } } export default function Leaderboards(props: { topTraders: User[] topCreators: User[] }) { props = usePropz(getStaticPropz) ?? { topTraders: [], topCreators: [], } const { topTraders, topCreators } = props return ( formatMoney(user.totalPnLCached), }, ]} /> formatMoney(user.creatorVolumeCached), }, ]} /> ) }