import type { Dispatch, SetStateAction } from "react"; import { useState } from "react"; import { Dialog } from "@calcom/features/components/controlled-dialog"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog"; import { TextArea } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; interface IRescheduleDialog { isOpenDialog: boolean; setIsOpenDialog: Dispatch>; bookingUId: string; } export const RescheduleDialog = (props: IRescheduleDialog) => { const { t } = useLocale(); const utils = trpc.useUtils(); const { isOpenDialog, setIsOpenDialog, bookingUId: bookingId } = props; const [rescheduleReason, setRescheduleReason] = useState(""); const { mutate: rescheduleApi, isPending } = trpc.viewer.bookings.requestReschedule.useMutation({ async onSuccess() { showToast(t("reschedule_request_sent"), "success"); setIsOpenDialog(false); await utils.viewer.bookings.invalidate(); }, onError() { showToast(t("unexpected_error_try_again"), "error"); // @TODO: notify sentry }, }); return (

{t("reschedule_modal_description")}

{t("reason_for_reschedule_request")} (Optional)