2021-12-03 01:18:00 +00:00
|
|
|
import React from 'react'
|
|
|
|
|
2021-12-02 23:49:46 +00:00
|
|
|
import type { NextPage } from 'next'
|
2021-12-03 01:18:00 +00:00
|
|
|
|
2021-12-02 23:49:46 +00:00
|
|
|
import { Hero } from '../components/hero'
|
2021-12-15 07:24:55 +00:00
|
|
|
import { useUser } from '../hooks/use-user'
|
|
|
|
import Markets from './markets'
|
2021-12-17 04:44:48 +00:00
|
|
|
import { useContracts } from '../hooks/use-contracts'
|
|
|
|
import { SearchableGrid } from '../components/contracts-list'
|
|
|
|
import { Title } from '../components/title'
|
2021-12-01 04:20:13 +00:00
|
|
|
|
|
|
|
const Home: NextPage = () => {
|
2021-12-15 07:24:55 +00:00
|
|
|
const user = useUser()
|
2021-12-17 03:37:36 +00:00
|
|
|
|
|
|
|
if (user === undefined) return <></>
|
2021-12-17 04:44:48 +00:00
|
|
|
return user ? <Markets /> : <LandingPage />
|
|
|
|
}
|
|
|
|
|
|
|
|
function LandingPage() {
|
|
|
|
const contracts = useContracts()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Hero />
|
|
|
|
<div className="max-w-4xl py-8 mx-auto">
|
|
|
|
<Title text="Explore prediction markets" />
|
|
|
|
<SearchableGrid contracts={contracts === 'loading' ? [] : contracts} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
2021-12-02 23:49:46 +00:00
|
|
|
}
|
2021-12-01 04:20:13 +00:00
|
|
|
|
2021-12-02 23:49:46 +00:00
|
|
|
export default Home
|