diff --git a/packages/www/next.config.js b/packages/www/next.config.js index 0d6071006..1c2f148a1 100644 --- a/packages/www/next.config.js +++ b/packages/www/next.config.js @@ -1,3 +1,6 @@ -module.exports = { +/* eslint-disable @typescript-eslint/no-var-requires */ +const withTM = require('next-transpile-modules')(['@tldraw/tldraw']) + +module.exports = withTM({ reactStrictMode: true, -} +}) diff --git a/packages/www/package.json b/packages/www/package.json index daf3ab77a..138340042 100644 --- a/packages/www/package.json +++ b/packages/www/package.json @@ -19,7 +19,8 @@ "@tldraw/tldraw": "^0.0.57", "next": "11.1.2", "react": "17.0.2", - "react-dom": "17.0.2" + "react-dom": "17.0.2", + "next-transpile-modules": "^8.0.0" }, "devDependencies": { "@types/react": "^17.0.19", @@ -28,4 +29,4 @@ "eslint-config-next": "11.1.2", "typescript": "^4.4.2" } -} +} \ No newline at end of file diff --git a/packages/www/pages/api/r/[id].tsx b/packages/www/pages/api/r/[id].tsx new file mode 100644 index 000000000..9db65804e --- /dev/null +++ b/packages/www/pages/api/r/[id].tsx @@ -0,0 +1,22 @@ +import type { GetServerSideProps } from 'next' +import * as React from 'react' + +export default function Room(): JSX.Element { + return
Todo
+} + +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const id = ctx.query.id?.toString() + + // Get document from database + + // If document does not exist, create an empty document + + // Return the document + + return { + props: { + id, + }, + } +} diff --git a/packages/www/pages/api/u/[id].tsx b/packages/www/pages/api/u/[id].tsx new file mode 100644 index 000000000..23fd174c2 --- /dev/null +++ b/packages/www/pages/api/u/[id].tsx @@ -0,0 +1,20 @@ +import type { GetServerSideProps } from 'next' +import * as React from 'react' + +export default function UserPage(): JSX.Element { + return
Todo
+} + +export const getServerSideProps: GetServerSideProps = async (ctx) => { + const id = ctx.query.id?.toString() + + // Get user from database + + // If user does not exist, return undefined + + return { + props: { + id, + }, + } +} diff --git a/yarn.lock b/yarn.lock index 842aaf864..697025770 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3501,11 +3501,6 @@ resolved "https://registry.yarnpkg.com/@stitches/react/-/react-0.2.5.tgz#ad15b4e59ac2a0679542ba002d41253244be7dab" integrity sha512-RDVn89kW0R/M4q4TdYvsJ7nckFndzRWGGFJnEHbIH9flOpahtNdPsrxVSsZSjFpxeVqCoOxKujlQjiyRrec1VA== -"@stitches/react@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@stitches/react/-/react-1.0.0.tgz#311413630d96a627ca28f44ebcc9179455cdb73a" - integrity sha512-D0/YUbjuZ52Xd/ojT+TjyjZ7p/hBuPlOQ8VBahpMT6ElXriImhsb+RJwr31FP5HeN+y3wuGrRty6/VQjcHjlyA== - "@testing-library/dom@^8.0.0": version "8.2.0" resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.2.0.tgz#ac46a1b9d7c81f0d341ae38fb5424b64c27d151e" @@ -5854,6 +5849,14 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" +enhanced-resolve@^5.7.0: + version "5.8.2" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz#15ddc779345cbb73e97c611cd00c01c1e7bf4d8b" + integrity sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + enquirer@^2.3.5: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -5979,7 +5982,7 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" -eslint-config-next@^11.1.2: +eslint-config-next@11.1.2: version "11.1.2" resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-11.1.2.tgz#73c918f2fa6120d5f65080bf3fcf6b154905707e" integrity sha512-dFutecxX2Z5/QVlLwdtKt+gIfmNMP8Qx6/qZh3LM/DFVdGJEAnUKrr4VwGmACB2kx/PQ5bx3R+QxnEg4fDPiTg== @@ -6115,7 +6118,7 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== -eslint@^7.32.0: +eslint@7.32.0, eslint@^7.32.0: version "7.32.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== @@ -9199,7 +9202,15 @@ neo-async@^2.6.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next@^11.1.0: +next-transpile-modules@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/next-transpile-modules/-/next-transpile-modules-8.0.0.tgz#56375cdc25ae5d23a834195f277fc2737b26cb97" + integrity sha512-Q2f2yB0zMJ8KJbIYAeZoIxG6cSfVk813zr6B5HzsLMBVcJ3FaF8lKr7WG66n0KlHCwjLSmf/6EkgI6QQVWHrDw== + dependencies: + enhanced-resolve "^5.7.0" + escalade "^3.1.1" + +next@11.1.2: version "11.1.2" resolved "https://registry.yarnpkg.com/next/-/next-11.1.2.tgz#527475787a9a362f1bc916962b0c0655cc05bc91" integrity sha512-azEYL0L+wFjv8lstLru3bgvrzPvK0P7/bz6B/4EJ9sYkXeW8r5Bjh78D/Ol7VOg0EIPz0CXoe72hzAlSAXo9hw== @@ -10441,7 +10452,7 @@ raw-body@2.4.1: iconv-lite "0.4.24" unpipe "1.0.0" -react-dom@^17.0.2: +react-dom@17.0.2, react-dom@^17.0.2: version "17.0.2" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-17.0.2.tgz#ecffb6845e3ad8dbfcdc498f0d0a939736502c23" integrity sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA== @@ -10505,7 +10516,7 @@ react-use-gesture@^9.1.3: resolved "https://registry.yarnpkg.com/react-use-gesture/-/react-use-gesture-9.1.3.tgz#92bd143e4f58e69bd424514a5bfccba2a1d62ec0" integrity sha512-CdqA2SmS/fj3kkS2W8ZU8wjTbVBAIwDWaRprX7OKaj7HlGwBasGEFggmk5qNklknqk9zK/h8D355bEJFTpqEMg== -react@^17.0.2: +react@17.0.2, react@^17.0.2: version "17.0.2" resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" integrity sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA== @@ -11741,6 +11752,11 @@ table@^6.0.9: string-width "^4.2.0" strip-ansi "^6.0.0" +tapable@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b" + integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw== + tar@^4.4.10, tar@^4.4.12, tar@^4.4.8: version "4.4.19" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3"