import type { ReactNode } from "react";
import React from "react";
import { useEventTypeById } from "@calcom/atoms/hooks/event-types/private/useEventTypeById";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";
import { Dialog } from "@calcom/features/components/controlled-dialog";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Badge } from "@calcom/ui/components/badge";
import { DialogContent } from "@calcom/ui/components/dialog";
import { getDurationFormatted } from "../event-meta/Duration";
import { FromTime } from "@calcom/features/bookings/Booker/utils/dates";
import { useEvent } from "@calcom/web/modules/schedules/hooks/useEvent";
import { useBookerTime } from "@calcom/features/bookings/Booker/hooks/useBookerTime";
const BookEventFormWrapper = ({ children, onCancel }: { onCancel: () => void; children: ReactNode }) => {
const { data } = useEvent();
return ;
};
const PlatformBookEventFormWrapper = ({
children,
onCancel,
}: {
onCancel: () => void;
children: ReactNode;
}) => {
const eventId = useBookerStoreContext((state) => state.eventId);
const { data } = useEventTypeById(eventId);
return (
);
};
export const BookEventFormWrapperComponent = ({
child,
eventLength,
}: {
onCancel: () => void;
child: ReactNode;
eventLength?: number;
}) => {
const { i18n, t } = useLocale();
const selectedTimeslot = useBookerStoreContext((state) => state.selectedTimeslot);
const selectedDuration = useBookerStoreContext((state) => state.selectedDuration);
const recurringEventCount = useBookerStoreContext((state) => state.recurringEventCount);
const { timeFormat, timezone } = useBookerTime();
if (!selectedTimeslot) {
return null;
}
return (
<>
{t("confirm_your_details")}
{(selectedDuration || eventLength) && (
{getDurationFormatted(selectedDuration || eventLength, t)}
)}
{recurringEventCount && recurringEventCount > 1 && (
{t("repeats_num_times", {
count: recurringEventCount,
})}
)}
{child}
>
);
};
export const BookFormAsModal = ({
visible,
onCancel,
children,
}: {
visible: boolean;
onCancel: () => void;
children: ReactNode;
}) => {
const isPlatform = useIsPlatform();
return (
);
};