Skip to content

Commit

Permalink
fix: minor visual changes on the details page (#118)
Browse files Browse the repository at this point in the history
### TL;DR

Fix wording on the paperless details page and fit the pdf in the box.
  • Loading branch information
aamirazad authored Aug 7, 2024
1 parent b42ddfe commit 9483af3
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/components/document-details.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client";

import { Download } from "lucide-react";
import {
AlertDialog,
AlertDialogAction,
Expand All @@ -14,7 +13,7 @@ import {
} from "@/components/ui/alert-dialog";
import { toast } from "sonner";
import { getUserData } from "@/app/actions";
import { Button, buttonVariants } from "@/components/ui/button";
import { buttonVariants } from "@/components/ui/button";
import { useRouter, useSearchParams } from "next/navigation";
import {
useQuery,
Expand Down Expand Up @@ -96,7 +95,6 @@ async function getPaperlessDocumentData(id: number, userData: UsersTableType) {
Authorization: `Token ${userData.paperlessToken}`,
},
});
console.log(response);
if (response.ok) {
const data = (await response.json()) as PaperlessDocumentType;
return data;
Expand Down Expand Up @@ -126,7 +124,6 @@ function DocumentDetailsInner(props: { id: number }) {
queryKey: ["pdfUrl", props.id, userData], // Include id and userData in the query key
queryFn: async () => {
const result = await getPaperlessDocument(props.id, userData!);
console.log("Fetched PDF URL:", result);
return result;
},
enabled: !!userData,
Expand All @@ -137,7 +134,6 @@ function DocumentDetailsInner(props: { id: number }) {
queryKey: ["documentData", props.id, userData], // Include id and userData in the query key
queryFn: async () => {
const result = await getPaperlessDocumentData(props.id, userData!);
console.log("Fetched Document Data:", result);
return result;
},
enabled: !!userData,
Expand All @@ -153,14 +149,17 @@ function DocumentDetailsInner(props: { id: number }) {
<div className="flex h-full w-full min-w-0 justify-center">
<div className="flex h-4/5 flex-col rounded-xl bg-slate-600/50 md:w-1/2">
<div className="m-4 flex flex-grow flex-col justify-center gap-8 md:flex-row md:gap-16">
<div className="w-full">
<div className="flex h-full w-full flex-col">
<h1 className="mb-2 text-xl font-bold">{documentData?.title}</h1>
<object
data={pdfUrl}
type="application/pdf"
className="h-full w-full"
/>
<div className="flex-grow overflow-hidden">
<object
data={pdfUrl}
type="application/pdf"
className="h-full max-h-full w-full max-w-full"
/>
</div>
</div>

<div className="flex w-36 flex-col gap-8">
<Link
href={`/paperless?query=${query}`}
Expand All @@ -169,9 +168,9 @@ function DocumentDetailsInner(props: { id: number }) {
Back
</Link>
{/* <a className={buttonVariants({ variant: "default" })}>
Download
<Download />
</a> */}
Download
<Download />
</a> */}
<OpenExternalLink
className={buttonVariants({ variant: "default" })}
href={`${userData.paperlessURL}/documents/${props.id}/details/`}
Expand All @@ -189,7 +188,7 @@ function DocumentDetailsInner(props: { id: number }) {
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete
the recording.
the pdf.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
Expand Down

0 comments on commit 9483af3

Please sign in to comment.