import { useRouter } from "next/router"; import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import useTheme from "@calcom/lib/hooks/useTheme"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; import type { RecurringEvent } from "@calcom/types/Calendar"; import { Icon } from "@calcom/ui/Icon"; import { Button, TextArea } from "@calcom/ui/components"; type Props = { booking: { title?: string; uid?: string; id?: number; }; profile: { name: string | null; slug: string | null; }; recurringEvent: RecurringEvent | null; team?: string | null; setIsCancellationMode: (value: boolean) => void; theme: string | null; allRemainingBookings: boolean; }; export default function CancelBooking(props: Props) { const [cancellationReason, setCancellationReason] = useState(""); const { t } = useLocale(); const router = useRouter(); const { booking, profile, team, allRemainingBookings } = props; const [loading, setLoading] = useState(false); const telemetry = useTelemetry(); const [error, setError] = useState(booking ? null : t("booking_already_cancelled")); useTheme(props.theme); return ( <> {error && (
)} {!error && (