import { useState } from "react"; import { BOOKER_NUMBER_OF_DAYS_TO_LOAD } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Icon } from "@calcom/ui"; type Props = { onButtonClick: () => void; dayCount: number | null; visible: boolean; isScheduleLoading: boolean; }; export function HavingTroubleFindingTime(props: Props) { const { t } = useLocale(); const [internalClick, setInternalClick] = useState(false); if (!props.visible) return null; // Easiest way to detect if its not enabled if ( (process.env.NEXT_PUBLIC_BOOKER_NUMBER_OF_DAYS_TO_LOAD == "0" && BOOKER_NUMBER_OF_DAYS_TO_LOAD == 0) || !process.env.NEXT_PUBLIC_BOOKER_NUMBER_OF_DAYS_TO_LOAD ) return null; // If we have clicked this internally - and the schedule above is not loading - hide this banner as there is no use of being able to go backwards if (internalClick && !props.isScheduleLoading) return null; if (props.isScheduleLoading || !props.dayCount) return null; return (
{t("having_trouble_finding_time")}