From db224859856f544b42bbe40a6c3c76f77e7c7ed2 Mon Sep 17 00:00:00 2001 From: Aamir Azad Date: Tue, 25 Jun 2024 14:32:46 +0530 Subject: [PATCH] It's starting to work --- .../@modal/(.)/paperless-documents/modal.tsx | 30 ------------------- .../@modal/(.)/paperless-documents/page.tsx | 9 ------ .../(.)paperless/document/[id]/page.tsx | 7 +++++ src/app/@modal/default.tsx | 2 +- src/app/documents/[id]/page.tsx | 0 src/app/layout.tsx | 4 +++ src/app/page.tsx | 2 ++ src/app/paperless/page.tsx | 11 +++---- src/components/topnav.tsx | 4 +-- 9 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 src/app/@modal/(.)/paperless-documents/modal.tsx delete mode 100644 src/app/@modal/(.)/paperless-documents/page.tsx create mode 100644 src/app/@modal/(.)paperless/document/[id]/page.tsx create mode 100644 src/app/documents/[id]/page.tsx diff --git a/src/app/@modal/(.)/paperless-documents/modal.tsx b/src/app/@modal/(.)/paperless-documents/modal.tsx deleted file mode 100644 index 5176ebe..0000000 --- a/src/app/@modal/(.)/paperless-documents/modal.tsx +++ /dev/null @@ -1,30 +0,0 @@ -'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')! - ); -} \ No newline at end of file diff --git a/src/app/@modal/(.)/paperless-documents/page.tsx b/src/app/@modal/(.)/paperless-documents/page.tsx deleted file mode 100644 index df8694c..0000000 --- a/src/app/@modal/(.)/paperless-documents/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Modal } from './modal'; - -export default function PhotoModal({ - params: { id: photoId }, - }: { - params: { id: string }; - }) { - return {photoId}; - } \ No newline at end of file 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..aff1f6f --- /dev/null +++ b/src/app/@modal/(.)paperless/document/[id]/page.tsx @@ -0,0 +1,7 @@ +export default function DocumentPage({ + params: { id }, + }: { + params: { id: string }; + }) { + return
{id}
; + } \ No newline at end of file diff --git a/src/app/@modal/default.tsx b/src/app/@modal/default.tsx index 7592cba..7046598 100644 --- a/src/app/@modal/default.tsx +++ b/src/app/@modal/default.tsx @@ -1,3 +1,3 @@ -export default function Default() { +export default function DefaultModal() { return null; } \ No newline at end of file diff --git a/src/app/documents/[id]/page.tsx b/src/app/documents/[id]/page.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6745ff0..fc41b22 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 ( + {modal} +
Or sign in to access the dashboard.
+ Buttom ); diff --git a/src/app/paperless/page.tsx b/src/app/paperless/page.tsx index 4f2c6ad..a5ae116 100644 --- a/src/app/paperless/page.tsx +++ b/src/app/paperless/page.tsx @@ -143,15 +143,12 @@ function DocumentsPage() { diff --git a/src/components/topnav.tsx b/src/components/topnav.tsx index f1c9ef5..277dba8 100644 --- a/src/components/topnav.tsx +++ b/src/components/topnav.tsx @@ -124,7 +124,7 @@ export function TopNav() { {/* Desktop links */}
Paperless-ngx @@ -153,7 +153,7 @@ export function TopNav() { Links Paperless-ngx