Set all markets to be the logged-in homepage

This commit is contained in:
Austin Chen 2021-12-14 23:24:55 -08:00
parent fda5013bf8
commit b14b433417
2 changed files with 18 additions and 20 deletions

View File

@ -24,21 +24,10 @@ function SignInLink(props: { darkBackground?: boolean }) {
? 'text-white hover:text-gray-300'
: 'hover:text-gray-500'
const [showLogin, setShowLogin] = useState(false)
useEffect(() => {
setShowLogin(location.search.includes('demo'))
}, [])
return (
<>
{user ? (
<>
<Link href="/markets">
<a className={clsx('text-base font-medium', themeClasses)}>
All markets
</a>
</Link>
<Link href="/contract">
<a className={clsx('text-base font-medium', themeClasses)}>
Create a market
@ -51,15 +40,21 @@ function SignInLink(props: { darkBackground?: boolean }) {
</a>
</Link>
</>
) : showLogin ? (
<button
className={clsx('text-base font-medium', themeClasses)}
onClick={() => firebaseLogin()}
>
Sign In
</button>
) : (
<></>
<>
<Link href="/markets">
<a className={clsx('text-base font-medium', themeClasses)}>
All markets
</a>
</Link>
<button
className={clsx('text-base font-medium', themeClasses)}
onClick={() => firebaseLogin()}
>
Sign in
</button>
</>
)}
</>
)

View File

@ -3,9 +3,12 @@ import React from 'react'
import type { NextPage } from 'next'
import { Hero } from '../components/hero'
import { useUser } from '../hooks/use-user'
import Markets from './markets'
const Home: NextPage = () => {
return <Hero />
const user = useUser()
return user ? <Markets /> : <Hero />
}
export default Home