core/apps/webapp/app/components/logs/log-options.tsx
Harshith Mullapudi 489fb5934a
feat: add stripe billing for cloud (#81)
* feat: add stripe billing for cloud

* fix: mcp tools
2025-10-02 10:58:11 +05:30

83 lines
2.2 KiB
TypeScript

import { EllipsisVertical, Trash } from "lucide-react";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
import { Button } from "../ui/button";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "../ui/alert-dialog";
import { useState, useEffect } from "react";
import { useFetcher, useNavigate } from "@remix-run/react";
interface LogOptionsProps {
id: string;
}
export const LogOptions = ({ id }: LogOptionsProps) => {
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const deleteFetcher = useFetcher<{ success: boolean }>();
const navigate = useNavigate();
const handleDelete = () => {
deleteFetcher.submit(
{ id },
{
method: "DELETE",
action: "/api/v1/ingestion_queue/delete",
encType: "application/json",
},
);
setDeleteDialogOpen(false);
};
useEffect(() => {
console.log(deleteFetcher.state, deleteFetcher.data);
if (deleteFetcher.state === "idle" && deleteFetcher.data?.success) {
navigate(`/home/inbox`);
}
}, [deleteFetcher.state, deleteFetcher.data]);
return (
<>
<Button
variant="secondary"
size="sm"
className="gap-2 rounded"
onClick={(e) => {
setDeleteDialogOpen(true);
}}
>
<Trash size={15} /> Delete
</Button>
<AlertDialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete Episode</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete this episode? This action cannot
be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete}>
Continue
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</>
);
};