diff --git a/app/(app)/sessions/[id]/page.tsx b/app/(app)/sessions/[id]/page.tsx
index f2163a7..dfad216 100644
--- a/app/(app)/sessions/[id]/page.tsx
+++ b/app/(app)/sessions/[id]/page.tsx
@@ -7,6 +7,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { SessionTimelineChart } from "@/components/sessions/SessionTimelineChart";
import { SessionTitleEditor } from "@/components/sessions/SessionTitleEditor";
import { SessionDescriptionEditor } from "@/components/sessions/SessionDescriptionEditor";
+import { SessionDeleteButton } from "@/components/sessions/SessionDeleteButton";
import { STATUS_VARIANT } from "@/components/sessions/session-status";
import { getSessionDetail, getSessionName } from "@/lib/db/queries/sessions";
import { getSessionTimeline } from "@/lib/db/queries/stats";
@@ -65,6 +66,7 @@ export default async function SessionDetailPage({ params }: { params: Promise<{
)}
+
diff --git a/components/sessions/SessionDeleteButton.tsx b/components/sessions/SessionDeleteButton.tsx
new file mode 100644
index 0000000..0540082
--- /dev/null
+++ b/components/sessions/SessionDeleteButton.tsx
@@ -0,0 +1,63 @@
+"use client";
+
+import { useState } from "react";
+import { useRouter } from "next/navigation";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Trash2 } from "lucide-react";
+import { toast } from "sonner";
+
+export function SessionDeleteButton({ sessionId, sessionName }: { sessionId: number; sessionName: string | null }) {
+ const router = useRouter();
+ const [open, setOpen] = useState(false);
+ const [deleting, setDeleting] = useState(false);
+
+ async function handleDelete() {
+ setDeleting(true);
+ const res = await fetch(`/api/sessions/${sessionId}`, { method: "DELETE" });
+ setDeleting(false);
+ if (res.ok) {
+ toast.success("Session deleted");
+ router.push("/sessions");
+ router.refresh();
+ } else {
+ toast.error("Could not delete session");
+ }
+ }
+
+ return (
+ <>
+
+
+
+ >
+ );
+}