feat: images upload
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { formatDate } from "@/lib/utils";
|
||||
import { useAction } from "@/hooks/useAction";
|
||||
import { renounceCitizenship } from "@/lib/citizenship/actions";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
|
||||
type Citizenship = {
|
||||
id: string;
|
||||
userId: string;
|
||||
issuedAt: Date;
|
||||
};
|
||||
|
||||
export function RenunciationDialog({ citizenship }: { citizenship: Citizenship }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const { run, isPending } = useAction(renounceCitizenship, {
|
||||
successMessage: "Citizenship renounced",
|
||||
onSuccess: () => setOpen(false),
|
||||
});
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild><Button variant="secondary">Renunciation of citizenship</Button></DialogTrigger>
|
||||
<DialogContent>
|
||||
<DialogHeader>
|
||||
<DialogTitle asChild><h3>Renunciation of citizenship</h3></DialogTitle>
|
||||
<DialogDescription>
|
||||
This action is permanent and cannot be undone. If you continue, you will lose your citizenship of the European Federation, along with all associated rights and obligations.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<p>You are about to permanently renounce your citizenship of the European Federation, issued on {formatDate(citizenship.issuedAt)}.</p>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button variant="secondary">Cancel</Button>
|
||||
</DialogClose>
|
||||
<Button variant="destructive" disabled={isPending} onClick={() => run()}>
|
||||
{isPending && <Spinner />}Renounce citizenship
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user