-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb0b9b1
commit 8f267f3
Showing
21 changed files
with
286 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import { SignOutButton } from "~/components/auth/sign-out-button"; | ||
import { api } from "~/trpc/server"; | ||
import { FileUpload } from "~/components/upload/file-upload"; | ||
import { createClient } from "~/utils/supabase/server"; | ||
|
||
export default async function Home() { | ||
const supabase = createClient(); | ||
const { data } = await supabase.auth.getSession(); | ||
|
||
const test = await api.report.test({ | ||
token: data?.session?.access_token ?? "", | ||
}); | ||
|
||
console.log(test); | ||
const token = data?.session?.access_token ?? ""; | ||
|
||
return ( | ||
<main className=""> | ||
<h1 className="my-2 text-2xl font-bold">Profile</h1> | ||
<p>{test?.message}</p> | ||
<SignOutButton /> | ||
<div className="flex flex-col gap-8"> | ||
<h1 className="my-2 text-2xl font-bold">Upload a patient's chart</h1> | ||
<FileUpload token={token} /> | ||
</div> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Suspense } from "react"; | ||
import { notFound } from "next/navigation"; | ||
|
||
import Loading from "~/app/loading"; | ||
import ReportModal from "~/components/reports/report-modal"; | ||
import { BackButton } from "~/components/shared/back-button"; | ||
import { api } from "~/trpc/server"; | ||
|
||
export default async function Report({ | ||
params, | ||
}: { | ||
params: { reportId: string }; | ||
}) { | ||
const { report } = await api.report.byId({ id: Number(params.reportId) }); | ||
|
||
if (!report) notFound(); | ||
return ( | ||
<main className="overflow-y-auto"> | ||
<Suspense fallback={<Loading />}> | ||
<div className="relative"> | ||
<BackButton currentResource="reports" /> | ||
|
||
<div className="m-4"> | ||
<div className="mb-4 flex items-end justify-between"> | ||
<h1 className="text-2xl font-semibold">{report.title}</h1> | ||
<div className="flex gap-2"> | ||
<ReportModal report={report} /> | ||
</div> | ||
</div> | ||
<pre className={"text-wrap break-all rounded-lg bg-secondary p-4"}> | ||
{report.content} | ||
</pre> | ||
</div> | ||
</div> | ||
</Suspense> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
import { Suspense } from "react"; | ||
|
||
import Loading from "~/app/loading"; | ||
import ReportList from "~/components/reports/report-list"; | ||
import NewReportModal from "~/components/reports/report-modal"; | ||
import { api } from "~/trpc/server"; | ||
|
||
export default async function Reports() { | ||
const reports = await api.report.byUser(); | ||
export default function Reports() { | ||
const reports = api.report.byUser(); | ||
|
||
return ( | ||
<main> | ||
<div className="flex justify-between"> | ||
<h1 className="my-2 text-2xl font-semibold">Reports</h1> | ||
<NewReportModal /> | ||
</div> | ||
<ReportList reports={reports} /> | ||
<Suspense | ||
fallback={ | ||
<div className="flex w-full flex-col gap-4"> | ||
<Loading /> | ||
</div> | ||
} | ||
> | ||
<ReportList reports={reports} /> | ||
</Suspense> | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"use client"; | ||
|
||
import Link from "next/link"; | ||
import { usePathname } from "next/navigation"; | ||
import { ChevronLeftIcon } from "lucide-react"; | ||
|
||
import { Button } from "@wellchart/ui/button"; | ||
|
||
export function useBackPath(currentResource: string) { | ||
const pathname = usePathname(); | ||
const segmentCount = pathname.slice(1).split("/"); | ||
const backPath = | ||
segmentCount.length > 2 | ||
? pathname.slice(0, pathname.indexOf(currentResource) - 1) | ||
: pathname.slice(0, pathname.indexOf(segmentCount[1])); | ||
return backPath; | ||
} | ||
|
||
export function BackButton({ | ||
currentResource, | ||
}: { | ||
/* must be in kebab-case */ | ||
currentResource: string; | ||
}) { | ||
const backPath = useBackPath(currentResource); | ||
return ( | ||
<Button variant={"ghost"} asChild> | ||
<Link href={backPath}> | ||
<ChevronLeftIcon /> | ||
</Link> | ||
</Button> | ||
); | ||
} |
Oops, something went wrong.