diff --git a/web/components/contract/contract-card.tsx b/web/components/contract/contract-card.tsx index 090020e0..4bf6f4d7 100644 --- a/web/components/contract/contract-card.tsx +++ b/web/components/contract/contract-card.tsx @@ -68,7 +68,7 @@ export function ContractCard(props: { return ( @@ -165,11 +165,7 @@ export function ContractCard(props: { showQuickBet ? 'w-[85%]' : 'w-full' )} > - + (ffsx?.contractIds ?? []).includes(m.id)) - .slice(0, 50) +export async function getStaticProps() { + const groupIds = tourneys + .map((data) => data.groupId) + .filter((id) => id != undefined) as string[] + const groups = await Promise.all(groupIds.map(getGroup)) - const ffsxLength = ffsx?.memberIds.length + const contracts = await Promise.all( + groups.map((g) => listContractsByGroupSlug(g?.slug ?? '')) + ) - useEffect(() => console.log(tourneys), []) + const markets = Object.fromEntries( + groupIds.map((id, i) => [id, contracts[i]]) + ) + + const numPeople = Object.fromEntries( + groups.map((g) => [g?.id, g?.memberIds.length]) + ) + + return { props: { markets, numPeople }, revalidate: 60 * 10 } +} + +export default function TournamentPage(props: { + markets: { [groupId: string]: Contract[] } + numPeople: { [groupId: string]: number } +}) { + const { markets = {}, numPeople = {} } = props return ( @@ -87,8 +108,14 @@ export default function TournamentPage() { />

Tournaments

+
+ {tourneys.map(({ groupId, ...data }) => ( -
+
))} @@ -100,10 +127,11 @@ function Section(props: { url?: string blurb: string award?: number + ppl?: number endTime?: Dayjs markets: Contract[] }) { - const { title, url, blurb, award, endTime, markets } = props + const { title, url, blurb, award, ppl, endTime, markets } = props return (
@@ -117,10 +145,12 @@ function Section(props: { 🏆 ${formatLargeNumber(award)} )} - - - 400 - + {!!ppl && ( + + + {ppl} + + )} {endTime && (