import Link from "next/link"; import { Fragment } from "react"; import { availabilityAsString } from "@calcom/lib/availability"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { RouterOutputs } from "@calcom/trpc/react"; import { trpc } from "@calcom/trpc/react"; import { Badge, Button, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuTrigger, } from "@calcom/ui"; import { FiGlobe, FiMoreHorizontal, FiTrash } from "@calcom/ui/components/icon"; 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 }: { scheduleId: number; isDefault: boolean }) => 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.timeZone || displayOptions?.timeZone) && (

     {schedule.timeZone ?? displayOptions?.timeZone}

    )} {schedule.availability .filter((availability) => !!availability.days.length) .map((availability) => ( {availabilityAsString(availability, { locale: i18n.language, hour12: displayOptions?.hour12, })}
    ))}

  • ); }