From cff26115828e1a0dd6de6f1bb8bb3f6f33295c6e Mon Sep 17 00:00:00 2001 From: jahooma Date: Sat, 22 Jan 2022 18:26:56 -0600 Subject: [PATCH] Add back dynamically loading feed --- web/components/contract-feed.tsx | 4 +++- web/pages/home.tsx | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/web/components/contract-feed.tsx b/web/components/contract-feed.tsx index 235c2f37..4b3648c7 100644 --- a/web/components/contract-feed.tsx +++ b/web/components/contract-feed.tsx @@ -47,8 +47,10 @@ export function AvatarWithIcon(props: { username: string; avatarUrl: string }) { return ( diff --git a/web/pages/home.tsx b/web/pages/home.tsx index 7210b9ea..f429cb29 100644 --- a/web/pages/home.tsx +++ b/web/pages/home.tsx @@ -20,6 +20,8 @@ import { Spacer } from '../components/layout/spacer' import { Col } from '../components/layout/col' import { useUser } from '../hooks/use-user' import { ClosingSoonMarkets, HotMarkets } from './markets' +import { useContracts } from '../hooks/use-contracts' +import { useRecentComments } from '../hooks/use-comments' export async function getStaticProps() { const [contracts, recentComments, hotContracts, closingSoonContracts] = @@ -61,7 +63,6 @@ const Home = (props: { closingSoonContracts: Contract[] }) => { const { - activeContracts, activeContractBets, activeContractComments, hotContracts, @@ -70,6 +71,12 @@ const Home = (props: { const user = useUser() + const contracts = useContracts() ?? props.activeContracts + const recentComments = useRecentComments() + const activeContracts = recentComments + ? findActiveContracts(contracts, recentComments) + : props.activeContracts + if (user === null) { Router.replace('/') return <>