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

View File

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