Tldraw/apps/www/pages/r/[id].tsx

34 wiersze
759 B
TypeScript
Czysty Zwykły widok Historia

2021-09-04 12:18:44 +00:00
import type { GetServerSideProps } from 'next'
import dynamic from 'next/dynamic'
import * as React from 'react'
const IFrameWarning = dynamic(() => import('~components/IFrameWarning'), {
ssr: false,
}) as any
const MultiplayerEditor = dynamic(() => import('~components/MultiplayerEditor'), {
ssr: false,
}) as any
2021-09-04 12:18:44 +00:00
interface RoomProps {
id: string
}
export default function Room({ id }: RoomProps) {
2022-07-08 20:31:32 +00:00
if (typeof window !== 'undefined' && window.self !== window.top) {
2022-07-08 20:25:08 +00:00
return <IFrameWarning url={`https://tldraw.com/r/${id}`} />
}
return <MultiplayerEditor roomId={id} />
2021-09-04 12:18:44 +00:00
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const id = context.query.id?.toString()
2021-09-04 12:18:44 +00:00
return {
props: {
id,
},
}
}