import React, { useState, Dispatch, SetStateAction } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; import { TextArea } from "@calcom/ui/form/fields"; import Button from "@calcom/ui/v2/core/Button"; import showToast from "@calcom/ui/v2/core/notifications"; interface IRescheduleDialog { isOpenDialog: boolean; setIsOpenDialog: Dispatch>; bookingUId: string; } export const RescheduleDialog = (props: IRescheduleDialog) => { const { t } = useLocale(); const utils = trpc.useContext(); const { isOpenDialog, setIsOpenDialog, bookingUId: bookingId } = props; const [rescheduleReason, setRescheduleReason] = useState(""); const { mutate: rescheduleApi, isLoading } = trpc.useMutation("viewer.bookings.requestReschedule", { async onSuccess() { showToast(t("reschedule_request_sent"), "success"); setIsOpenDialog(false); await utils.invalidateQueries(["viewer.bookings"]); }, onError() { showToast(t("unexpected_error_try_again"), "error"); // @TODO: notify sentry }, }); return (

{t("reschedule_modal_description")}

{t("reason_for_reschedule_request")} (Optional)