diff --git a/bun.lockb b/bun.lockb index 1b7c16f..5271a3c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/next.config.js b/next.config.js index 5bbc884..07d270c 100644 --- a/next.config.js +++ b/next.config.js @@ -19,23 +19,6 @@ const config = { }, ], }, - webpack: (config, { isServer }) => { - if (!isServer) { - config.resolve.fallback.fs = false; - } - - return config; - }, - experimental: { - turbo: { - rules: { - "*.svg": { - loaders: ["@svgr/webpack"], - as: "*.js", - }, - }, - }, - }, }; export default config; diff --git a/package.json b/package.json index bdbb14d..755fdd1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "db:migrate": "drizzle-kit migrate", "db:push": "drizzle-kit push", "db:studio": "drizzle-kit studio", - "dev": "next dev --turbo", + "dev": "next dev", "lint": "next lint", "start": "next start" }, diff --git a/src/app/@modal/(.)paperless/document/[id]/page.tsx b/src/app/@modal/(.)paperless/document/[id]/page.tsx index 6d8d8af..b8fc2d7 100644 --- a/src/app/@modal/(.)paperless/document/[id]/page.tsx +++ b/src/app/@modal/(.)paperless/document/[id]/page.tsx @@ -1,10 +1,5 @@ -import { Modal } from "./modal"; import DocumentViewer from "@/components/document-viewer"; -export default function DocumentModal(props: { id: number }) { - return ( - - - - ); +export default function FullPageDocumentPage({ params }: { params: { id: number } }) { + return ; } diff --git a/src/app/actions.ts b/src/app/actions.ts index 09e288f..a4f3dd1 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -89,4 +89,5 @@ export async function getPaperlessDocument(id: number) { } } catch (error) { console.error("Error fetching PDF:", error); + } } diff --git a/src/app/document-testing/page.tsx b/src/app/document-testing/page.tsx deleted file mode 100644 index e34e854..0000000 --- a/src/app/document-testing/page.tsx +++ /dev/null @@ -1,40 +0,0 @@ -"use client"; -import { useState } from 'react'; -import { Document, Page, pdfjs } from 'react-pdf'; -import { getServerSideProps } from './something'; - -// Configure PDF.js worker -pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`; - -interface PDFViewerProps { - pdfUrl: string; // URL to the PDF document -} - -const PDFViewer: React.FC = ({ pdfUrl }) => { - const [numPages, setNumPages] = useState(null); - - const onDocumentLoadSuccess = ({ numPages }: { numPages: number }) => { - setNumPages(numPages); - }; - - return ( -
- - {Array.from( - new Array(numPages || 0), - (el, index) => ( - - ), - )} - -
- ); -}; - -export default PDFViewer; diff --git a/src/app/document-testing/something.tsx b/src/app/document-testing/something.tsx deleted file mode 100644 index 1478fb8..0000000 --- a/src/app/document-testing/something.tsx +++ /dev/null @@ -1,53 +0,0 @@ -// pages/pdf-viewer.tsx - -import { useState } from 'react'; -import { Document, Page, pdfjs } from 'react-pdf'; -import { GetServerSideProps } from 'next'; - -// Configure PDF.js worker -pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.min.js`; - -interface PDFViewerProps { - pdfUrl: string; // URL to the PDF document -} - -const PDFViewer: React.FC = ({ pdfUrl }) => { - const [numPages, setNumPages] = useState(null); - - const onDocumentLoadSuccess = ({ numPages }: { numPages: number }) => { - setNumPages(numPages); - }; - - return ( -
- - {Array.from( - new Array(numPages || 0), - (el, index) => ( - - ), - )} - -
- ); -}; - -export const getServerSideProps: GetServerSideProps = async () => { - // Fetch PDF URL from your API or any other source - const res = await fetch('URL_TO_YOUR_PDF_API_ENDPOINT'); - const { pdfUrl } = await res.json(); - - return { - props: { - pdfUrl - } - }; -}; - -export default PDFViewer; diff --git a/src/app/paperless/document/[id]/page.tsx b/src/app/paperless/document/[id]/page.tsx index be788e3..7248b50 100644 --- a/src/app/paperless/document/[id]/page.tsx +++ b/src/app/paperless/document/[id]/page.tsx @@ -1,7 +1,6 @@ import DocumentViewer from "@/components/document-viewer"; -export default function FullPageDocumentPage(props: { id: number }) { - return ( - - ); +export default function FullPageDocumentPage({ params }: { params: { id: number } }) { + console.log("FULLL PAPGJPIGHEGPIUSHEGPIUWEGHPIWUEGH: " + params.id); + return ; } diff --git a/src/components/document-viewer.tsx b/src/components/document-viewer.tsx index 8adf363..8f734f5 100644 --- a/src/components/document-viewer.tsx +++ b/src/components/document-viewer.tsx @@ -7,6 +7,7 @@ import LoadingSpinner from "@/components/loading-spinner"; export default function DocumentViewer(props: { id: number }) { const [pdfUrl, setPdfUrl] = useState(null); const [loading, setLoading] = useState(true); + console.log("docuement viewer: " + props.id) useEffect(() => { const fetchData = async () => { @@ -21,7 +22,6 @@ export default function DocumentViewer(props: { id: number }) { try { const response = await fetch(url, { headers: { - "Content-Type": "application/pdf", Authorization: `Token ${userData.paperlessToken}`, }, });