From b1cfe2c63850e5391fb47ced03267ac3f849ca76 Mon Sep 17 00:00:00 2001 From: ahmedriad1 Date: Sun, 15 Sep 2024 20:12:18 +0300 Subject: [PATCH] ignore pdf-express from typechecking and linting & remove useless deps & adjust pdf viewer margin --- .eslintignore | 1 + package.json | 2 - pnpm-lock.yaml | 221 ------------------ .../t/[bookId]/_components/pdf-view.tsx | 69 +----- tsconfig.json | 2 +- 5 files changed, 7 insertions(+), 288 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..39316012 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +public/pdf-express \ No newline at end of file diff --git a/package.json b/package.json index 841fc6c2..17e1ed23 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "@neondatabase/serverless": "^0.9.0", "@next/third-parties": "^14.2.3", "@openiti/markdown-parser": "^1.1.1", - "@pdftron/pdfjs-express": "^8.7.5", "@pdftron/pdfjs-express-viewer": "^8.7.5", "@pdftron/webviewer": "^10.12.0", "@prisma/adapter-neon": "^5.12.1", @@ -63,7 +62,6 @@ "next-themes": "^0.2.1", "next-typesafe-url": "^4.0.7", "nprogress": "^0.2.0", - "pdfjs-dist": "^4.6.82", "prisma-json-types-generator": "^3.0.4", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0fdeda36..da5d8c78 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,6 @@ importers: '@openiti/markdown-parser': specifier: ^1.1.1 version: 1.1.1 - '@pdftron/pdfjs-express': - specifier: ^8.7.5 - version: 8.7.5 '@pdftron/pdfjs-express-viewer': specifier: ^8.7.5 version: 8.7.5 @@ -152,9 +149,6 @@ importers: nprogress: specifier: ^0.2.0 version: 0.2.0 - pdfjs-dist: - specifier: ^4.6.82 - version: 4.6.82 prisma-json-types-generator: specifier: ^3.0.4 version: 3.0.4(prisma@5.12.1)(typescript@5.3.3) @@ -1271,10 +1265,6 @@ packages: '@juggle/resize-observer@3.4.0': resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==} - '@mapbox/node-pre-gyp@1.0.11': - resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==} - hasBin: true - '@mdx-js/react@2.3.0': resolution: {integrity: sha512-zQH//gdOmuu7nt2oJR29vFhDv88oGPmVw6BggmrHeMI+xgEkp1B2dX9/bMBSYtK0dyLX/aOmesKS09g222K1/g==} peerDependencies: @@ -1374,9 +1364,6 @@ packages: '@pdftron/pdfjs-express-viewer@8.7.5': resolution: {integrity: sha512-dtF8jZ+07AeyCsTyWGxtaiawW7JUJIITAJRf/kA9yKZxNFWcKb7d9T/6SetzTNfC1o2tXfJw5UXlD7hIuz1htQ==} - '@pdftron/pdfjs-express@8.7.5': - resolution: {integrity: sha512-e0jlnsaK0WXx4Wg/IRuBlfBfhrRCR9o48SzjKxhOxT+PrLIy2hFVnXU0MlozSNb+VEcz3jV2K63yDuaHd41QVQ==} - '@pdftron/webviewer@10.12.0': resolution: {integrity: sha512-7MRnPS7ulg61AhCMQMCcauXfqiXEF4HZS4CvmQFn3DwbdjTn3jrT7KTAapz3WsWQPeZU21c7gTOr0Bvc5xFRYQ==} @@ -3137,9 +3124,6 @@ packages: resolution: {integrity: sha512-6xm38yGVIa6mKm/DUCF2zFFJhERh/QWp1ufm4cNUvxsONBmfPg8uZ9pZBdOmF6qFGr/HlT6ABBkCSx/dlEtvWg==} engines: {node: '>=12 <14 || 14.2 - 14.9 || >14.10.0'} - abbrev@1.1.1: - resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} - abbrev@2.0.0: resolution: {integrity: sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -3188,10 +3172,6 @@ packages: resolution: {integrity: sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==} engines: {node: '>= 6.0.0'} - agent-base@6.0.2: - resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} - engines: {node: '>= 6.0.0'} - aggregate-error@3.1.0: resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} engines: {node: '>=8'} @@ -3259,14 +3239,6 @@ packages: app-root-dir@1.0.2: resolution: {integrity: sha512-jlpIfsOoNoafl92Sz//64uQHGSyMrD2vYG5d8o2a4qGvyNCvXur7bzIsWtAC/6flI2RYAp3kv8rsfBtaLm7w0g==} - aproba@2.0.0: - resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} - - are-we-there-yet@2.0.0: - resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} - engines: {node: '>=10'} - deprecated: This package is no longer supported. - arg@5.0.2: resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} @@ -3585,10 +3557,6 @@ packages: caniuse-lite@1.0.30001615: resolution: {integrity: sha512-1IpazM5G3r38meiae0bHRnPhz+CBQ3ZLqbQMtrg+AsTPKAXgW38JNsXkyZ+v8waCsDmPq87lmfun5Q2AGysNEQ==} - canvas@2.11.2: - resolution: {integrity: sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==} - engines: {node: '>=6'} - case-sensitive-paths-webpack-plugin@2.4.0: resolution: {integrity: sha512-roIFONhcxog0JSSWbvVAh3OocukmSgpqOH6YpMkCvav/ySIV3JKg4Dc8vYtQjYi/UxpNE36r/9v+VqTQqgkYmw==} engines: {node: '>=4'} @@ -3722,10 +3690,6 @@ packages: color-string@1.9.1: resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==} - color-support@1.1.3: - resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} - hasBin: true - color@4.2.3: resolution: {integrity: sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==} engines: {node: '>=12.5.0'} @@ -3790,9 +3754,6 @@ packages: console-browserify@1.2.0: resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==} - console-control-strings@1.1.0: - resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} - constants-browserify@1.0.0: resolution: {integrity: sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==} @@ -3931,10 +3892,6 @@ packages: decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} - decompress-response@4.2.1: - resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==} - engines: {node: '>=8'} - decompress-response@6.0.0: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} engines: {node: '>=10'} @@ -3991,9 +3948,6 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - delegates@1.0.0: - resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} - denque@2.1.0: resolution: {integrity: sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==} engines: {node: '>=0.10'} @@ -4595,11 +4549,6 @@ packages: resolution: {integrity: sha512-14F4hBIxqKvD4Zz/XjDc3y94mNZN6pRv3U13Udo0lNLCWRBUsrMv2xwcF/y/Z5sV6+FQW+/ow68cHpm4sunt8Q==} engines: {node: '>=10'} - gauge@3.0.2: - resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} - engines: {node: '>=10'} - deprecated: This package is no longer supported. - generate-function@2.3.1: resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==} @@ -4738,9 +4687,6 @@ packages: resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} engines: {node: '>= 0.4'} - has-unicode@2.0.1: - resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} - hash-base@3.1.0: resolution: {integrity: sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==} engines: {node: '>=4'} @@ -4824,10 +4770,6 @@ packages: resolution: {integrity: sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==} engines: {node: '>= 6.0.0'} - https-proxy-agent@5.0.1: - resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} - engines: {node: '>= 6'} - human-signals@2.1.0: resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} engines: {node: '>=10.17.0'} @@ -5546,10 +5488,6 @@ packages: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} - mimic-response@2.1.0: - resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==} - engines: {node: '>=8'} - mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} @@ -5634,9 +5572,6 @@ packages: resolution: {integrity: sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==} engines: {node: '>=12.0.0'} - nan@2.20.0: - resolution: {integrity: sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==} - nanoid@3.3.7: resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -5742,11 +5677,6 @@ packages: node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} - nopt@5.0.0: - resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} - engines: {node: '>=6'} - hasBin: true - nopt@7.2.0: resolution: {integrity: sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -5775,10 +5705,6 @@ packages: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - npmlog@5.0.1: - resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} - deprecated: This package is no longer supported. - nprogress@0.2.0: resolution: {integrity: sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==} @@ -5981,10 +5907,6 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} - path2d@0.2.1: - resolution: {integrity: sha512-Fl2z/BHvkTNvkuBzYTpTuirHZg6wW9z8+4SND/3mDTEcYbbNKWAy21dz9D3ePNNwrrK8pqZO5vLPZ1hLF6T7XA==} - engines: {node: '>=6'} - pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} @@ -5995,10 +5917,6 @@ packages: resolution: {integrity: sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==} engines: {node: '>=0.12'} - pdfjs-dist@4.6.82: - resolution: {integrity: sha512-BUOryeRFwvbLe0lOU6NhkJNuVQUp06WxlJVVCsxdmJ4y5cU3O3s3/0DunVdK1PMm7v2MUw52qKYaidhDH1Z9+w==} - engines: {node: '>=18'} - peberminta@0.9.0: resolution: {integrity: sha512-XIxfHpEuSJbITd1H3EeQwpcZbTLHc+VVr8ANI9t5sit565tsI4/xK3KWTUFE2e6QiangUkh3B0jihzmGnNrRsQ==} @@ -6731,9 +6649,6 @@ packages: resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} engines: {node: '>= 0.8.0'} - set-blocking@2.0.0: - resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} - set-function-length@1.2.1: resolution: {integrity: sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g==} engines: {node: '>= 0.4'} @@ -6782,9 +6697,6 @@ packages: simple-concat@1.0.1: resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} - simple-get@3.1.1: - resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==} - simple-get@4.0.1: resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} @@ -7521,9 +7433,6 @@ packages: engines: {node: '>= 8'} hasBin: true - wide-align@1.1.5: - resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} - wordwrap@1.0.0: resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} @@ -8711,22 +8620,6 @@ snapshots: '@juggle/resize-observer@3.4.0': {} - '@mapbox/node-pre-gyp@1.0.11': - dependencies: - detect-libc: 2.0.2 - https-proxy-agent: 5.0.1 - make-dir: 3.1.0 - node-fetch: 2.7.0 - nopt: 5.0.0 - npmlog: 5.0.1 - rimraf: 3.0.2 - semver: 7.6.0 - tar: 6.2.0 - transitivePeerDependencies: - - encoding - - supports-color - optional: true - '@mdx-js/react@2.3.0(react@18.2.0)': dependencies: '@types/mdx': 2.0.11 @@ -8800,8 +8693,6 @@ snapshots: '@pdftron/pdfjs-express-viewer@8.7.5': {} - '@pdftron/pdfjs-express@8.7.5': {} - '@pdftron/webviewer@10.12.0': {} '@pkgjs/parseargs@0.11.0': @@ -11284,9 +11175,6 @@ snapshots: '@types/emscripten': 1.39.10 tslib: 1.14.1 - abbrev@1.1.1: - optional: true - abbrev@2.0.0: {} abort-controller@3.0.0: @@ -11325,13 +11213,6 @@ snapshots: agent-base@5.1.1: {} - agent-base@6.0.2: - dependencies: - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - optional: true - aggregate-error@3.1.0: dependencies: clean-stack: 2.2.0 @@ -11391,15 +11272,6 @@ snapshots: app-root-dir@1.0.2: {} - aproba@2.0.0: - optional: true - - are-we-there-yet@2.0.0: - dependencies: - delegates: 1.0.0 - readable-stream: 3.6.2 - optional: true - arg@5.0.2: {} argparse@1.0.10: @@ -11803,16 +11675,6 @@ snapshots: caniuse-lite@1.0.30001615: {} - canvas@2.11.2: - dependencies: - '@mapbox/node-pre-gyp': 1.0.11 - nan: 2.20.0 - simple-get: 3.1.1 - transitivePeerDependencies: - - encoding - - supports-color - optional: true - case-sensitive-paths-webpack-plugin@2.4.0: {} ccount@2.0.1: {} @@ -11949,9 +11811,6 @@ snapshots: color-name: 1.1.4 simple-swizzle: 0.2.2 - color-support@1.1.3: - optional: true - color@4.2.3: dependencies: color-convert: 2.0.1 @@ -12013,9 +11872,6 @@ snapshots: console-browserify@1.2.0: {} - console-control-strings@1.1.0: - optional: true - constants-browserify@1.0.0: {} content-disposition@0.5.4: @@ -12159,11 +12015,6 @@ snapshots: dependencies: character-entities: 2.0.2 - decompress-response@4.2.1: - dependencies: - mimic-response: 2.1.0 - optional: true - decompress-response@6.0.0: dependencies: mimic-response: 3.1.0 @@ -12239,9 +12090,6 @@ snapshots: delayed-stream@1.0.0: {} - delegates@1.0.0: - optional: true - denque@2.1.0: {} depd@2.0.0: {} @@ -13080,19 +12928,6 @@ snapshots: fuse.js@7.0.0: {} - gauge@3.0.2: - dependencies: - aproba: 2.0.0 - color-support: 1.1.3 - console-control-strings: 1.1.0 - has-unicode: 2.0.1 - object-assign: 4.1.1 - signal-exit: 3.0.7 - string-width: 4.2.3 - strip-ansi: 6.0.1 - wide-align: 1.1.5 - optional: true - generate-function@2.3.1: dependencies: is-property: 1.0.2 @@ -13238,9 +13073,6 @@ snapshots: dependencies: has-symbols: 1.0.3 - has-unicode@2.0.1: - optional: true - hash-base@3.1.0: dependencies: inherits: 2.0.4 @@ -13364,14 +13196,6 @@ snapshots: transitivePeerDependencies: - supports-color - https-proxy-agent@5.0.1: - dependencies: - agent-base: 6.0.2 - debug: 4.3.4 - transitivePeerDependencies: - - supports-color - optional: true - human-signals@2.1.0: {} human-signals@5.0.0: {} @@ -14190,9 +14014,6 @@ snapshots: mimic-fn@4.0.0: {} - mimic-response@2.1.0: - optional: true - mimic-response@3.1.0: {} min-indent@1.0.1: {} @@ -14273,9 +14094,6 @@ snapshots: dependencies: lru-cache: 7.18.3 - nan@2.20.0: - optional: true - nanoid@3.3.7: {} napi-build-utils@1.0.2: {} @@ -14396,11 +14214,6 @@ snapshots: node-releases@2.0.14: {} - nopt@5.0.0: - dependencies: - abbrev: 1.1.1 - optional: true - nopt@7.2.0: dependencies: abbrev: 2.0.0 @@ -14431,14 +14244,6 @@ snapshots: dependencies: path-key: 4.0.0 - npmlog@5.0.1: - dependencies: - are-we-there-yet: 2.0.0 - console-control-strings: 1.1.0 - gauge: 3.0.2 - set-blocking: 2.0.0 - optional: true - nprogress@0.2.0: {} nth-check@2.1.1: @@ -14664,9 +14469,6 @@ snapshots: path-type@4.0.0: {} - path2d@0.2.1: - optional: true - pathe@1.1.2: {} pathval@1.1.1: {} @@ -14679,14 +14481,6 @@ snapshots: safe-buffer: 5.2.1 sha.js: 2.4.11 - pdfjs-dist@4.6.82: - optionalDependencies: - canvas: 2.11.2 - path2d: 0.2.1 - transitivePeerDependencies: - - encoding - - supports-color - peberminta@0.9.0: {} peek-stream@1.1.3: @@ -15462,9 +15256,6 @@ snapshots: transitivePeerDependencies: - supports-color - set-blocking@2.0.0: - optional: true - set-function-length@1.2.1: dependencies: define-data-property: 1.1.4 @@ -15524,13 +15315,6 @@ snapshots: simple-concat@1.0.1: {} - simple-get@3.1.1: - dependencies: - decompress-response: 4.2.1 - once: 1.4.0 - simple-concat: 1.0.1 - optional: true - simple-get@4.0.1: dependencies: decompress-response: 6.0.0 @@ -16361,11 +16145,6 @@ snapshots: dependencies: isexe: 2.0.0 - wide-align@1.1.5: - dependencies: - string-width: 4.2.3 - optional: true - wordwrap@1.0.0: {} wrap-ansi@7.0.0: diff --git a/src/app/[locale]/t/[bookId]/_components/pdf-view.tsx b/src/app/[locale]/t/[bookId]/_components/pdf-view.tsx index a12a9b76..22451637 100644 --- a/src/app/[locale]/t/[bookId]/_components/pdf-view.tsx +++ b/src/app/[locale]/t/[bookId]/_components/pdf-view.tsx @@ -4,75 +4,23 @@ import type { TurathBookResponse } from "@/server/services/books"; import { type WebViewerInstance } from "@pdftron/webviewer"; // @ts-ignore import WebViewer from "@pdftron/pdfjs-express-viewer"; -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef } from "react"; -// import * as pdfjsLib from "pdfjs-dist"; -// import "pdfjs-dist/web/pdf_viewer.css"; - -// // Import the worker from pdfjs-dist -// import { GlobalWorkerOptions } from "pdfjs-dist"; - -// // Set the workerSrc property -// if (typeof window !== "undefined") { -// GlobalWorkerOptions.workerSrc = `/pdfjs/pdf.worker.js`; -// } -let isInitialized = false; +const isInitializedByUrl = new Map(); export default function PdfView({ pdf: pdfSource, }: { pdf: TurathBookResponse["turathResponse"]["pdf"]; }) { - // const canvasRef = useRef(null); - // const [pdf, setPdf] = useState(null); - // const [pageNum, setPageNum] = useState(1); - // const [numPages, setNumPages] = useState(null); - // const [isRendering, setIsRendering] = useState(false); - - // useEffect(() => { - // const loadingTask = pdfjsLib.getDocument(pdfSource.finalUrl!); - // loadingTask.promise - // .then((loadedPdf) => { - // setPdf(loadedPdf); - // setNumPages(loadedPdf.numPages); - // }) - // .catch((error) => { - // console.error("Error loading PDF:", error); - // }); - // }, [pdfSource.finalUrl]); - - // useEffect(() => { - // const renderPage = async (num: number) => { - // if (pdf) { - // setIsRendering(true); - // const page = await pdf.getPage(num); - // const viewport = page.getViewport({ scale: 1.5 }); - // const canvas = canvasRef.current!; - // const context = canvas.getContext("2d"); - // canvas.height = viewport.height; - // canvas.width = viewport.width; - - // const renderContext = { - // canvasContext: context!, - // viewport: viewport, - // }; - - // await page.render(renderContext).promise; - // setIsRendering(false); - // } - // }; - - // renderPage(pageNum); - // }, [pdf, pageNum]); - const viewerRef = useRef(null); useEffect(() => { let instance: WebViewerInstance | null = null; const initialize = async () => { - if (isInitialized) return; + if (isInitializedByUrl.get(pdfSource.finalUrl!)) return; - isInitialized = true; + isInitializedByUrl.set(pdfSource.finalUrl!, true); instance = await WebViewer( { path: "/pdf-express", // point to where the files you copied are served from @@ -90,18 +38,11 @@ export default function PdfView({ }, [pdfSource.finalUrl]); return ( -
+
- - {/* */} - - {/*