import Link from "next/link"; import { Fragment } from "react"; import { availabilityAsString } from "@calcom/lib/availability"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import type { RouterOutputs } from "@calcom/trpc/react"; import { trpc } from "@calcom/trpc/react"; import { Badge, Button, Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownItem, DropdownMenuTrigger, showToast, } from "@calcom/ui"; import { Globe, MoreHorizontal, Trash, Clock, Copy } from "@calcom/ui/components/icon"; export function ScheduleListItem({ schedule, deleteFunction, displayOptions, updateDefault, isDeletable, duplicateFunction, }: { schedule: RouterOutputs["viewer"]["availability"]["list"]["schedules"][number]; deleteFunction: ({ scheduleId }: { scheduleId: number }) => void; displayOptions?: { timeZone?: string; hour12?: boolean; }; isDeletable: boolean; updateDefault: ({ scheduleId, isDefault }: { scheduleId: number; isDefault: boolean }) => void; duplicateFunction: ({ scheduleId }: { scheduleId: number }) => 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 .filter((availability) => !!availability.days.length) .map((availability) => ( {availabilityAsString(availability, { locale: i18n.language, hour12: displayOptions?.hour12, })}
    ))} {(schedule.timeZone || displayOptions?.timeZone) && (

     {schedule.timeZone ?? displayOptions?.timeZone}

    )}

  • ); }