diff --git a/packages/atoms/availabilitylist/Availability.tsx b/packages/atoms/availabilitylist/Availability.tsx index 0bee8d2400..39d71ea874 100644 --- a/packages/atoms/availabilitylist/Availability.tsx +++ b/packages/atoms/availabilitylist/Availability.tsx @@ -14,14 +14,7 @@ import { Fragment } from "react"; import { availabilityAsString } from "@calcom/lib/availability"; -export function Availability({ - schedule, - isDeletable, - displayOptions, - updateDefault, - duplicateFunction, - deleteFunction, -}: { +type AvailabilityProps = { schedule: Schedule; isDeletable: boolean; updateDefault: ({ scheduleId, isDefault }: { scheduleId: number; isDefault: boolean }) => void; @@ -31,7 +24,16 @@ export function Availability({ timeZone?: string; hour12?: boolean; }; -}) { +}; + +export function Availability({ + schedule, + isDeletable, + displayOptions, + updateDefault, + duplicateFunction, + deleteFunction, +}: AvailabilityProps) { const { toast } = useToast(); return ( diff --git a/packages/atoms/availabilitylist/AvailabilityList.tsx b/packages/atoms/availabilitylist/AvailabilityList.tsx index feb03c985f..6b9cb9fcd4 100644 --- a/packages/atoms/availabilitylist/AvailabilityList.tsx +++ b/packages/atoms/availabilitylist/AvailabilityList.tsx @@ -23,13 +23,7 @@ export type Schedule = { timezone?: string; }; -export function AvailabilityList({ - schedules, - onCreateMutation, - updateMutation, - duplicateMutation, - deleteMutation, -}: { +type AvailabilityListProps = { schedules: Schedule[] | []; onCreateMutation: (values: { onSucess: (schedule: Schedule) => void; @@ -38,7 +32,15 @@ export function AvailabilityList({ updateMutation: ({ scheduleId, isDefault }: { scheduleId: number; isDefault: boolean }) => void; duplicateMutation: ({ scheduleId }: { scheduleId: number }) => void; deleteMutation: ({ scheduleId }: { scheduleId: number }) => void; -}) { +}; + +export function AvailabilityList({ + schedules, + onCreateMutation, + updateMutation, + duplicateMutation, + deleteMutation, +}: AvailabilityListProps) { if (schedules.length === 0) { return (
diff --git a/packages/atoms/availabilitylist/EmptyScreen.tsx b/packages/atoms/availabilitylist/EmptyScreen.tsx index 791f0dc4c2..6cf320e20d 100644 --- a/packages/atoms/availabilitylist/EmptyScreen.tsx +++ b/packages/atoms/availabilitylist/EmptyScreen.tsx @@ -6,6 +6,18 @@ import React from "react"; import { classNames } from "@calcom/lib"; import type { SVGComponent } from "@calcom/types/SVGComponent"; +type EmptyScreenProps = { + Icon?: SVGComponent | IconType; + avatar?: React.ReactElement; + headline: string | React.ReactElement; + description?: string | React.ReactElement; + buttonText?: string; + buttonOnClick?: (event: React.MouseEvent) => void; + buttonRaw?: ReactNode; // Used incase you want to provide your own button. + border?: boolean; + dashedBorder?: boolean; +}; + export function EmptyScreen({ Icon, avatar, @@ -17,17 +29,7 @@ export function EmptyScreen({ border = true, dashedBorder = true, className, -}: { - Icon?: SVGComponent | IconType; - avatar?: React.ReactElement; - headline: string | React.ReactElement; - description?: string | React.ReactElement; - buttonText?: string; - buttonOnClick?: (event: React.MouseEvent) => void; - buttonRaw?: ReactNode; // Used incase you want to provide your own button. - border?: boolean; - dashedBorder?: boolean; -} & React.HTMLAttributes) { +}: EmptyScreenProps & React.HTMLAttributes) { return ( <>
void; onError: (err: HttpError) => void; }) => void; -}) { +}; + +export function NewScheduleButton({ name = "new-schedule", createMutation }: NewScheduleButtonProps) { const form = useForm<{ name: string; }>();