diff --git a/src/components/audio-preview.tsx b/src/components/audio-preview.tsx index a5f93db..2f80d6b 100644 --- a/src/components/audio-preview.tsx +++ b/src/components/audio-preview.tsx @@ -9,15 +9,20 @@ import type { UsersTableType } from "@/server/db/schema"; import { Button, buttonVariants } from "@/components/ui/button"; import { useRouter } from "next/navigation"; import { ChevronLeft } from "lucide-react"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip"; import { useState } from "react"; import OpenExternalLink from "./external-link"; import type { WhishperRecordingType } from "@/types"; +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog"; const queryClient = new QueryClient(); @@ -80,6 +85,18 @@ async function downloadWhishperRecording(url: string, name: string) { } } +async function deleteWhishperRecording(url: string) { + const response = await fetch(url, { + method: "DELETE", + }); + + if (!response.ok) { + throw new Error("Network error"); + } + + return response; +} + type AudioInfoProps = { id: string; }; @@ -204,21 +221,36 @@ function AudioInfo({ id }: AudioInfoProps) { > Download - - - - + + + + + Are you absolutely sure? + + + This action cannot be undone. This will permanently delete + the recording. + + + + Cancel + { + await deleteWhishperRecording( + `${userData.whishperURL}/api/transcriptions/${id}`, + ); + }} > - Delete - - - Comming soon! - - + Continue + + + +