Skip to content

Commit

Permalink
Button functionality work
Browse files Browse the repository at this point in the history
  • Loading branch information
aamirazad committed Jul 10, 2024
1 parent 12a58cc commit 20df473
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/audio-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useState } from "react";
const queryClient = new QueryClient();

const fetchUserData = async (): Promise<UsersTableType> => {
const response = await fetch(`/api/getUserData`);
const response = await fetch("/api/getUserData");
if (!response.ok) {
throw new Error("Network error");
}
Expand Down
18 changes: 12 additions & 6 deletions src/components/document-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
} from "@tanstack/react-query";
import type { AdviceAPIType } from "@/types";
import OpenInternalLink from "./internal-link";
import { ExternalLink } from "lucide-react";
import OpenExternalLink from "./external-link";
import { UsersTableType } from "@/server/db/schema";
import type { UsersTableType } from "@/server/db/schema";
import { Download } from "lucide-react";

const queryClient = new QueryClient();

Expand Down Expand Up @@ -172,7 +172,7 @@ function DocumentViewer(props: { id: number }) {
</p>
</object>
</div>
<div className="flex flex-shrink-0 flex-col">
<div className="flex flex-shrink-0 flex-col gap-8">
<Button
onClick={(e) => {
e.preventDefault();
Expand All @@ -182,13 +182,19 @@ function DocumentViewer(props: { id: number }) {
Back
</Button>
<a
href="path_to_file"
download="proposed_file_name"
href={pdfUrl}
download={pdfUrl}
className={`${buttonVariants({ variant: "default" })}`}
>
Download
<Download />
</a>
<OpenExternalLink href={`${userData.paperlessURL}`}>Open</OpenExternalLink>
<OpenExternalLink
className={buttonVariants({ variant: "default" })}
href={`${userData.paperlessURL}/documents/${props.id}/details/`}
>
Open
</OpenExternalLink>
</div>
</div>
</div>
Expand Down

0 comments on commit 20df473

Please sign in to comment.