"use client"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { deletePageAction } from "@/lib/pages/actions"; import { PencilIcon, XIcon } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import { Spinner } from "@/components/ui/spinner"; import { PageType } from "@/lib/pages/types"; import { useAction } from "@/hooks/useAction"; type Draft = { id: string; type: PageType; title: string; slug: string; updatedAt: Date | null }; function DraftItem({ draft, onDeleted }: { draft: Draft; onDeleted: (id: string) => void }) { const { run, isPending } = useAction(deletePageAction, { successMessage: "Draft deleted", onSuccess: () => onDeleted(draft.id), }); return (