tldraw/apps/www/pages/index.tsx
Faraz Shaikh 6103febaaf
Added exporting of shapes and pages as images (#468)
* Added exporting of shapeses

* added video serialization

* Fix viewport sizes, add chrome-aws-lambda for puppeteer

* Update menu styling

* extract to callback

* Update Loading.tsx

* force update menu

* fix missing fonts

* Added SVG and JSON export

* Fix json exports

* Merge branch 'main' into pr/468, update menus

* Update TldrawApp.ts

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2022-01-10 16:36:28 +00:00

38 lines
973 B
TypeScript

import dynamic from 'next/dynamic'
import type { GetServerSideProps } from 'next'
import { getSession } from 'next-auth/react'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { useMemo } from 'react'
const Editor = dynamic(() => import('components/Editor'), { ssr: false })
interface PageProps {
isUser: boolean
isSponsor: boolean
}
export default function Home({ isUser, isSponsor }: PageProps): JSX.Element {
const { query } = useRouter()
const isExportMode = useMemo(() => 'exportMode' in query, [query])
return (
<>
<Head>
<title>tldraw</title>
</Head>
<Editor id="home" isUser={isUser} isSponsor={isSponsor} showUI={!isExportMode} />
</>
)
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await getSession(context)
return {
props: {
isUser: session?.user ? true : false,
isSponsor: session?.isSponsor || false,
},
}
}