import classNames from "classnames"; import React from "react"; import type { ITimezone } from "react-timezone-select"; import type { Dayjs } from "@calcom/dayjs"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import getSlots from "@calcom/lib/slots"; import { trpc } from "@calcom/trpc/react"; import SkeletonLoader from "./SkeletonLoaderAvailabilityTimes"; interface Props { teamId: number; memberId: number; selectedDate: Dayjs; selectedTimeZone: ITimezone; frequency: number; HeaderComponent?: React.ReactNode; className?: string; } export default function TeamAvailabilityTimes(props: Props) { const { t } = useLocale(); const { data, isLoading } = trpc.viewer.teams.getMemberAvailability.useQuery( { teamId: props.teamId, memberId: props.memberId, dateFrom: props.selectedDate.toString(), dateTo: props.selectedDate.add(1, "day").toString(), timezone: `${props.selectedTimeZone.toString()}`, }, { refetchOnWindowFocus: false, } ); const slots = !isLoading ? getSlots({ frequency: props.frequency, inviteeDate: props.selectedDate, workingHours: data?.workingHours || [], minimumBookingNotice: 0, offsetStart: 0, eventLength: props.frequency, organizerTimeZone: `${data?.timeZone}`, }) : []; return (
{t("time_available")}
}> )}