Show just the hot markets on homepage.
This commit is contained in:
parent
44fa4f263b
commit
6398f93ffe
|
@ -31,13 +31,15 @@ const Home = (props: { contracts: Contract[]; hotContractIds: string[] }) => {
|
||||||
|
|
||||||
if (user === undefined) return <></>
|
if (user === undefined) return <></>
|
||||||
|
|
||||||
|
const { contracts, hotContractIds } = props
|
||||||
|
const hotContracts = hotContractIds.map(
|
||||||
|
(id) => contracts.find((contract) => contract.id === id) as Contract
|
||||||
|
)
|
||||||
|
|
||||||
return user ? (
|
return user ? (
|
||||||
<Markets
|
<Markets contracts={contracts} hotContractIds={hotContractIds} />
|
||||||
contracts={props.contracts}
|
|
||||||
hotContractIds={props.hotContractIds}
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<LandingPage />
|
<LandingPage hotContracts={hotContracts} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,20 @@ import {
|
||||||
} from '@heroicons/react/outline'
|
} from '@heroicons/react/outline'
|
||||||
|
|
||||||
import { firebaseLogin } from '../lib/firebase/users'
|
import { firebaseLogin } from '../lib/firebase/users'
|
||||||
import { useContracts } from '../hooks/use-contracts'
|
import { ContractsGrid } from '../components/contracts-list'
|
||||||
import { SearchableGrid } from '../components/contracts-list'
|
|
||||||
import { Col } from '../components/layout/col'
|
import { Col } from '../components/layout/col'
|
||||||
import { NavBar } from '../components/nav-bar'
|
import { NavBar } from '../components/nav-bar'
|
||||||
import Link from 'next/link'
|
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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Hero />
|
<Hero />
|
||||||
<FeaturesSection />
|
<FeaturesSection />
|
||||||
<ExploreMarketsSection />
|
<ExploreMarketsSection hotContracts={hotContracts} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@ function FeaturesSection() {
|
||||||
{
|
{
|
||||||
name: 'Creator-driven markets',
|
name: 'Creator-driven markets',
|
||||||
description:
|
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,
|
icon: ScaleIcon,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -158,22 +159,15 @@ function FeaturesSection() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function ExploreMarketsSection() {
|
function ExploreMarketsSection(props: { hotContracts: Contract[] }) {
|
||||||
const contracts = useContracts()
|
const { hotContracts } = props
|
||||||
const { query, setQuery, sort, setSort } = useQueryAndSortParams()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-4xl px-4 py-8 mx-auto">
|
<div className="max-w-4xl px-4 py-8 mx-auto">
|
||||||
<p className="my-12 text-3xl leading-8 font-extrabold tracking-tight text-indigo-700 sm:text-4xl">
|
<p className="my-12 text-3xl leading-8 font-extrabold tracking-tight text-indigo-700 sm:text-4xl">
|
||||||
Explore our markets
|
Today's top markets
|
||||||
</p>
|
</p>
|
||||||
<SearchableGrid
|
|
||||||
contracts={contracts === 'loading' ? [] : contracts}
|
<ContractsGrid contracts={hotContracts} />
|
||||||
query={query}
|
|
||||||
setQuery={setQuery}
|
|
||||||
sort={sort}
|
|
||||||
setSort={setSort}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user