diff --git a/bun.lockb b/bun.lockb index 6ebb93f..5271a3c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/empty-module.ts b/empty-module.ts new file mode 100644 index 0000000..ff8b4c5 --- /dev/null +++ b/empty-module.ts @@ -0,0 +1 @@ +export default {}; diff --git a/package.json b/package.json index c782b3b..755fdd1 100644 --- a/package.json +++ b/package.json @@ -9,23 +9,22 @@ "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" }, "dependencies": { "@clerk/nextjs": "^5.1.5", "@clerk/themes": "^2.1.9", - "@clerk/types": "^4.6.1", "@hookform/resolvers": "^3.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-label": "^2.0.2", - "@radix-ui/react-navigation-menu": "^1.1.4", "@radix-ui/react-separator": "^1.0.3", "@radix-ui/react-slot": "^1.0.2", - "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.1.1", + "@react-pdf-viewer/core": "^3.12.0", + "@react-pdf/renderer": "^3.4.4", "@t3-oss/env-nextjs": "^0.10.1", "@tanstack/eslint-plugin-query": "^5.43.1", "@tanstack/react-query": "^5.45.0", @@ -41,7 +40,7 @@ "react": "^18.3.1", "react-dom": "^18.3.1", "react-hook-form": "^7.51.5", - "server-only": "^0.0.1", + "react-pdf": "^9.0.0", "sonner": "^1.5.0", "tailwind-merge": "^2.3.0", "tailwindcss-animate": "^1.0.7", @@ -69,6 +68,10 @@ }, "packageManager": "pnpm@9.1.4", "trustedDependencies": [ - "@clerk/shared" + "@clerk/shared", + "bufferutil", + "canvas", + "esbuild", + "utf-8-validate" ] } diff --git a/src/app/@modal/(.)paperless/document/[id]/modal.tsx b/src/app/@modal/(.)paperless/document/[id]/modal.tsx new file mode 100644 index 0000000..8ce3038 --- /dev/null +++ b/src/app/@modal/(.)paperless/document/[id]/modal.tsx @@ -0,0 +1,31 @@ +"use client"; + +import { type ElementRef, useEffect, useRef } from "react"; +import { useRouter } from "next/navigation"; +import { createPortal } from "react-dom"; + +export function Modal({ children }: { children: React.ReactNode }) { + const router = useRouter(); + const dialogRef = useRef>(null); + + useEffect(() => { + if (!dialogRef.current?.open) { + dialogRef.current?.showModal(); + } + }, []); + + function onDismiss() { + router.back(); + } + + return createPortal( + +
{children}
+
, + document.getElementById("modal-root")!, + ); +} diff --git a/src/app/@modal/(.)paperless/document/[id]/page.tsx b/src/app/@modal/(.)paperless/document/[id]/page.tsx new file mode 100644 index 0000000..d4df65a --- /dev/null +++ b/src/app/@modal/(.)paperless/document/[id]/page.tsx @@ -0,0 +1,14 @@ +import DocumentViewer from "@/components/document-viewer"; +import { Modal } from "./modal"; + +export default function FullPageDocumentPage({ + params, +}: { + params: { id: number }; +}) { + return ( + + + + ); +} diff --git a/src/app/@modal/default.tsx b/src/app/@modal/default.tsx new file mode 100644 index 0000000..7046598 --- /dev/null +++ b/src/app/@modal/default.tsx @@ -0,0 +1,3 @@ +export default function DefaultModal() { + return null; + } \ No newline at end of file diff --git a/src/app/actions.ts b/src/app/actions.ts index 18bd344..e1b17e7 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -44,10 +44,6 @@ export async function getUserData() { } export async function getPaperlessDocuments(query: string) { - const { userId } = auth(); - - if (!userId) return null; - const userData = await getUserData(); if (!query || query == "null" || query.length < 3 || !userData) return null; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6745ff0..f9918c6 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,8 +15,10 @@ export const metadata = { export default function RootLayout({ children, + modal, }: { children: React.ReactNode; + modal: React.ReactNode; }) { return ( - + -
+
-
+
{children}
+ {modal} +