import { createClient } from '@liveblocks/client' import { LiveblocksProvider, RoomProvider } from '@liveblocks/react' import { Tldraw, TldrawApp, useFileSystem } from '@tldraw/tldraw' import { useAccountHandlers } from 'hooks/useAccountHandlers' import { useMultiplayerAssets } from 'hooks/useMultiplayerAssets' import { useMultiplayerState } from 'hooks/useMultiplayerState' import React, { FC } from 'react' import { styled } from 'styles' const client = createClient({ publicApiKey: process.env.NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_API_KEY || '', throttle: 80, }) interface Props { roomId: string isUser: boolean isSponsor: boolean } const MultiplayerEditor: FC = ({ roomId, isUser = false, isSponsor = false, }: { roomId: string isUser: boolean isSponsor: boolean }) => { return ( ) } // Inner Editor function Editor({ roomId, isUser, isSponsor }: Props) { const fileSystemEvents = useFileSystem() const { onSignIn, onSignOut } = useAccountHandlers() const { error, ...events } = useMultiplayerState(roomId) const { onAssetCreate, onAssetDelete } = useMultiplayerAssets() if (error) return Error: {error.message} return (
) } export default MultiplayerEditor const LoadingScreen = styled('div', { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', })