import React, { useState, useEffect } from "react"; import dayjs from "@calcom/dayjs"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import TimezoneSelect, { ITimezone } from "@calcom/ui/form/TimezoneSelect"; import { Avatar, Label, Select } from "@calcom/ui/v2"; import { DatePicker } from "@calcom/ui/v2"; import LicenseRequired from "../../../common/components/LicenseRequired"; import TeamAvailabilityTimes from "./TeamAvailabilityTimes"; interface Props { team?: inferQueryOutput<"viewer.teams.get">; member?: inferQueryOutput<"viewer.teams.get">["members"][number]; } export default function TeamAvailabilityModal(props: Props) { const utils = trpc.useContext(); const [selectedDate, setSelectedDate] = useState(dayjs()); const [selectedTimeZone, setSelectedTimeZone] = useState( localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess() ); const { t } = useLocale(); const [frequency, setFrequency] = useState<15 | 30 | 60>(30); useEffect(() => { utils.invalidateQueries(["viewer.teams.getMemberAvailability"]); }, [utils, selectedTimeZone, selectedDate]); return ( <>
{props.member?.name}
{t("availability")}
{ setSelectedDate(dayjs(newDate)); }} /> setSelectedTimeZone(timezone.value)} classNamePrefix="react-select" />