"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"; type Draft = { id: string; title: string; slug: string; updatedAt: Date }; export default function DraftsDialog({ drafts }: { drafts: Draft[]}) { const [isDeletingId, setIsDeletingId] = useState(""); async function deletePage(id: string) { setIsDeletingId(id); try { await deletePageAction(id) } finally { setIsDeletingId("") } } return ( Drafts Here are drafts of your pages {drafts.length > 0 ? (
{drafts.map((draft) => (

{draft.title}

))}
) : (

There are no drafts yet...

)}
) }