Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,52 @@
import { Spinner } from "@/components/Spinner";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { downloadFile } from "@/lib/utils";
import { useGuides } from "@/queries/use-guides";
import { Route } from "@/routes/guides/$guideId";
import { notFound } from "@tanstack/react-router";
import { Download, ExternalLink } from "lucide-react";

function GuideDetails() {
const { guideId } = Route.useParams();

const { data: guide } = useGuides((guides) =>
const { data: guide, isLoading } = useGuides((guides) =>
guides.find((g) => g.id === guideId)
);

return <>{JSON.stringify(guide)}</>;
if (isLoading) return <Spinner show={isLoading} />;

if (!guide) throw notFound();
return (
<>
<Card>
<CardHeader>
<CardTitle>{guide.title}</CardTitle>
</CardHeader>
{guide.guideType === "Text" && (
<CardContent className="h-full w-full">
<div dangerouslySetInnerHTML={{ __html: guide.text }} />
</CardContent>
)}
{guide.guideType === "Website" && (
<Button variant="link" className="cursor-pointer">
<a href={guide.websiteUrl}>Visit Website</a>
<ExternalLink className="h-4 w-4" />
</Button>
)}
{guide.guideType === "Document" && (
<Button
variant="link"
className="cursor-pointer"
onClick={() => downloadFile(guide.presignedUrl)}
>
Download
<Download className="h-4 w-4" />
</Button>
)}
</Card>
</>
);
}

export default GuideDetails;
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import Notification from "@/components/Notification";
import Notification from "@/components/notifications";
import { Spinner } from "@/components/Spinner";
import { useNotifications } from "@/queries/use-notifications";
import { Route } from "@/routes/notifications/$notificationId";
import { notFound } from "@tanstack/react-router";

function NotificationDetails() {
const { notificationId } = Route.useParams();
const { data: notification } = useNotifications((notification) =>
const { data: notification, isLoading } = useNotifications((notification) =>
notification.notifications.find((n) => n.id == notificationId)
);
if (isLoading) return <Spinner show={isLoading} />;

if (!notification) throw notFound();

Expand Down