From 0a362da68a20d81cbe7eca34ddc535168046c3a9 Mon Sep 17 00:00:00 2001 From: mehmet Date: Fri, 25 Oct 2024 14:59:01 +0200 Subject: [PATCH] fix: use google pdf preview to preview pdf --- .idea/deployment.xml | 6 ++ .idea/git_toolbox_blame.xml | 6 ++ .idea/prettier.xml | 7 ++ .idea/shelf/Changes.xml | 4 + .idea/shelf/Changes/shelved.patch | 25 +++++++ .idea/shelf/Changes1.xml | 4 + .idea/shelf/Changes1/shelved.patch | 18 +++++ .idea/vcs.xml | 6 ++ .idea/workspace.xml | 101 ++++++++++++++++++++++++++ backend/combined.log | 1 + backend/error.log | 1 + client/src/components/BookPreview.tsx | 94 ++++++++++++------------ 12 files changed, 226 insertions(+), 47 deletions(-) create mode 100644 .idea/deployment.xml create mode 100644 .idea/git_toolbox_blame.xml create mode 100644 .idea/prettier.xml create mode 100644 .idea/shelf/Changes.xml create mode 100644 .idea/shelf/Changes/shelved.patch create mode 100644 .idea/shelf/Changes1.xml create mode 100644 .idea/shelf/Changes1/shelved.patch create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 00000000..0ebb202d --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/git_toolbox_blame.xml b/.idea/git_toolbox_blame.xml new file mode 100644 index 00000000..7dc12496 --- /dev/null +++ b/.idea/git_toolbox_blame.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/prettier.xml b/.idea/prettier.xml new file mode 100644 index 00000000..0c83ac4e --- /dev/null +++ b/.idea/prettier.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/shelf/Changes.xml b/.idea/shelf/Changes.xml new file mode 100644 index 00000000..2c5f22e4 --- /dev/null +++ b/.idea/shelf/Changes.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/.idea/shelf/Changes/shelved.patch b/.idea/shelf/Changes/shelved.patch new file mode 100644 index 00000000..7ad83e06 --- /dev/null +++ b/.idea/shelf/Changes/shelved.patch @@ -0,0 +1,25 @@ +Index: infra/a.tsx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/infra/a.tsx b/infra/a.tsx +new file mode 100644 +--- /dev/null (date 1729858271512) ++++ b/infra/a.tsx (date 1729858271512) +@@ -0,0 +1,14 @@ ++import {Component} from "react"; ++ ++class MyComponent extends Component { ++ render() { ++ return ( ++
++

Hello, World!

++

This is a simple React component.

++
++ ); ++ } ++} ++ ++export default MyComponent; +\ No newline at end of file diff --git a/.idea/shelf/Changes1.xml b/.idea/shelf/Changes1.xml new file mode 100644 index 00000000..3f3224ba --- /dev/null +++ b/.idea/shelf/Changes1.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/.idea/shelf/Changes1/shelved.patch b/.idea/shelf/Changes1/shelved.patch new file mode 100644 index 00000000..4a763833 --- /dev/null +++ b/.idea/shelf/Changes1/shelved.patch @@ -0,0 +1,18 @@ +Index: client/src/components/BookPreview.tsx +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP +<+>import { ArrowLeftIcon } from 'lucide-react';\nimport { useState } from 'react';\nimport { ReactReader } from 'react-reader';\nimport { useNavigate } from 'react-router-dom';\n\ninterface BookPreviewProps {\n bookUrl: string;\n fileType: string;\n bookName: string;\n}\n\nexport const BookPreview = ({\n bookUrl,\n fileType,\n bookName,\n}: BookPreviewProps) => {\n const [location, setLocation] = useState(0);\n const navigate = useNavigate();\n\n if (fileType === 'pdf') {\n return (\n <>\n navigate(-1)}\n />\n \n \n );\n } else if (fileType === 'epub') {\n return (\n
\n navigate(-1)}\n />\n setLocation(epubcfi)}\n title={bookName}\n showToc={true}\n />\n
\n );\n }\n};\n +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/client/src/components/BookPreview.tsx b/client/src/components/BookPreview.tsx +--- a/client/src/components/BookPreview.tsx (revision e2076ac95ddf567114fb91077868afb11271d378) ++++ b/client/src/components/BookPreview.tsx (date 1729859104889) +@@ -18,6 +18,7 @@ + const navigate = useNavigate(); + + if (fileType === 'pdf') { ++ // just a commnet + return ( + <> + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..bbda1ce9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + {} + { + "isMigrated": true +} + + + { + "associatedIndex": 0 +} + + + + + + + + + + + + + + + + + + 1729857645069 + + + + + + + + + + + + \ No newline at end of file diff --git a/backend/combined.log b/backend/combined.log index ff7aade5..ca7bf6a3 100644 --- a/backend/combined.log +++ b/backend/combined.log @@ -34,3 +34,4 @@ {"level":"error","message":"No token, authorization denied","timestamp":"2024-07-05 18:35:35"} {"level":"error","message":"Login attempt failed for username: test@test.com","timestamp":"2024-07-05 18:35:35"} {"level":"info","message":"User test logged in successfully","timestamp":"2024-07-05 18:35:35"} +{"level":"error","message":"No token, authorization denied","timestamp":"2024-10-25 14:37:22"} diff --git a/backend/error.log b/backend/error.log index 2401f4f3..96376d1a 100644 --- a/backend/error.log +++ b/backend/error.log @@ -31,3 +31,4 @@ {"level":"error","message":"Login attempt failed for username: test","timestamp":"2024-07-05 18:35:34"} {"level":"error","message":"No token, authorization denied","timestamp":"2024-07-05 18:35:35"} {"level":"error","message":"Login attempt failed for username: test@test.com","timestamp":"2024-07-05 18:35:35"} +{"level":"error","message":"No token, authorization denied","timestamp":"2024-10-25 14:37:22"} diff --git a/client/src/components/BookPreview.tsx b/client/src/components/BookPreview.tsx index 65144bf2..b168bfae 100644 --- a/client/src/components/BookPreview.tsx +++ b/client/src/components/BookPreview.tsx @@ -1,53 +1,53 @@ -import { ArrowLeftIcon } from 'lucide-react'; -import { useState } from 'react'; -import { ReactReader } from 'react-reader'; -import { useNavigate } from 'react-router-dom'; +import {ArrowLeftIcon} from 'lucide-react'; +import {useState} from 'react'; +import {ReactReader} from 'react-reader'; +import {useNavigate} from 'react-router-dom'; interface BookPreviewProps { - bookUrl: string; - fileType: string; - bookName: string; + bookUrl: string; + fileType: string; + bookName: string; } export const BookPreview = ({ - bookUrl, - fileType, - bookName, -}: BookPreviewProps) => { - const [location, setLocation] = useState(0); - const navigate = useNavigate(); + bookUrl, + fileType, + bookName, + }: BookPreviewProps) => { + const [location, setLocation] = useState(0); + const navigate = useNavigate(); - if (fileType === 'pdf') { - return ( - <> - navigate(-1)} - /> - - - ); - } else if (fileType === 'epub') { - return ( -
- navigate(-1)} - /> - setLocation(epubcfi)} - title={bookName} - showToc={true} - /> -
- ); - } -}; + if (fileType === 'pdf') { + return ( + <> + navigate(-1)} + /> +