Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
add document list and detail view
Marc Seitz9093174d020c
diff --git a/components/Skeleton.tsx b/components/Skeleton.tsxnew file mode 100644index 00000000..dacb1d98--- /dev/null+++ b/components/Skeleton.tsx@@ -0,0 +1,15 @@+import { classNames } from "@/lib/utils";++function Skeleton({+ className,+ ...props+}: React.HTMLAttributes<HTMLDivElement>) {+ return (+ <div+ className={classNames("animate-pulse rounded-md bg-gray-800", className!)}+ {...props}+ />+ );+}++export default Skeleton;diff --git a/lib/utils.ts b/lib/utils.tsnew file mode 100644index 00000000..f857299d--- /dev/null+++ b/lib/utils.ts@@ -0,0 +1,8 @@+export function classNames(...classes: string[]) {+ return classes.filter(Boolean).join(" ");+}++export function getExtension(url: string) {+ // @ts-ignore+ return url.split(/[#?]/)[0].split(".").pop().trim();+}diff --git a/package-lock.json b/package-lock.jsonindex ecd0c413..934e07b9 100644--- a/package-lock.json+++ b/package-lock.json@@ -8,18 +8,31 @@"name": "papermark","version": "0.1.0","dependencies": {+ "@headlessui/react": "^1.7.14",+ "@heroicons/react": "^2.0.18",+ "@next-auth/prisma-adapter": "^1.0.6",+ "@prisma/client": "^4.14.1","@types/node": "20.2.5","@types/react": "18.2.7","@types/react-dom": "18.2.4",+ "@vercel/blob": "^0.8.3","autoprefixer": "10.4.14",+ "date-fns": "^2.30.0","eslint": "8.41.0","eslint-config-next": "13.4.4","next": "13.4.4",+ "next-auth": "^4.22.1","postcss": "8.4.23","react": "18.2.0","react-dom": "18.2.0",+ "react-hot-toast": "^2.4.1",+ "react-pdf": "^7.0.1","tailwindcss": "3.3.2","typescript": "5.0.4"+ },+ "devDependencies": {+ "@tailwindcss/forms": "^0.5.3",+ "prisma": "^4.14.1"}},"node_modules/@alloc/quick-lru": {@@ -96,6 +109,29 @@"node": "^12.22.0 || ^14.17.0 || >=16.0.0"}},+ "node_modules/@headlessui/react": {+ "version": "1.7.14",+ "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.14.tgz",+ "integrity": "sha512-znzdq9PG8rkwcu9oQ2FwIy0ZFtP9Z7ycS+BAqJ3R5EIqC/0bJGvhT7193rFf+45i9nnPsYvCQVW4V/bB9Xc+gA==",+ "dependencies": {+ "client-only": "^0.0.1"+ },+ "engines": {+ "node": ">=10"+ },+ "peerDependencies": {+ "react": "^16 || ^17 || ^18",+ "react-dom": "^16 || ^17 || ^18"+ }+ },+ "node_modules/@heroicons/react": {+ "version": "2.0.18",+ "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz",+ "integrity": "sha512-7TyMjRrZZMBPa+/5Y8lN0iyvUU/01PeMGX2+RE7cQWpEUIcb4QotzUObFkJDejj/HUH4qjP/eQ0gzzKs2f+6Yw==",+ "peerDependencies": {+ "react": ">= 16"+ }+ },"node_modules/@humanwhocodes/config-array": {"version": "0.11.8","resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",@@ -174,6 +210,35 @@"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz","integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw=="},+ "node_modules/@mapbox/node-pre-gyp": {+ "version": "1.0.10",+ "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz",+ "integrity": "sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==",+ "optional": true,+ "dependencies": {+ "detect-libc": "^2.0.0",+ "https-proxy-agent": "^5.0.0",+ "make-dir": "^3.1.0",+ "node-fetch": "^2.6.7",+ "nopt": "^5.0.0",+ "npmlog": "^5.0.1",+ "rimraf": "^3.0.2",+ "semver": "^7.3.5",+ "tar": "^6.1.11"+ },+ "bin": {+ "node-pre-gyp": "bin/node-pre-gyp"+ }+ },+ "node_modules/@next-auth/prisma-adapter": {+ "version": "1.0.6",+ "resolved": "https://registry.npmjs.org/@next-auth/prisma-adapter/-/prisma-adapter-1.0.6.tgz",+ "integrity": "sha512-Z7agwfSZEeEcqKqrnisBun7VndRPshd6vyDsoRU68MXbkui8storkHgvN2hnNDrqr/hSCF9aRn56a1qpihaB4A==",+ "peerDependencies": {+ "@prisma/client": ">=2.26.0 || >=3",+ "next-auth": "^4"+ }+ },"node_modules/@next/env": {"version": "13.4.4","resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.4.tgz",@@ -354,6 +419,14 @@"node": ">= 8"}},+ "node_modules/@panva/hkdf": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@panva/hkdf/-/hkdf-1.1.1.tgz",+ "integrity": "sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA==",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/@pkgr/utils": {"version": "2.4.1","resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.1.tgz",@@ -373,6 +446,38 @@"url": "https://opencollective.com/unts"}},+ "node_modules/@prisma/client": {+ "version": "4.14.1",+ "resolved": "https://registry.npmjs.org/@prisma/client/-/client-4.14.1.tgz",+ "integrity": "sha512-TZIswkeX1ccsHG/eN2kICzg/csXll0osK3EHu1QKd8VJ3XLcXozbNELKkCNfsCUvKJAwPdDtFCzF+O+raIVldw==",+ "hasInstallScript": true,+ "dependencies": {+ "@prisma/engines-version": "4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c"+ },+ "engines": {+ "node": ">=14.17"+ },+ "peerDependencies": {+ "prisma": "*"+ },+ "peerDependenciesMeta": {+ "prisma": {+ "optional": true+ }+ }+ },+ "node_modules/@prisma/engines": {+ "version": "4.14.1",+ "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-4.14.1.tgz",+ "integrity": "sha512-APqFddPVHYmWNKqc+5J5SqrLFfOghKOLZxobmguDUacxOwdEutLsbXPVhNnpFDmuQWQFbXmrTTPoRrrF6B1MWA==",+ "devOptional": true,+ "hasInstallScript": true+ },+ "node_modules/@prisma/engines-version": {+ "version": "4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c",+ "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.14.0-67.d9a4c5988f480fa576d43970d5a23641aa77bc9c.tgz",+ "integrity": "sha512-3jum8/YSudeSN0zGW5qkpz+wAN2V/NYCQ+BPjvHYDfWatLWlQkqy99toX0GysDeaUoBIJg1vaz2yKqiA3CFcQw=="+ },"node_modules/@rushstack/eslint-patch": {"version": "1.3.0","resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.0.tgz",@@ -386,6 +491,18 @@"tslib": "^2.4.0"}},+ "node_modules/@tailwindcss/forms": {+ "version": "0.5.3",+ "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.3.tgz",+ "integrity": "sha512-y5mb86JUoiUgBjY/o6FJSFZSEttfb3Q5gllE4xoKjAAD+vBrnIhE4dViwUuow3va8mpH4s9jyUbUbrRGoRdc2Q==",+ "dev": true,+ "dependencies": {+ "mini-svg-data-uri": "^1.2.3"+ },+ "peerDependencies": {+ "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1"+ }+ },"node_modules/@types/json5": {"version": "0.0.29","resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",@@ -520,6 +637,23 @@"url": "https://opencollective.com/typescript-eslint"}},+ "node_modules/@vercel/blob": {+ "version": "0.8.3",+ "resolved": "https://registry.npmjs.org/@vercel/blob/-/blob-0.8.3.tgz",+ "integrity": "sha512-lbnlO0USopJQS5in1F08S57ttk/DSCeE3JOE39WFXh9BBlwcDdhanfkz6sUi1JhkNe1fzwaQ1zYwd0v03mnpqg==",+ "dependencies": {+ "undici": "5.22.0"+ },+ "engines": {+ "node": ">=16.14"+ }+ },+ "node_modules/abbrev": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",+ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",+ "optional": true+ },"node_modules/acorn": {"version": "8.8.2","resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",@@ -539,6 +673,18 @@"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"}},+ "node_modules/agent-base": {+ "version": "6.0.2",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",+ "optional": true,+ "dependencies": {+ "debug": "4"+ },+ "engines": {+ "node": ">= 6.0.0"+ }+ },"node_modules/ajv": {"version": "6.12.6","resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",@@ -593,6 +739,25 @@"node": ">= 8"}},+ "node_modules/aproba": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",+ "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",+ "optional": true+ },+ "node_modules/are-we-there-yet": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",+ "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",+ "optional": true,+ "dependencies": {+ "delegates": "^1.0.0",+ "readable-stream": "^3.6.0"+ },+ "engines": {+ "node": ">=10"+ }+ },"node_modules/arg": {"version": "5.0.2","resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",@@ -910,6 +1075,21 @@}]},+ "node_modules/canvas": {+ "version": "2.11.2",+ "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",+ "integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",+ "hasInstallScript": true,+ "optional": true,+ "dependencies": {+ "@mapbox/node-pre-gyp": "^1.0.0",+ "nan": "^2.17.0",+ "simple-get": "^3.0.3"+ },+ "engines": {+ "node": ">=6"+ }+ },"node_modules/chalk": {"version": "4.1.2","resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",@@ -962,11 +1142,28 @@"node": ">= 6"}},+ "node_modules/chownr": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",+ "optional": true,+ "engines": {+ "node": ">=10"+ }+ },"node_modules/client-only": {"version": "0.0.1","resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz","integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="},+ "node_modules/clsx": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz",+ "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==",+ "engines": {+ "node": ">=6"+ }+ },"node_modules/color-convert": {"version": "2.0.1","resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",@@ -983,6 +1180,15 @@"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz","integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="},+ "node_modules/color-support": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",+ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",+ "optional": true,+ "bin": {+ "color-support": "bin.js"+ }+ },"node_modules/commander": {"version": "4.1.1","resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",@@ -996,6 +1202,20 @@"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz","integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="},+ "node_modules/console-control-strings": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",+ "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",+ "optional": true+ },+ "node_modules/cookie": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",+ "engines": {+ "node": ">= 0.6"+ }+ },"node_modules/cross-spawn": {"version": "7.0.3","resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",@@ -1030,6 +1250,21 @@"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz","integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA=="},+ "node_modules/date-fns": {+ "version": "2.30.0",+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz",+ "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==",+ "dependencies": {+ "@babel/runtime": "^7.21.0"+ },+ "engines": {+ "node": ">=0.11"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/date-fns"+ }+ },"node_modules/debug": {"version": "4.3.4","resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",@@ -1046,6 +1281,18 @@}}},+ "node_modules/decompress-response": {+ "version": "4.2.1",+ "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz",+ "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==",+ "optional": true,+ "dependencies": {+ "mimic-response": "^2.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/deep-equal": {"version": "2.2.1","resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz",@@ -1137,6 +1384,21 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/delegates": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",+ "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",+ "optional": true+ },+ "node_modules/detect-libc": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.1.tgz",+ "integrity": "sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },"node_modules/didyoumean": {"version": "1.2.2","resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",@@ -1880,6 +2142,30 @@"url": "https://www.patreon.com/infusion"}},+ "node_modules/fs-minipass": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",+ "optional": true,+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/fs-minipass/node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "optional": true,+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/fs.realpath": {"version": "1.0.0","resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",@@ -1928,6 +2214,26 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/gauge": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz",+ "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",+ "optional": true,+ "dependencies": {+ "aproba": "^1.0.3 || ^2.0.0",+ "color-support": "^1.1.2",+ "console-control-strings": "^1.0.0",+ "has-unicode": "^2.0.1",+ "object-assign": "^4.1.1",+ "signal-exit": "^3.0.0",+ "string-width": "^4.2.3",+ "strip-ansi": "^6.0.1",+ "wide-align": "^1.1.2"+ },+ "engines": {+ "node": ">=10"+ }+ },"node_modules/get-intrinsic": {"version": "1.2.1","resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",@@ -2053,6 +2359,14 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/goober": {+ "version": "2.1.13",+ "resolved": "https://registry.npmjs.org/goober/-/goober-2.1.13.tgz",+ "integrity": "sha512-jFj3BQeleOoy7t93E9rZ2de+ScC4lQICLwiAQmKMg9F6roKGaLSHoCDYKkWlSafg138jejvq/mTdvmnwDQgqoQ==",+ "peerDependencies": {+ "csstype": "^3.0.10"+ }+ },"node_modules/gopd": {"version": "1.0.1","resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",@@ -2148,6 +2462,25 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/has-unicode": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",+ "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",+ "optional": true+ },+ "node_modules/https-proxy-agent": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",+ "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",+ "optional": true,+ "dependencies": {+ "agent-base": "6",+ "debug": "4"+ },+ "engines": {+ "node": ">= 6"+ }+ },"node_modules/human-signals": {"version": "4.3.1","resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz",@@ -2337,6 +2670,15 @@"node": ">=0.10.0"}},+ "node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },"node_modules/is-glob": {"version": "4.0.3","resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",@@ -2579,6 +2921,14 @@"jiti": "bin/jiti.js"}},+ "node_modules/jose": {+ "version": "4.14.4",+ "resolved": "https://registry.npmjs.org/jose/-/jose-4.14.4.tgz",+ "integrity": "sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==",+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },"node_modules/js-tokens": {"version": "4.0.0","resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",@@ -2707,6 +3057,57 @@"node": ">=10"}},+ "node_modules/make-cancellable-promise": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/make-cancellable-promise/-/make-cancellable-promise-1.2.1.tgz",+ "integrity": "sha512-nigEn7brgUhjUb2lEobWUW4ZiJdIZ/Wct0UsmDsqaZhgLMvY1OC6FGLa/5SU2RvnyuilkjM7g5JGxt6CJZQGNw==",+ "funding": {+ "url": "https://github.com/wojtekmaj/make-cancellable-promise?sponsor=1"+ }+ },+ "node_modules/make-dir": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",+ "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",+ "optional": true,+ "dependencies": {+ "semver": "^6.0.0"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/make-dir/node_modules/semver": {+ "version": "6.3.0",+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",+ "optional": true,+ "bin": {+ "semver": "bin/semver.js"+ }+ },+ "node_modules/make-event-props": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/make-event-props/-/make-event-props-1.5.0.tgz",+ "integrity": "sha512-ubtzzj95Ga0t/LoINWPjqQWIxbb1SJ6td7YygKzx8kX5ywu/dpN0YnCsjzJOTxFXKsb/1SJBzy+uBAMnKWMVDw==",+ "funding": {+ "url": "https://github.com/wojtekmaj/make-event-props?sponsor=1"+ }+ },+ "node_modules/merge-refs": {+ "version": "1.1.3",+ "resolved": "https://registry.npmjs.org/merge-refs/-/merge-refs-1.1.3.tgz",+ "integrity": "sha512-di/iXo7YUDHs38KoIROE2BQvL6xmqiKYpNQSM0NG2jdvikvhJOeihXXyOXXMKkoMxdCXF2SvyxTJ92NuRA5wfA==",+ "dependencies": {+ "@types/react": "*"+ },+ "funding": {+ "url": "https://github.com/wojtekmaj/merge-refs?sponsor=1"+ }+ },"node_modules/merge-stream": {"version": "2.0.0","resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",@@ -2743,6 +3144,27 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/mimic-response": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz",+ "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==",+ "optional": true,+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/mini-svg-data-uri": {+ "version": "1.4.4",+ "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz",+ "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==",+ "dev": true,+ "bin": {+ "mini-svg-data-uri": "cli.js"+ }+ },"node_modules/minimatch": {"version": "3.1.2","resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",@@ -2762,6 +3184,52 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/minipass": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",+ "optional": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minizlib": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",+ "optional": true,+ "dependencies": {+ "minipass": "^3.0.0",+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/minizlib/node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "optional": true,+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/mkdirp": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",+ "optional": true,+ "bin": {+ "mkdirp": "bin/cmd.js"+ },+ "engines": {+ "node": ">=10"+ }+ },"node_modules/ms": {"version": "2.1.2","resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",@@ -2777,6 +3245,12 @@"thenify-all": "^1.0.0"}},+ "node_modules/nan": {+ "version": "2.17.0",+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==",+ "optional": true+ },"node_modules/nanoid": {"version": "3.3.6","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz",@@ -2848,6 +3322,33 @@}}},+ "node_modules/next-auth": {+ "version": "4.22.1",+ "resolved": "https://registry.npmjs.org/next-auth/-/next-auth-4.22.1.tgz",+ "integrity": "sha512-NTR3f6W7/AWXKw8GSsgSyQcDW6jkslZLH8AiZa5PQ09w1kR8uHtR9rez/E9gAq/o17+p0JYHE8QjF3RoniiObA==",+ "dependencies": {+ "@babel/runtime": "^7.20.13",+ "@panva/hkdf": "^1.0.2",+ "cookie": "^0.5.0",+ "jose": "^4.11.4",+ "oauth": "^0.9.15",+ "openid-client": "^5.4.0",+ "preact": "^10.6.3",+ "preact-render-to-string": "^5.1.19",+ "uuid": "^8.3.2"+ },+ "peerDependencies": {+ "next": "^12.2.5 || ^13",+ "nodemailer": "^6.6.5",+ "react": "^17.0.2 || ^18",+ "react-dom": "^17.0.2 || ^18"+ },+ "peerDependenciesMeta": {+ "nodemailer": {+ "optional": true+ }+ }+ },"node_modules/next/node_modules/postcss": {"version": "8.4.14","resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.14.tgz",@@ -2871,11 +3372,56 @@"node": "^10 || ^12 || >=14"}},+ "node_modules/node-fetch": {+ "version": "2.6.11",+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz",+ "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==",+ "optional": true,+ "dependencies": {+ "whatwg-url": "^5.0.0"+ },+ "engines": {+ "node": "4.x || >=6.0.0"+ },+ "peerDependencies": {+ "encoding": "^0.1.0"+ },+ "peerDependenciesMeta": {+ "encoding": {+ "optional": true+ }+ }+ },"node_modules/node-releases": {"version": "2.0.12","resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz","integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ=="},+ "node_modules/nodemailer": {+ "version": "6.9.2",+ "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.2.tgz",+ "integrity": "sha512-4+TYaa/e1nIxQfyw/WzNPYTEZ5OvHIDEnmjs4LPmIfccPQN+2CYKmGHjWixn/chzD3bmUTu5FMfpltizMxqzdg==",+ "optional": true,+ "peer": true,+ "engines": {+ "node": ">=6.0.0"+ }+ },+ "node_modules/nopt": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",+ "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",+ "optional": true,+ "dependencies": {+ "abbrev": "1"+ },+ "bin": {+ "nopt": "bin/nopt.js"+ },+ "engines": {+ "node": ">=6"+ }+ },"node_modules/normalize-path": {"version": "3.0.0","resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",@@ -2917,6 +3463,23 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/npmlog": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",+ "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",+ "optional": true,+ "dependencies": {+ "are-we-there-yet": "^2.0.0",+ "console-control-strings": "^1.1.0",+ "gauge": "^3.0.0",+ "set-blocking": "^2.0.0"+ }+ },+ "node_modules/oauth": {+ "version": "0.9.15",+ "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz",+ "integrity": "sha512-a5ERWK1kh38ExDEfoO6qUHJb32rd7aYmPHuyCu3Fta/cnICvYmgd2uhuKXvPD+PXB+gCEYYEaQdIRAjCOwAKNA=="+ },"node_modules/object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",@@ -3038,6 +3601,14 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/oidc-token-hash": {+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz",+ "integrity": "sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==",+ "engines": {+ "node": "^10.13.0 || >=12.0.0"+ }+ },"node_modules/once": {"version": "1.4.0","resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",@@ -3077,6 +3648,28 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/openid-client": {+ "version": "5.4.2",+ "resolved": "https://registry.npmjs.org/openid-client/-/openid-client-5.4.2.tgz",+ "integrity": "sha512-lIhsdPvJ2RneBm3nGBBhQchpe3Uka//xf7WPHTIglery8gnckvW7Bd9IaQzekzXJvWthCMyi/xVEyGW0RFPytw==",+ "dependencies": {+ "jose": "^4.14.1",+ "lru-cache": "^6.0.0",+ "object-hash": "^2.2.0",+ "oidc-token-hash": "^5.0.3"+ },+ "funding": {+ "url": "https://github.com/sponsors/panva"+ }+ },+ "node_modules/openid-client/node_modules/object-hash": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz",+ "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==",+ "engines": {+ "node": ">= 6"+ }+ },"node_modules/optionator": {"version": "0.9.1","resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz",@@ -3169,6 +3762,29 @@"node": ">=8"}},+ "node_modules/path2d-polyfill": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz",+ "integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/pdfjs-dist": {+ "version": "3.6.172",+ "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.6.172.tgz",+ "integrity": "sha512-bfOhCg+S9DXh/ImWhWYTOiq3aVMFSCvzGiBzsIJtdMC71kVWDBw7UXr32xh0y56qc5wMVylIeqV3hBaRsu+e+w==",+ "dependencies": {+ "path2d-polyfill": "^2.0.1",+ "web-streams-polyfill": "^3.2.1"+ },+ "engines": {+ "node": ">=16"+ },+ "optionalDependencies": {+ "canvas": "^2.11.2"+ }+ },"node_modules/picocolors": {"version": "1.0.0","resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",@@ -3325,6 +3941,26 @@"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz","integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="},+ "node_modules/preact": {+ "version": "10.15.1",+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.15.1.tgz",+ "integrity": "sha512-qs2ansoQEwzNiV5eAcRT1p1EC/dmEzaATVDJNiB3g2sRDWdA7b7MurXdJjB2+/WQktGWZwxvDrnuRFbWuIr64g==",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/preact"+ }+ },+ "node_modules/preact-render-to-string": {+ "version": "5.2.6",+ "resolved": "https://registry.npmjs.org/preact-render-to-string/-/preact-render-to-string-5.2.6.tgz",+ "integrity": "sha512-JyhErpYOvBV1hEPwIxc/fHWXPfnEGdRKxc8gFdAZ7XV4tlzyzG847XAyEZqoDnynP88akM4eaHcSOzNcLWFguw==",+ "dependencies": {+ "pretty-format": "^3.8.0"+ },+ "peerDependencies": {+ "preact": ">=10"+ }+ },"node_modules/prelude-ls": {"version": "1.2.1","resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",@@ -3333,6 +3969,28 @@"node": ">= 0.8.0"}},+ "node_modules/pretty-format": {+ "version": "3.8.0",+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-3.8.0.tgz",+ "integrity": "sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew=="+ },+ "node_modules/prisma": {+ "version": "4.14.1",+ "resolved": "https://registry.npmjs.org/prisma/-/prisma-4.14.1.tgz",+ "integrity": "sha512-z6hxzTMYqT9SIKlzD08dhzsLUpxjFKKsLpp5/kBDnSqiOjtUyyl/dC5tzxLcOa3jkEHQ8+RpB/fE3w8bgNP51g==",+ "devOptional": true,+ "hasInstallScript": true,+ "dependencies": {+ "@prisma/engines": "4.14.1"+ },+ "bin": {+ "prisma": "build/index.js",+ "prisma2": "build/index.js"+ },+ "engines": {+ "node": ">=14.17"+ }+ },"node_modules/prop-types": {"version": "15.8.1","resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",@@ -3393,11 +4051,48 @@"react": "^18.2.0"}},+ "node_modules/react-hot-toast": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.4.1.tgz",+ "integrity": "sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ==",+ "dependencies": {+ "goober": "^2.1.10"+ },+ "engines": {+ "node": ">=10"+ },+ "peerDependencies": {+ "react": ">=16",+ "react-dom": ">=16"+ }+ },"node_modules/react-is": {"version": "16.13.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz","integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="},+ "node_modules/react-pdf": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-7.0.1.tgz",+ "integrity": "sha512-fOTp1Sfc2WwveYiDVg7F7RZFJcVBgvzilAY6Ouj7rAeY5Jb/lQqTmqQUchjwlAOHsmGNiA0YfKOK5Th0hif5NQ==",+ "dependencies": {+ "clsx": "^1.2.1",+ "make-cancellable-promise": "^1.0.0",+ "make-event-props": "^1.5.0",+ "merge-refs": "^1.1.3",+ "pdfjs-dist": "3.6.172",+ "prop-types": "^15.6.2",+ "tiny-invariant": "^1.0.0",+ "tiny-warning": "^1.0.0"+ },+ "funding": {+ "url": "https://github.com/wojtekmaj/react-pdf?sponsor=1"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"+ }+ },"node_modules/read-cache": {"version": "1.0.0","resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",@@ -3406,6 +4101,20 @@"pify": "^2.3.0"}},+ "node_modules/readable-stream": {+ "version": "3.6.2",+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",+ "optional": true,+ "dependencies": {+ "inherits": "^2.0.3",+ "string_decoder": "^1.1.1",+ "util-deprecate": "^1.0.1"+ },+ "engines": {+ "node": ">= 6"+ }+ },"node_modules/readdirp": {"version": "3.6.0","resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",@@ -3603,6 +4312,26 @@"queue-microtask": "^1.2.2"}},+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "optional": true+ },"node_modules/safe-regex-test": {"version": "1.0.0","resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz",@@ -3638,6 +4367,12 @@"node": ">=10"}},+ "node_modules/set-blocking": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",+ "optional": true+ },"node_modules/shebang-command": {"version": "2.0.0","resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",@@ -3675,6 +4410,37 @@"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz","integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="},+ "node_modules/simple-concat": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",+ "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "optional": true+ },+ "node_modules/simple-get": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz",+ "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==",+ "optional": true,+ "dependencies": {+ "decompress-response": "^4.2.0",+ "once": "^1.3.1",+ "simple-concat": "^1.0.0"+ }+ },"node_modules/slash": {"version": "3.0.0","resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",@@ -3710,6 +4476,35 @@"node": ">=10.0.0"}},+ "node_modules/string_decoder": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",+ "optional": true,+ "dependencies": {+ "safe-buffer": "~5.2.0"+ }+ },+ "node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "optional": true,+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/string-width/node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "optional": true+ },"node_modules/string.prototype.matchall": {"version": "4.0.8","resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.8.tgz",@@ -3955,6 +4750,23 @@"node": ">=6"}},+ "node_modules/tar": {+ "version": "6.1.15",+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz",+ "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==",+ "optional": true,+ "dependencies": {+ "chownr": "^2.0.0",+ "fs-minipass": "^2.0.0",+ "minipass": "^5.0.0",+ "minizlib": "^2.1.1",+ "mkdirp": "^1.0.3",+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=10"+ }+ },"node_modules/text-table": {"version": "0.2.0","resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",@@ -3979,6 +4791,16 @@"node": ">=0.8"}},+ "node_modules/tiny-invariant": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",+ "integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="+ },+ "node_modules/tiny-warning": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",+ "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="+ },"node_modules/titleize": {"version": "3.0.0","resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz",@@ -4001,6 +4823,12 @@"node": ">=8.0"}},+ "node_modules/tr46": {+ "version": "0.0.3",+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",+ "optional": true+ },"node_modules/ts-interface-checker": {"version": "0.1.13","resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",@@ -4102,6 +4930,17 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/undici": {+ "version": "5.22.0",+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.22.0.tgz",+ "integrity": "sha512-fR9RXCc+6Dxav4P9VV/sp5w3eFiSdOjJYsbtWfd4s5L5C4ogyuVpdKIVHeW0vV1MloM65/f7W45nR9ZxwVdyiA==",+ "dependencies": {+ "busboy": "^1.6.0"+ },+ "engines": {+ "node": ">=14.0"+ }+ },"node_modules/untildify": {"version": "4.0.0","resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",@@ -4152,6 +4991,38 @@"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz","integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="},+ "node_modules/uuid": {+ "version": "8.3.2",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",+ "bin": {+ "uuid": "dist/bin/uuid"+ }+ },+ "node_modules/web-streams-polyfill": {+ "version": "3.2.1",+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",+ "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/webidl-conversions": {+ "version": "3.0.1",+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",+ "optional": true+ },+ "node_modules/whatwg-url": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",+ "optional": true,+ "dependencies": {+ "tr46": "~0.0.3",+ "webidl-conversions": "^3.0.0"+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",@@ -4214,6 +5085,15 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/wide-align": {+ "version": "1.1.5",+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",+ "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",+ "optional": true,+ "dependencies": {+ "string-width": "^1.0.2 || 2 || 3 || 4"+ }+ },"node_modules/word-wrap": {"version": "1.2.3","resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",diff --git a/package.json b/package.jsonindex d2ec8eeb..2e0419fe 100644--- a/package.json+++ b/package.json@@ -18,6 +18,7 @@"@types/react-dom": "18.2.4","@vercel/blob": "^0.8.3","autoprefixer": "10.4.14",+ "date-fns": "^2.30.0","eslint": "8.41.0","eslint-config-next": "13.4.4","next": "13.4.4",@@ -26,6 +27,7 @@"react": "18.2.0","react-dom": "18.2.0","react-hot-toast": "^2.4.1",+ "react-pdf": "^7.0.1","tailwindcss": "3.3.2","typescript": "5.0.4"},diff --git a/pages/api/links.ts b/pages/api/links.tsnew file mode 100644index 00000000..26738a0e--- /dev/null+++ b/pages/api/links.ts@@ -0,0 +1,32 @@+import { NextApiRequest, NextApiResponse } from "next";+import prisma from "@/lib/prisma";++export default async function handler(+ req: NextApiRequest,+ res: NextApiResponse+) {+ if (req.method === "POST") {+ const { documentId } = req.body;++ // Fetch the link and its related document from the database+ const link = await prisma.link.create({+ data: {+ documentId: documentId,+ },+ });++ const linkWithView = {+ ...link,+ _count: { views: 0 },+ views: [],+ };++ if (!linkWithView) {+ return res.status(404).json({ error: "Link not found" });+ }++ return res.status(200).json(linkWithView);+ }++ return res.status(405).json({ error: "Method not allowed" });+}diff --git a/pages/documents.tsx b/pages/documents.tsxnew file mode 100644index 00000000..af2fa64e--- /dev/null+++ b/pages/documents.tsx@@ -0,0 +1,184 @@+import { GetServerSideProps } from "next";+import prisma from "@/lib/prisma";+import { ChevronRightIcon } from "@heroicons/react/20/solid";+import Sidebar from "@/components/Sidebar";+import { getServerSession } from "next-auth/next";+import { CustomUser } from "@/lib/types";+import { authOptions } from "@/pages/api/auth/[...nextauth]";+import { Document, Link as DocumentLink } from "@prisma/client";+import Link from "next/link";+import { getExtension } from "@/lib/utils";+import { DocumentDuplicateIcon } from "@heroicons/react/24/outline";+import toast from "react-hot-toast";+import Notification from "@/components/Notification";++export const getServerSideProps: GetServerSideProps = async (context) => {+ const session = await getServerSession(context.req, context.res, authOptions);+ const userId = (session?.user as CustomUser)?.id;++ if (!userId) {+ return {+ redirect: {+ destination: "/",+ permanent: false,+ },+ };+ }++ const page = context.query.page ? parseInt(context.query.page as string) : 1;+ const pageSize = 10; // Change this to adjust the number of documents per page++ const skip = (page - 1) * pageSize;++ const documents = await prisma.document.findMany({+ where: {+ ownerId: userId,+ },+ orderBy: {+ createdAt: "desc",+ },+ include: {+ _count: {+ select: { links: true },+ },+ links: true,+ },+ skip: skip,+ take: pageSize,+ });++ const totalDocuments = await prisma.document.count({+ where: {+ ownerId: userId,+ },+ });++ const totalPages = Math.ceil(totalDocuments / pageSize);++ console.log("documents: ", documents);++ const serializedDocuments = documents.map((document) => ({+ ...document,+ createdAt: document.createdAt.toISOString(),+ }));++ return {+ props: { documents: serializedDocuments, currentPage: page, totalPages },+ };+};++// Define a type for the props expected by your Documents component+interface DocumentsWithCount extends Document {+ _count: {+ links: number;+ };+ links: DocumentLink[];+}++interface DocumentsProps {+ documents: DocumentsWithCount[];+}++export default function Documents({+ documents,+ currentPage,+ totalPages,+}: DocumentsProps & { currentPage: number; totalPages: number }) {+ const handleCopyToClipboard = (id: string) => {+ navigator.clipboard.writeText(+ `${process.env.NEXT_PUBLIC_BASE_URL}/view/${id}`+ );++ toast.custom((t) => (+ <Notification t={t} closeToast={() => toast.dismiss(t.id)} />+ ));+ };++ return (+ <>+ <div>+ <Sidebar>+ <main className="">+ <header className="flex items-center justify-between border-b border-white/5 px-4 py-4 sm:px-6 sm:py-6 lg:px-8">+ <h1 className="text-base font-semibold leading-7 text-white">+ My Documents+ </h1>+ </header>++ {/* Document list */}+ <ul role="list" className="divide-y divide-white/5">+ {documents.map((document) => {+ return (+ <li+ key={document.id}+ className="relative flex justify-between items-center space-x-4 px-4 py-4 sm:px-6 lg:px-8"+ >+ <div className="min-w-0 flex">+ <div className="flex-col">+ <div className="flex items-center">+ <h2 className="min-w-0 text-sm font-semibold leading-6 text-white">+ <Link+ href={`/documents/${document.id}`}+ className="flex gap-x-2"+ >+ <span className="truncate">{document.name}</span>+ <span className="text-gray-400">/</span>+ <span className="whitespace-nowrap text-gray-500">+ {getExtension(document.file)}+ </span>+ {/* <span className="absolute inset-0" /> */}+ </Link>+ </h2>+ <div className="flex ml-2">+ <button+ className="text-gray-500 hover:text-gray-700"+ onClick={() =>+ handleCopyToClipboard(document.links[0].id)+ }+ title="Copy to clipboard"+ >+ <DocumentDuplicateIcon+ className="h-5 w-5"+ aria-hidden="true"+ />+ </button>+ </div>+ </div>+ <div className="mt-3 flex items-center gap-x-2.5 text-xs leading-5 text-gray-400">+ <p className="truncate">{`${document._count.links} ${+ document._count.links === 1 ? "Link" : "Links"+ }`}</p>+ </div>+ </div>+ </div>++ <ChevronRightIcon+ className="h-5 w-5 flex-none text-gray-400"+ aria-hidden="true"+ />+ </li>+ );+ })}+ </ul>+ <div className="flex justify-between mx-10">+ <Link+ href={currentPage > 1 ? `?page=${currentPage - 1}` : "#"}+ passHref+ >+ <button disabled={currentPage === 1}>Previous</button>+ </Link>+ <Link+ href={+ currentPage < totalPages ? `?page=${currentPage + 1}` : "#"+ }+ passHref+ >+ <button disabled={currentPage === totalPages}>Next</button>+ </Link>+ </div>+ </main>+ </Sidebar>+ </div>+ </>+ );+}diff --git a/pages/documents/[id].tsx b/pages/documents/[id].tsxnew file mode 100644index 00000000..8fe84f43--- /dev/null+++ b/pages/documents/[id].tsx@@ -0,0 +1,372 @@+import { GetServerSideProps } from "next";+import { useRouter } from "next/router";+import prisma from "@/lib/prisma";+import Sidebar from "@/components/Sidebar";+import { classNames, getExtension } from "@/lib/utils";+import { getServerSession } from "next-auth/next";+import { authOptions } from "../api/auth/[...nextauth]";+import { CustomUser } from "@/lib/types";+import { Link as DocumentLink, Document, View } from "@prisma/client";+import Link from "next/link";+import { DocumentDuplicateIcon } from "@heroicons/react/24/outline";+import { parseISO, format, formatDistance } from "date-fns";+import { useState } from "react";+import Skeleton from "@/components/Skeleton";++interface LinkWithView extends DocumentLink {+ views: { viewedAt: string }[];+ _count: {+ views: number;+ };+}++const DocumentPage = ({+ document,+ links,+ views,+ groupedViews,+}: {+ document: Document;+ links: LinkWithView[];+ views: View[];+ groupedViews: { viewerEmail: string; _count: { id: number } }[];+}) => {+ const router = useRouter();+ const [localLinks, setLocalLinks] = useState<LinkWithView[]>(links);+ const [isLoading, setIsLoading] = useState<boolean>(false);++ if (router.isFallback) {+ return <div>Loading...</div>;+ }++ const stats = [+ { name: "Number of views", value: views.length.toString(), active: true },+ {+ name: "Number of unique viewers",+ value: groupedViews.length.toString(),+ active: true,+ },+ {+ name: "Average view duration",+ value: "3.65",+ unit: "mins",+ active: false,+ },+ { name: "TBD", value: "98.5%", active: false },+ ];++ async function addNewLink() {+ setIsLoading(true);+ const response = await fetch("/api/links", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ documentId: document.id,+ }),+ });++ if (!response.ok) {+ throw new Error(`HTTP error! status: ${response.status}`);+ }++ const newLink = await response.json();+ setIsLoading(false);++ // Create a new array that includes the new link, then set it as the new state+ setLocalLinks([...localLinks, newLink]);+ }++ return (+ <>+ <div>+ <Sidebar>+ <main>+ <header>+ {/* Heading */}+ <div className="flex flex-col items-start justify-between gap-x-8 gap-y-4 bg-gray-700/10 px-4 py-4 sm:flex-row sm:items-center sm:px-6 lg:px-8">+ <div>+ <div className="flex items-center gap-x-3">+ <h1 className="flex gap-x-3 text-base leading-7">+ <span className="font-semibold text-white">+ {document.name}+ </span>+ <span className="text-gray-600">/</span>+ <span className="font-semibold text-gray-500">+ {getExtension(document.file)}+ </span>+ </h1>+ </div>+ <p className="mt-2 text-xs leading-6 text-gray-400">+ {document.description}+ </p>+ </div>+ <Link+ className="order-first rounded flex-none px-2 py-1 bg-gray-800 hover:bg-gray-700 text-gray-400 hover:text-gray-50 sm:order-none"+ href={document.file}+ >+ View Document+ </Link>+ </div>++ {/* Stats */}+ <div className="grid grid-cols-1 bg-gray-700/10 sm:grid-cols-2 lg:grid-cols-4">+ {stats.map((stat, statIdx) => (+ <div+ key={stat.name}+ className={classNames(+ statIdx % 2 === 1+ ? "sm:border-l"+ : statIdx === 2+ ? "lg:border-l"+ : "",+ "border-t border-white/5 py-6 px-4 sm:px-6 lg:px-8"+ )}+ >+ <p+ className={classNames(+ !stat.active ? "text-gray-700" : "text-gray-400",+ "text-sm font-medium leading-6"+ )}+ >+ {stat.name}+ </p>+ <p className="mt-2 flex items-baseline gap-x-2">+ <span+ className={classNames(+ !stat.active ? "text-gray-700" : "text-white",+ "text-4xl font-semibold tracking-tight "+ )}+ >+ {stat.value}+ </span>+ {stat.unit ? (+ <span+ className={classNames(+ !stat.active ? "text-gray-700" : "text-gray-400",+ "text-sm"+ )}+ >+ {stat.unit}+ </span>+ ) : null}+ </p>+ </div>+ ))}+ </div>+ </header>++ {/* Links list */}+ <div className="border-t border-white/10 pt-11">+ <h2 className="px-4 text-base font-semibold leading-7 text-white sm:px-6 lg:px-8">+ All links+ </h2>+ <table className="mt-6 w-full whitespace-nowrap text-left">+ <colgroup>+ <col className="w-full sm:w-4/12" />+ <col className="lg:w-4/12" />+ <col className="lg:w-2/12" />+ <col className="lg:w-2/12" />+ </colgroup>+ <thead className="border-b border-white/10 text-sm leading-6 text-white">+ <tr>+ <th+ scope="col"+ className="py-2 pl-4 pr-8 font-semibold sm:pl-6 lg:pl-8"+ >+ Link URL+ </th>+ <th+ scope="col"+ className="hidden py-2 pl-0 pr-8 font-semibold sm:table-cell"+ >+ Views+ </th>+ <th+ scope="col"+ className="py-2 pl-0 pr-4 text-right font-semibold sm:pr-8 sm:text-left lg:pr-20"+ >+ Status+ </th>+ <th+ scope="col"+ className="hidden py-2 pl-0 pr-4 text-right font-semibold sm:table-cell sm:pr-6 lg:pr-8"+ >+ Last Viewed+ </th>+ </tr>+ </thead>+ <tbody className="divide-y divide-white/5">+ {localLinks.map((link) => (+ <tr key={link.id}>+ <td className="py-4 pl-4 pr-8 sm:pl-6 lg:pl-8">+ <div className="flex items-center gap-x-4">+ <div className="truncate text-sm font-medium leading-6 text-white">+ {link.id}+ </div>+ <button+ className="text-gray-500 hover:text-gray-700"+ onClick={() =>+ navigator.clipboard.writeText(+ `${process.env.NEXT_PUBLIC_BASE_URL}/view/${link.id}`+ )+ }+ title="Copy to clipboard"+ >+ <DocumentDuplicateIcon+ className="h-5 w-5"+ aria-hidden="true"+ />+ </button>+ </div>+ </td>+ <td className="hidden py-4 pl-0 pr-4 sm:table-cell sm:pr-8">+ <div className="flex gap-x-3">+ <div className="font-mono text-sm leading-6 text-gray-400">+ {`${link._count.views} ${+ link._count.views === 1 ? "View" : "Views"+ }`}+ </div>+ </div>+ </td>+ <td className="py-4 pl-0 pr-4 text-sm leading-6 sm:pr-8 lg:pr-20">+ <div className="flex items-center justify-end gap-x-2 sm:justify-start">+ <div className="text-green-400 bg-green-400/10 flex-none rounded-full p-1">+ <div className="h-1.5 w-1.5 rounded-full bg-current" />+ </div>+ <div className="hidden text-white sm:block">+ Active+ </div>+ </div>+ </td>+ <td className="hidden py-4 pl-0 pr-4 text-right text-sm leading-6 text-gray-400 sm:table-cell sm:pr-6 lg:pr-8">+ {link.views[0] && (+ <time dateTime={link.views[0].viewedAt}>+ {formatDistance(+ parseISO(link.views[0].viewedAt),+ new Date(),+ { addSuffix: true }+ )}+ </time>+ )}+ </td>+ </tr>+ ))}+ {isLoading && (+ <tr>+ <td className="py-4 pl-4 pr-8 sm:pl-6 lg:pl-8">+ <Skeleton className="h-5 w-full" />+ </td>+ </tr>+ )}+ <tr>+ <td className="py-4 pl-4 pr-8 sm:pl-6 lg:pl-8">+ <button+ onClick={() => addNewLink()}+ className="text-gray-400 hover:text-gray-50"+ >+ Add another link+ </button>+ </td>+ </tr>+ </tbody>+ </table>+ </div>+ </main>+ </Sidebar>+ </div>+ </>+ );+};++export const getServerSideProps: GetServerSideProps = async (context) => {+ const { id } = context.params;++ const session = await getServerSession(context.req, context.res, authOptions);+ const userId = (session?.user as CustomUser)?.id;++ if (!userId) {+ return {+ redirect: {+ destination: "/",+ permanent: false,+ },+ };+ }++ const document = await prisma.document.findUnique({+ where: { id: id },+ });++ if (!document) {+ return {+ notFound: true,+ };+ }++ if (document.ownerId !== userId) {+ return {+ redirect: {+ destination: "/dashboard",+ permanent: false,+ },+ };+ }++ const links = await prisma.link.findMany({+ where: { documentId: id },+ include: {+ _count: {+ select: { views: true },+ },+ views: {+ take: 1,+ orderBy: { viewedAt: "desc" },+ select: { viewedAt: true },+ },+ },+ });++ const views = await prisma.view.findMany({+ where: { documentId: id },+ orderBy: { viewedAt: "desc" },+ });++ const groupedViews = await prisma.view.groupBy({+ by: ["viewerEmail"],+ where: { documentId: id },+ _count: { id: true },+ });++ console.log("links", links);++ const serializedDocument = {+ ...document,+ createdAt: document.createdAt.toISOString(),+ };++ const serializedLinks = links.map((link) => ({+ ...link,+ views: link.views.map((view) => ({+ ...view,+ viewedAt: view.viewedAt.toISOString(),+ })),+ }));++ const serializedViews = views.map((view) => ({+ ...view,+ viewedAt: view.viewedAt.toISOString(),+ }));++ return {+ props: {+ document: serializedDocument,+ links: serializedLinks,+ views: serializedViews,+ groupedViews: groupedViews,+ },+ };+};++export default DocumentPage;diff --git a/prisma/schema.prisma b/prisma/schema.prismaindex 146ffebe..9e1ba799 100644--- a/prisma/schema.prisma+++ b/prisma/schema.prisma@@ -65,6 +65,7 @@ model Document {ownerId String // This field holds the foreign key.createdAt DateTime @default(now())links Link[]+ views View[]}model Link {@@ -75,4 +76,15 @@ model Link {expiresAt DateTime? // Optional expiration datepassword String? // Optional password for link protectionallowedEmails String[] // Array of emails allowed to view the document+ views View[]}++model View {+ id String @id @default(cuid())+ link Link @relation(fields: [linkId], references: [id])+ linkId String+ document Document @relation(fields: [documentId], references: [id])+ documentId String+ viewerEmail String? // Email of the viewer if known+ viewedAt DateTime @default(now())+}\ No newline at end of file