tldraw/apps/www/pages/r/[id].tsx
Steve Ruiz e6a3e5c3ea
[big chore] restore core to monorepo (#287)
* move core into repo, apps into apps folder, update tests

* Update scripts for build:core

* improve scripts

* remove noise from www

* Update .gitignore

* Fix focus bug

* add ci test script

* Update main.yml
2021-11-18 13:09:18 +00:00

29 lines
778 B
TypeScript

import * as React from 'react'
import type { GetServerSideProps } from 'next'
import { getSession } from 'next-auth/client'
import dynamic from 'next/dynamic'
const MultiplayerEditor = dynamic(() => import('-components/MultiplayerEditor'), { ssr: false })
interface RoomProps {
id: string
isSponsor: boolean
isUser: boolean
}
export default function Room({ id, isUser, isSponsor }: RoomProps): JSX.Element {
return <MultiplayerEditor isUser={isUser} isSponsor={isSponsor} roomId={id} />
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const session = await getSession(context)
const id = context.query.id?.toString()
return {
props: {
id,
isUser: false,
isSponsor: session?.user ? true : false,
},
}
}