* feat: add delete confirmation dialog to webhook list items * adds appname for translation key used in alert * extract delete wehook dialog into separate component * add e2e test * chore update e2e locator --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Romit <85230081+romitg2@users.noreply.github.com> Co-authored-by: Romit <romitgabani@icloud.com>
32 lines
989 B
TypeScript
32 lines
989 B
TypeScript
import { APP_NAME } from "@calcom/lib/constants";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Dialog, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
|
|
|
|
interface DeleteWebhookDialogProps {
|
|
open: boolean;
|
|
onOpenChange: (open: boolean) => void;
|
|
onConfirm: () => void;
|
|
isPending: boolean;
|
|
}
|
|
|
|
export function DeleteWebhookDialog({ open, onOpenChange, onConfirm, isPending }: DeleteWebhookDialogProps) {
|
|
const { t } = useLocale();
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<ConfirmationDialogContent
|
|
variety="danger"
|
|
title={t("delete_webhook")}
|
|
confirmBtnText={t("confirm_delete_webhook")}
|
|
loadingText={t("confirm_delete_webhook")}
|
|
isPending={isPending}
|
|
onConfirm={(e) => {
|
|
e.preventDefault();
|
|
onConfirm();
|
|
}}>
|
|
{t("delete_webhook_confirmation_message", { appName: APP_NAME })}
|
|
</ConfirmationDialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|