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

{draft.title}

))}
) : (

There are no drafts yet...

)}
) }