-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,28 @@ | ||
import { Tldraw, TldrawProps } from '@tldraw/tldraw'; | ||
import { Tldraw, TldrawProps, useEditor } from '@tldraw/tldraw'; | ||
import '@tldraw/tldraw/tldraw.css'; | ||
import { useYjsStore } from '../../hooks/useYjsStore'; | ||
import { useStore } from '../../store'; | ||
|
||
|
||
export function Editor(props: Partial<TldrawProps>) { | ||
type Props = { | ||
overlayId: string; | ||
readonly?: boolean; | ||
} | ||
|
||
export function Editor(props: Partial<TldrawProps> & Props) { | ||
const yjsWsUrl = useStore(state => state.yjsWsUrl); | ||
const store = useYjsStore({ | ||
roomId: 'example17', | ||
roomId: props.overlayId, | ||
hostUrl: yjsWsUrl, | ||
}); | ||
const editor = useEditor(); | ||
|
||
|
||
if (props.readonly && editor) { | ||
console.log(editor); | ||
// editor.setCamera({ x: 0, y: 0, z: 1 }); | ||
// editor.updateInstanceState({ isReadonly: true, canMoveCamera: false }) | ||
} | ||
|
||
return <Tldraw inferDarkMode store={store} {...props} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
web/src/pages/overlay/[overlayid].tsx → web/src/pages/overlay/[overlayId].tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from "react"; | ||
import { initializeStore } from "../../service/initializeStore"; | ||
import { OverlayPage } from "../../components/Overlay/OverlayPage"; | ||
import { IframeOverlayPage } from "../../components/Overlay/IframeOverlayPage"; | ||
|
||
export default function Overlay() { | ||
return <OverlayPage /> | ||
return <IframeOverlayPage /> | ||
} | ||
|
||
export const getServerSideProps = initializeStore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use client'; | ||
|
||
import dynamic from "next/dynamic"; | ||
import { useParams } from "next/navigation"; | ||
const Editor = dynamic(async () => (await import('../../../components/Overlay/Editor')).Editor, { ssr: false }) | ||
|
||
export default function OverlaysEditPage() { | ||
const params = useParams<{ overlayId: string }>(); | ||
|
||
return <div className="relative w-full h-[100vh]"> | ||
<Editor overlayId={params.overlayId} /> | ||
</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { OverlaysPage } from "../../components/Overlay/OverlaysPage"; | ||
import { initializeStore } from "../../service/initializeStore"; | ||
|
||
export default function OverlaysPageRoute() { | ||
return <OverlaysPage /> | ||
} | ||
|
||
export const getServerSideProps = initializeStore; |
This file was deleted.
Oops, something went wrong.