import Link from "next/link"; import { Fragment } from "react"; import { availabilityAsString } from "@calcom/lib/availability"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Availability } from "@calcom/prisma/client"; import { RouterOutputs } from "@calcom/trpc/react"; import { trpc } from "@calcom/trpc/react"; import { Schedule } from "@calcom/types/schedule"; import { Badge, Button, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Icon, } from "@calcom/ui"; export function ScheduleListItem({ schedule, deleteFunction, displayOptions, updateDefault, }: { schedule: RouterOutputs["viewer"]["availability"]["list"]["schedules"][number]; deleteFunction: ({ scheduleId }: { scheduleId: number }) => void; displayOptions?: { timeZone?: string; hour12?: boolean; }; updateDefault: ({ scheduleId, isDefault, schedule, }: { scheduleId: number; isDefault: boolean; schedule: Schedule; }) => void; }) { const { t, i18n } = useLocale(); const { data, isLoading } = trpc.viewer.availability.schedule.get.useQuery({ scheduleId: schedule.id }); return (
  • {schedule.name} {schedule.isDefault && ( {t("default")} )}

    {schedule.availability.map((availability: Availability) => ( {availabilityAsString(availability, { locale: i18n.language, hour12: displayOptions?.hour12, })}
    ))} {schedule.timeZone && schedule.timeZone !== displayOptions?.timeZone && (

     {schedule.timeZone}

    )}

    )} )}
  • ); }