2021-12-03 01:18:00 +00:00
|
|
|
import React from 'react'
|
2022-01-23 00:16:23 +00:00
|
|
|
import Router from 'next/router'
|
|
|
|
|
2022-05-09 13:04:36 +00:00
|
|
|
import { Contract, getContractsBySlugs } from 'web/lib/firebase/contracts'
|
|
|
|
import { Page } from 'web/components/page'
|
2022-06-13 16:19:46 +00:00
|
|
|
import { LandingPagePanel } from 'web/components/landing-page-panel'
|
2022-05-09 13:04:36 +00:00
|
|
|
import { Col } from 'web/components/layout/col'
|
|
|
|
import { useUser } from 'web/hooks/use-user'
|
|
|
|
import { ManifoldLogo } from 'web/components/nav/manifold-logo'
|
2021-12-01 04:20:13 +00:00
|
|
|
|
2021-12-19 05:59:34 +00:00
|
|
|
export async function getStaticProps() {
|
2022-05-10 17:03:53 +00:00
|
|
|
// These hardcoded markets will be shown in the frontpage for signed-out users:
|
2022-05-07 23:44:01 +00:00
|
|
|
const hotContracts = await getContractsBySlugs([
|
2022-06-15 23:05:25 +00:00
|
|
|
'will-max-go-to-prom-with-a-girl',
|
|
|
|
'will-ethereum-switch-to-proof-of-st',
|
2022-05-07 23:44:01 +00:00
|
|
|
'will-russia-control-the-majority-of',
|
|
|
|
'will-elon-musk-buy-twitter-this-yea',
|
2022-06-15 23:05:25 +00:00
|
|
|
'will-trump-be-charged-by-the-grand',
|
|
|
|
'will-spacex-launch-a-starship-into',
|
2022-05-07 23:44:01 +00:00
|
|
|
'who-will-win-the-nba-finals-champio',
|
2022-06-15 23:05:25 +00:00
|
|
|
'who-will-be-time-magazine-person-of',
|
|
|
|
'will-congress-hold-any-hearings-abo-e21f987033b3',
|
|
|
|
'will-at-least-10-world-cities-have',
|
2022-05-07 23:44:01 +00:00
|
|
|
])
|
2022-01-15 00:16:25 +00:00
|
|
|
|
2021-12-19 05:59:34 +00:00
|
|
|
return {
|
2022-01-23 00:16:23 +00:00
|
|
|
props: { hotContracts },
|
2021-12-19 05:59:34 +00:00
|
|
|
revalidate: 60, // regenerate after a minute
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-23 00:16:23 +00:00
|
|
|
const Home = (props: { hotContracts: Contract[] }) => {
|
|
|
|
const { hotContracts } = props
|
2022-01-12 03:56:11 +00:00
|
|
|
|
2022-01-21 18:33:58 +00:00
|
|
|
const user = useUser()
|
|
|
|
|
2022-01-23 00:16:23 +00:00
|
|
|
if (user) {
|
|
|
|
Router.replace('/home')
|
|
|
|
return <></>
|
|
|
|
}
|
|
|
|
|
2022-01-12 03:56:11 +00:00
|
|
|
return (
|
2022-06-13 04:42:41 +00:00
|
|
|
<Page>
|
2022-04-04 05:45:23 +00:00
|
|
|
<div className="px-4 pt-2 md:mt-0 lg:hidden">
|
|
|
|
<ManifoldLogo />
|
|
|
|
</div>
|
2022-01-21 18:33:58 +00:00
|
|
|
<Col className="items-center">
|
|
|
|
<Col className="max-w-3xl">
|
2022-06-13 16:19:46 +00:00
|
|
|
<LandingPagePanel hotContracts={hotContracts ?? []} />
|
2022-04-04 05:45:23 +00:00
|
|
|
{/* <p className="mt-6 text-gray-500">
|
2022-03-25 05:53:12 +00:00
|
|
|
View{' '}
|
|
|
|
<SiteLink href="/markets" className="font-bold text-gray-700">
|
|
|
|
all markets
|
|
|
|
</SiteLink>
|
2022-04-04 05:45:23 +00:00
|
|
|
</p> */}
|
2022-01-21 18:33:58 +00:00
|
|
|
</Col>
|
|
|
|
</Col>
|
2022-01-12 03:56:11 +00:00
|
|
|
</Page>
|
2022-01-05 06:32:52 +00:00
|
|
|
)
|
2021-12-17 04:44:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-02 23:49:46 +00:00
|
|
|
export default Home
|