import React, { useState, useEffect, CSSProperties } from "react"; import AutoSizer from "react-virtualized-auto-sizer"; import { FixedSizeList as List } from "react-window"; import dayjs from "@calcom/dayjs"; import { CAL_URL } from "@calcom/lib/constants"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import Select from "@calcom/ui/form/Select"; import TimezoneSelect, { ITimezone } from "@calcom/ui/form/TimezoneSelect"; import { Avatar } from "@calcom/ui/v2"; import DatePicker from "@calcom/ui/v2/core/form/DatePicker"; import TeamAvailabilityTimes from "./TeamAvailabilityTimes"; interface Props { team?: inferQueryOutput<"viewer.teams.get">; } export default function TeamAvailabilityScreen(props: Props) { const utils = trpc.useContext(); const [selectedDate, setSelectedDate] = useState(dayjs()); const [selectedTimeZone, setSelectedTimeZone] = useState( localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess() ); const [frequency, setFrequency] = useState<15 | 30 | 60>(30); useEffect(() => { utils.invalidateQueries(["viewer.teams.getMemberAvailability"]); // eslint-disable-next-line react-hooks/exhaustive-deps }, [selectedTimeZone, selectedDate]); const Item = ({ index, style }: { index: number; style: CSSProperties }) => { const member = props.team?.members?.[index]; if (!member) return <>; return (
{member?.name} {member?.email}
} /> ); }; return (
Date { setSelectedDate(dayjs(newDate)); }} />
Timezone setSelectedTimeZone(timezone.value)} classNamePrefix="react-select" className="react-select-container w-full rounded-sm border border-gray-300 text-sm" />
Slot Length