tldraw/apps/www/pages/r/[id].tsx
Steve Ruiz 7c2777966f
[improvement] Multiplayer + cursors (#457)
* bump versions, improve cursors

* Spline cursors
2021-12-22 00:14:38 +00:00

27 lines
786 B
TypeScript

import * as React from 'react'
import type { GetServerSideProps } from 'next'
import { getSession } from 'next-auth/react'
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: session?.user ? true : false,
isSponsor: session.isSponsor,
},
}
}