From 2e70d75a6636f43ea8ef89ff3af05ce813c64940 Mon Sep 17 00:00:00 2001 From: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:18:05 +0700 Subject: [PATCH 01/12] CRDTs working, still finalizing local board state browser storage for offline board access --- .gitignore | 3 +- index.html | 73 ++++++++++++++------------- package.json | 20 +++++--- src/components/Board.tsx | 54 ++++++-------------- src/css/style.css | 27 +++++++++- src/hooks/useGSetState.ts | 34 +++++++++++++ src/hooks/useLocalStorageRoom.ts | 36 +++++++++++++ src/hooks/usePersistentBoard.ts | 86 ++++++++++++++++++++++++++++++++ src/types/crdts.d.ts | 6 +++ vercel.json | 11 ++++ vite.config.ts | 7 ++- worker/TldrawDurableObject.ts | 55 ++++++++++++++++++++ worker/worker.ts | 61 +++++++++++++++++++++- wrangler.toml | 6 ++- 14 files changed, 388 insertions(+), 91 deletions(-) create mode 100644 src/hooks/useGSetState.ts create mode 100644 src/hooks/useLocalStorageRoom.ts create mode 100644 src/hooks/usePersistentBoard.ts create mode 100644 src/types/crdts.d.ts diff --git a/.gitignore b/.gitignore index 66b82c9..981a75d 100644 --- a/.gitignore +++ b/.gitignore @@ -172,4 +172,5 @@ dist .pnp.\* .wrangler/ -.*.md \ No newline at end of file +.*.md +.vercel diff --git a/index.html b/index.html index 063435a..f59f4da 100644 --- a/index.html +++ b/index.html @@ -1,42 +1,45 @@ -
-Joining room...
- ) : isInRoom && shape.props.roomUrl && typeof window !== 'undefined' ? ( -{error}
} -{error}
}