diff --git a/README.md b/README.md index 8ac1adc..4c64a0b 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,10 @@ yarn start:ws ws-url="" room-id="" language="" - read-only - no-join - no-share - no-leave + read-only="true" + no-join="true" + no-share="true" + no-leave="true" /> ``` diff --git a/api/package.json b/api/package.json index 62cf5e1..8a8c3ef 100644 --- a/api/package.json +++ b/api/package.json @@ -23,7 +23,7 @@ "@types/cors": "^2.8.13", "@types/express": "^4.17.17", "@types/multer": "^1.4.7", - "@types/node": "^18.15.0", + "@types/node": "^18.15.1", "nodemon": "^2.0.21", "ts-node": "^10.9.1", "tsconfig-paths": "^4.1.2", diff --git a/client/.env.example b/client/.env.example deleted file mode 100644 index 0239ce9..0000000 --- a/client/.env.example +++ /dev/null @@ -1,4 +0,0 @@ -VITE_WS_URL="ws://localhost:1234/ws" -VITE_API_URL="http://localhost:8080" -VITE_LANGUAGE="en" -VITE_IDB_NAME="tldraw" diff --git a/client/index.html b/client/index.html index dcd28ba..3c3abac 100644 --- a/client/index.html +++ b/client/index.html @@ -10,7 +10,14 @@ tldraw -
+
+ +
diff --git a/client/package.json b/client/package.json index 6fcb1bd..e19e59e 100644 --- a/client/package.json +++ b/client/package.json @@ -21,14 +21,15 @@ "axios": "^1.3.4", "react": "^18.2.0", "react-dom": "^18.2.0", - "sass": "^1.58.3", + "react-hotkeys-hook": "^4.3.8", + "sass": "^1.59.2", "uuid": "^9.0.0", "y-presence": "^0.2.3", - "y-websocket": "^1.4.6", - "yjs": "^13.5.49" + "y-websocket": "^1.5.0", + "yjs": "^13.5.50" }, "devDependencies": { - "@types/node": "^18.15.0", + "@types/node": "^18.15.1", "@types/react": "^18.0.28", "@types/react-dom": "^18.0.11", "@types/uuid": "^9.0.1", diff --git a/client/src/App.tsx b/client/src/App.tsx deleted file mode 100644 index acd6e6e..0000000 --- a/client/src/App.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import "./App.scss"; - -const { VITE_API_URL, VITE_IDB_NAME, VITE_LANGUAGE, VITE_WS_URL } = import.meta - .env; - -export default function App() { - const urlParams = window.location.pathname.slice(1).split("/"); - const roomId = urlParams[0] === "r" ? urlParams[1] : undefined; - - return ( -
- -
- ); -} diff --git a/client/src/App.scss b/client/src/assets/scss/editor.scss similarity index 68% rename from client/src/App.scss rename to client/src/assets/scss/editor.scss index cba8cf2..d2531e8 100644 --- a/client/src/App.scss +++ b/client/src/assets/scss/editor.scss @@ -1,30 +1,3 @@ -html, -body { - padding: 0; - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, - Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; -} - -a { - color: inherit; - text-decoration: none; -} - -* { - box-sizing: border-box; -} - -.tldraw { - position: fixed; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; - width: 100%; - height: 100%; -} - $border-radius: 9px; $height: 40px; diff --git a/client/src/assets/scss/main.scss b/client/src/assets/scss/main.scss new file mode 100644 index 0000000..282e078 --- /dev/null +++ b/client/src/assets/scss/main.scss @@ -0,0 +1,26 @@ +html, +body { + padding: 0; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, + Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif; +} + +a { + color: inherit; + text-decoration: none; +} + +* { + box-sizing: border-box; +} + +.tldraw { + position: fixed; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; + width: 100%; + height: 100%; +} diff --git a/client/src/components/Editor.tsx b/client/src/components/Editor.tsx index 34a54f4..9b010b9 100644 --- a/client/src/components/Editor.tsx +++ b/client/src/components/Editor.tsx @@ -12,14 +12,15 @@ import { } from "@fortawesome/free-solid-svg-icons"; import MultiplayerEditor from "./MultiplayerEditor"; import SingleplayerEditor from "./SingleplayerEditor"; +import "../assets/scss/editor.scss"; type Settings = { idbName: string; apiUrl: string; wsUrl?: string; roomId?: string; - readOnly?: boolean; language?: string; + readOnly?: boolean; noJoin?: boolean; noLeave?: boolean; noShare?: boolean; @@ -57,6 +58,7 @@ function Editor({ language = language || "en"; readOnly = readOnly || false; + let editor = ( ); + if (wsUrl && room && uuidValidate(room)) { let doc = newDoc(); if (useLocalDoc) doc = cloneDoc(localDoc); diff --git a/client/src/main.tsx b/client/src/main.tsx index e683c66..3ce7d15 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -1,11 +1,3 @@ -import React from "react"; -import ReactDOM from "react-dom/client"; -import App from "./App"; +import "./assets/scss/main.scss"; import "./ce"; - -ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( - - - -); diff --git a/package.json b/package.json index 6390efb..ad1ac49 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "client" ], "scripts": { - "initialize": "yarn && cp ./api/.env.example ./api/.env && cp ./client/.env.example ./client/.env", + "initialize": "yarn && cp api/.env.example api/.env", "clean": "find . -name node_modules -o -name dist -type d | xargs rm -rf", "dev": "concurrently -n WS,API,Client \"yarn start:ws\" \"yarn dev:api\" \"yarn dev:client\"", "dev:api": "yarn workspace api dev", diff --git a/yarn.lock b/yarn.lock index bed5ae4..0777f06 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1218,10 +1218,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.2.tgz#c076ed1d7b6095078ad3cf21dfeea951842778b1" integrity sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA== -"@types/node@^18.15.0": - version "18.15.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.0.tgz#286a65e3fdffd691e170541e6ecb0410b16a38be" - integrity sha512-z6nr0TTEOBGkzLGmbypWOGnpSpSIBorEhC4L+4HeQ2iezKCi4f77kyslRwvHeNitymGQ+oFyIWGP96l/DPSV9w== +"@types/node@^18.15.1": + version "18.15.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.1.tgz#41dc2bf78e8085a250d4670d95edb7fba621dd29" + integrity sha512-U2TWca8AeHSmbpi314QBESRk7oPjSZjDsR+c+H4ECC1l+kFgpZf8Ydhv3SJpPy51VyZHHqxlb6mTTqYNNRVAIw== "@types/prop-types@*": version "15.7.5" @@ -2785,6 +2785,11 @@ react-hotkeys-hook@^3.4.7: dependencies: hotkeys-js "3.9.4" +react-hotkeys-hook@^4.3.8: + version "4.3.8" + resolved "https://registry.yarnpkg.com/react-hotkeys-hook/-/react-hotkeys-hook-4.3.8.tgz#75fa18e7edb393c2d308a59378932c6badf94b80" + integrity sha512-RmrIQ3M259c84MnYVEAQsmHkD6s7XUgLG0rW6S7qjt1Lh7q+SPIz5b6obVU8OJw1Utsj1mUCj6twtBPaK/ytww== + react-intl@^6.1.1: version "6.2.10" resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-6.2.10.tgz#586ba261b3ff67be09072fefdee2ef58497e0ea2" @@ -2961,10 +2966,10 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sass@^1.58.3: - version "1.58.3" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.58.3.tgz#2348cc052061ba4f00243a208b09c40e031f270d" - integrity sha512-Q7RaEtYf6BflYrQ+buPudKR26/lH+10EmO9bBqbmPh/KeLqv8bjpTNqxe71ocONqXq+jYiCbpPUmQMS+JJPk4A== +sass@^1.59.2: + version "1.59.2" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.59.2.tgz#537f6d11614d4f20f97696f23ad358ee398b1937" + integrity sha512-jJyO6SmbzkJexF8MUorHx5tAilcgabioYxT/BHbY4+OvoqmbHxsYlrjZ8Adhqcgl6Zqwie0TgMXLCAmPFxXOuw== dependencies: chokidar ">=3.0.0 <4.0.0" immutable "^4.0.0" @@ -3449,10 +3454,10 @@ y-protocols@^1.0.5: dependencies: lib0 "^0.2.42" -y-websocket@^1.4.6: - version "1.4.6" - resolved "https://registry.yarnpkg.com/y-websocket/-/y-websocket-1.4.6.tgz#61499fe7df63179ed2ba5a525a1514dfb406264c" - integrity sha512-QAmFPlcjUWbdtueMjP/z7CpIJ3pyQbBiPsXyjeeXfSF5VJwV7aqlbU16a0YOsiSQwHCeLO8N2mYs8WsrKfmE7A== +y-websocket@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/y-websocket/-/y-websocket-1.5.0.tgz#3c13ed205f1553185e1d144eac94150b5b5d55d6" + integrity sha512-A8AO6XtnQlYwWFytWdkDCeXg4l8ghRTIw5h2YUgUYDmEC9ugWGIwYNW80yadhSFAF7CvuWTEkQNEpevnH6EiZw== dependencies: lib0 "^0.2.52" lodash.debounce "^4.0.8" @@ -3494,10 +3499,10 @@ yargs@^17.3.1: y18n "^5.0.5" yargs-parser "^21.1.1" -yjs@^13.5.49: - version "13.5.49" - resolved "https://registry.yarnpkg.com/yjs/-/yjs-13.5.49.tgz#09978e912b877aaae0b069d4df22179fa858edec" - integrity sha512-qfQGf8ninOMpOgHkZxLXQOVeLiE9bWiZbwWTkMptFRlNzq9n6Zg3u8XtDFXWf9kv0gXhW4KHEBmHXoGYFEOT3w== +yjs@^13.5.50: + version "13.5.50" + resolved "https://registry.yarnpkg.com/yjs/-/yjs-13.5.50.tgz#ab0605c677922163c9fe49295d3fd47c04c8e0e9" + integrity sha512-Q2KVNfovwjtJV4Yxz+HaFYT6vTYBaFagOSpTL3jbPc7Sbv/My68fLTfPlYy9FmNO87pV8dMBd5XuVar+9WsAWg== dependencies: lib0 "^0.2.49"