99730b4fe2
* Adds multiplayer support * Update liveblocks.tsx * Update liveblocks.tsx * Create chaos.tsx * Fix undo redo, add merge state * Update multiplayer-editor.tsx * Adds secret room * Update chaos.tsx * Moves shhh to shhhmp * Fix accidentally deleting the editing shape * Fix bug where a selected shape is deleted by another user. * Remove relative path * Tweak editor * Remove chaos endpoint * Adds error state for maximum connections, fixes selectedIds bug on new rooms
34 lines
700 B
TypeScript
34 lines
700 B
TypeScript
import * as React from 'react'
|
|
import type { GetServerSideProps } from 'next'
|
|
import Head from 'next/head'
|
|
|
|
interface RoomProps {
|
|
id?: string
|
|
}
|
|
|
|
export default function RandomRoomPage({ id }: RoomProps): JSX.Element {
|
|
return (
|
|
<>
|
|
<Head>
|
|
<title>tldraw</title>
|
|
</Head>
|
|
<div>Should have routed to room: {id}</div>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
// Generate random id
|
|
const id = Date.now().toString()
|
|
|
|
// Route to a room with that id
|
|
context.res.setHeader('Location', `/r/${id}`)
|
|
context.res.statusCode = 307
|
|
|
|
// Return id (though it shouldn't matter)
|
|
return {
|
|
props: {
|
|
id,
|
|
},
|
|
}
|
|
}
|