From 6398f93ffe81891dbd00dee1016ef9f5c22ba5ea Mon Sep 17 00:00:00 2001 From: jahooma Date: Sat, 8 Jan 2022 00:23:50 -0600 Subject: [PATCH] Show just the hot markets on homepage. --- web/pages/index.tsx | 12 +++++++----- web/pages/landing-page.tsx | 30 ++++++++++++------------------ 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/web/pages/index.tsx b/web/pages/index.tsx index cd409aba..7896adc7 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -31,13 +31,15 @@ const Home = (props: { contracts: Contract[]; hotContractIds: string[] }) => { if (user === undefined) return <> + const { contracts, hotContractIds } = props + const hotContracts = hotContractIds.map( + (id) => contracts.find((contract) => contract.id === id) as Contract + ) + return user ? ( - + ) : ( - + ) } diff --git a/web/pages/landing-page.tsx b/web/pages/landing-page.tsx index c85aa5f3..b966997c 100644 --- a/web/pages/landing-page.tsx +++ b/web/pages/landing-page.tsx @@ -8,19 +8,20 @@ import { } from '@heroicons/react/outline' import { firebaseLogin } from '../lib/firebase/users' -import { useContracts } from '../hooks/use-contracts' -import { SearchableGrid } from '../components/contracts-list' +import { ContractsGrid } from '../components/contracts-list' import { Col } from '../components/layout/col' import { NavBar } from '../components/nav-bar' import Link from 'next/link' -import { useQueryAndSortParams } from '../hooks/use-sort-and-query-params' +import { Contract } from '../lib/firebase/contracts' + +export default function LandingPage(props: { hotContracts: Contract[] }) { + const { hotContracts } = props -export default function LandingPage() { return (
- +
) } @@ -100,7 +101,7 @@ function FeaturesSection() { { name: 'Creator-driven markets', description: - 'Resolve markets you create with your own judgment—enabling new markets with subjective or personal questions', + 'Resolve markets you create with your own judgment—enabling new markets with subjective or personal questions.', icon: ScaleIcon, }, { @@ -158,22 +159,15 @@ function FeaturesSection() { ) } -function ExploreMarketsSection() { - const contracts = useContracts() - const { query, setQuery, sort, setSort } = useQueryAndSortParams() - +function ExploreMarketsSection(props: { hotContracts: Contract[] }) { + const { hotContracts } = props return (

- Explore our markets + Today's top markets

- + +
) }