Skip to content

Commit

Permalink
Logic is done, but need to authorize now
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirazad committed Jun 25, 2024
1 parent f618fd7 commit ec1a5ac
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/app/@modal/(.)paperless/document/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Modal } from "./modal";
import DocumentViewer from "@/components/DocumentViewer";

export default function DocumentModal(props: { id: number }) {
return (
<Modal>
<DocumentViewer url="https://pdfobject.com/pdf/sample.pdf"></DocumentViewer>
<DocumentViewer id={props.id}></DocumentViewer>
</Modal>
);
}
10 changes: 3 additions & 7 deletions src/app/paperless/document/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import DocumentViewer from "@/components/DocumentViewer";

export default function FullPageDocumentPage(props: { id: number }) {
return (
<embed
src="https://pdfobject.com/pdf/sample.pdf"
className="h-screen w-2/3"
type="application/pdf"
width="100%"
height="100%"
/>
<DocumentViewer id={props.id} />
);
}
2 changes: 1 addition & 1 deletion src/app/paperless/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
QueryClient,
} from "@tanstack/react-query";
import LoadingSpinner from "@/components/loading-spinner";
import { getPaperlessDocuments, getUserData } from "../actions";
import { getPaperlessDocuments, getUserData } from "@/app/actions";
import Link from "next/link";

const queryClient = new QueryClient();
Expand Down
32 changes: 22 additions & 10 deletions src/components/DocumentViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
export default function DocumentViewer(props: {url: string}) {
<embed
src={url}
className="h-screen w-2/3"
type="application/pdf"
width="100%"
height="100%"
/>

}
import { getUserData } from "@/app/actions";
import LoadingSpinner from "./loading-spinner";

export default async function DocumentViewer(props: { id: number }) {
const userData = await getUserData();

if (!userData) {
return <h1>Failure</h1>;
}

const url = `${userData.paperlessURL}/api/documents${props.id}/preview`;

return (
<embed
src={url}
className="h-screen w-2/3"
type="application/pdf"
width="100%"
height="100%"
/>
);
}

0 comments on commit ec1a5ac

Please sign in to comment.