feat: citizenship applications

This commit is contained in:
Ivan Rezchikov
2026-06-23 19:03:10 +03:00
parent 58ec75c948
commit c60ab9e8f9
44 changed files with 1254 additions and 130 deletions
+5 -4
View File
@@ -14,16 +14,17 @@ 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; title: string; slug: string; updatedAt: Date };
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) {
async function deletePage(id: string, type: PageType) {
setIsDeletingId(id);
try {
await deletePageAction(id)
await deletePageAction(id, type)
} finally {
setIsDeletingId("")
}
@@ -51,7 +52,7 @@ export default function DraftsDialog({ drafts }: { drafts: Draft[]}) {
<Link href={`/news/${draft.slug}/edit`}>
<Button variant="secondary" size="icon-sm"><PencilIcon /></Button>
</Link>
<Button disabled={isDeletingId === draft.id} variant="secondary" size="icon-sm" onClick={() => deletePage(draft.id)}>
<Button disabled={isDeletingId === draft.id} variant="secondary" size="icon-sm" onClick={() => deletePage(draft.id, draft.type)}>
{isDeletingId === draft.id ? <Spinner /> : <XIcon />}
</Button>
</div>