Skip to content

Commit

Permalink
its good enough
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirazad committed Jul 25, 2024
1 parent 405d57f commit 01486fc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.tabSize": 2
"editor.tabSize": 2,
"typescript.preferences.importModuleSpecifier": "non-relative"
}
4 changes: 2 additions & 2 deletions src/components/audio-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Button, buttonVariants } from "@/components/ui/button";
import { useRouter } from "next/navigation";
import { ChevronLeft } from "lucide-react";
import { useState } from "react";
import OpenExternalLink from "./external-link";
import OpenExternalLink from "@/components/external-link";
import type { WhishperRecordingType } from "@/types";
import {
AlertDialog,
Expand All @@ -30,7 +30,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { toast } from "sonner";
import BodyMessage from "./body-message";
import BodyMessage from "@/components/body-message";

const queryClient = new QueryClient();

Expand Down
22 changes: 9 additions & 13 deletions src/components/document-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@/components/ui/alert-dialog";
import { toast } from "sonner";
import { getUserData } from "@/app/actions";
import { Button, buttonVariants } from "./ui/button";
import { Button, buttonVariants } from "@/components/ui/button";
import { useRouter } from "next/navigation";
import {
useQuery,
Expand All @@ -26,8 +26,7 @@ import LoadingSpinner from "./loading-spinner";
import OpenExternalLink from "./external-link";
import type { PaperlessDocumentType } from "@/types";
import React from "react";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import BodyMessage from "./body-message";
import BodyMessage from "@/components/body-message";

const queryClient = new QueryClient();

Expand Down Expand Up @@ -150,17 +149,16 @@ function DocumentDetailsInner(props: { id: number }) {
return (
<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:m-8 md:flex-row md:gap-16">
<div>
{documentData?.title}
<div className="m-4 flex flex-grow flex-col justify-center gap-8 md:flex-row md:gap-16">
<div className="w-full">
<h1 className="mb-2 text-xl font-bold">{documentData?.title}</h1>
<object
data={pdfUrl}
type="application/pdf"
width="100%"
height="100%"
className="w-full h-full"
/>
</div>
<div className="flex flex-col gap-8">
<div className="flex w-36 flex-col gap-8">
<Button
onClick={(e) => {
e.preventDefault();
Expand All @@ -169,11 +167,10 @@ function DocumentDetailsInner(props: { id: number }) {
>
Back
</Button>
<a>
{/* <a className={buttonVariants({ variant: "default" })}>
Download
<Download />
</a>
<div id="dialog-container" />
</a> */}
<OpenExternalLink
className={buttonVariants({ variant: "default" })}
href={`${userData.paperlessURL}/documents/${props.id}/details/`}
Expand Down Expand Up @@ -228,7 +225,6 @@ export default function DocumentDetails(props: { id: number }) {
return (
<QueryClientProvider client={queryClient}>
<DocumentDetailsInner {...props} />
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
);
}
2 changes: 1 addition & 1 deletion src/components/document-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function ModalDocumentPage({
return (
<Modal>
<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="flex h-full 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:m-8 md:flex-row md:gap-16">
<DocumentPreview id={params.id} />
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/components/document-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ function Preview(props: { id: number }) {

if (isPdfUrlLoading ?? isUserDataLoading) {
return <SkeletonLoader />;
} else if (!pdfUrl || !userData) {
}

if (!pdfUrl || !userData) {
return <BodyMessage>Failed to get document</BodyMessage>;
}

return <img src={pdfUrl} alt="Document Preview" className="h-full" />;
return <img src={pdfUrl} alt="Document Preview"/>;
}

export default function DocumentPreview(props: { id: number }) {
Expand Down

0 comments on commit 01486fc

Please sign in to comment.