2021-08-10 16:12:55 +00:00
|
|
|
import dynamic from 'next/dynamic'
|
2021-09-04 12:02:13 +00:00
|
|
|
import { GetServerSideProps } from 'next'
|
|
|
|
import { getSession } from 'next-auth/client'
|
2021-09-06 13:37:48 +00:00
|
|
|
import Head from 'next/head'
|
2021-09-04 09:14:47 +00:00
|
|
|
|
2021-11-16 16:01:29 +00:00
|
|
|
const Editor = dynamic(() => import('-components/Editor'), { ssr: false })
|
2021-09-04 12:02:13 +00:00
|
|
|
|
2021-11-16 16:01:29 +00:00
|
|
|
interface PageProps {
|
|
|
|
isUser: boolean
|
|
|
|
isSponsor: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Home({ isUser, isSponsor }: PageProps): JSX.Element {
|
2021-09-06 13:37:48 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Head>
|
2021-11-16 16:31:50 +00:00
|
|
|
<title>tldraw</title>
|
2021-09-06 13:37:48 +00:00
|
|
|
</Head>
|
2021-11-16 16:01:29 +00:00
|
|
|
<Editor id="home" isUser={isUser} isSponsor={isSponsor} />
|
2021-09-06 13:37:48 +00:00
|
|
|
</>
|
|
|
|
)
|
2021-09-04 12:02:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
|
|
const session = await getSession(context)
|
|
|
|
|
|
|
|
return {
|
|
|
|
props: {
|
2021-11-19 14:33:15 +00:00
|
|
|
isUser: session?.user ? true : false,
|
2021-11-16 16:01:29 +00:00
|
|
|
isSponsor: session?.user ? true : false,
|
2021-09-04 12:02:13 +00:00
|
|
|
},
|
|
|
|
}
|
2021-08-10 16:12:55 +00:00
|
|
|
}
|