⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
import type { ReactNode } from "react";
import { useTranslation } from "react-i18next";
import {
AlertDialog,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
type ConfirmDialogProps = {
open: boolean;
onOpenChange: (open: boolean) => void;
title: ReactNode;
description?: ReactNode;
confirmLabel: ReactNode;
pendingLabel?: ReactNode;
pending?: boolean;
destructive?: boolean;
onConfirm: () => void;
children?: ReactNode;
confirmDisabled?: boolean;
};
export function ConfirmDialog({
open,
onOpenChange,
title,
description,
confirmLabel,
pendingLabel,
pending = false,
destructive = true,
onConfirm,
children,
confirmDisabled = false,
}: ConfirmDialogProps) {
const { t } = useTranslation();
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
{description ? (
<AlertDialogDescription>{description}</AlertDialogDescription>
) : null}
</AlertDialogHeader>
{children ? <div className="px-6 pb-4">{children}</div> : null}
<AlertDialogFooter>
<Button
type="button"
variant="outline"
size="sm"
onClick={() => onOpenChange(false)}
disabled={pending}
>
{t("common:actions.cancel")}
</Button>
<Button
type="button"
variant={destructive ? "destructive" : "default"}
size="sm"
onClick={onConfirm}
disabled={pending || confirmDisabled}
>
{pending && pendingLabel ? pendingLabel : confirmLabel}
</Button>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}