Scheduling infrastructure for absolutely everyone.
feat: add toggle for no availability dialog (#23052)
Somay Chauhanfc2e81e89a6e
diff --git a/.changeset/great-hands-lick.md b/.changeset/great-hands-lick.mdnew file mode 100644index 00000000000..c75a4aaaa9f--- /dev/null+++ b/.changeset/great-hands-lick.md@@ -0,0 +1,5 @@+---+"@calcom/atoms": minor+---++Added showNoAvailabilityDialog prop to the Booker atom – a Boolean that controls whether the 'no availability' dialog is displayed\ No newline at end of filediff --git a/docs/platform/atoms/booker.mdx b/docs/platform/atoms/booker.mdxindex e6a2e52bd91..ac7ca3c000b 100644--- a/docs/platform/atoms/booker.mdx+++ b/docs/platform/atoms/booker.mdx@@ -127,6 +127,7 @@ Below is a list of props that can be passed to the booker atom.| timeZones | No | Array of valid IANA timezones to be used in the booker. Eg. ["Asia/Kolkata", "Europe/London"] || onTimeslotsLoaded | No | Callback function triggered once the available timeslots have been fetched. || roundRobinHideOrgAndTeam | No | Boolean indicating if the organization and team should be hidden in the booker atom sidebar for round robin scheduling type, defaults to false. |+| showNoAvailabilityDialog | No | Boolean indicating if the no availability dialog should be shown, defaults to true. |## Stylingdiff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsxindex 1c6e4e16604..d7dd3671577 100644--- a/packages/features/bookings/Booker/Booker.tsx+++ b/packages/features/bookings/Booker/Booker.tsx@@ -81,6 +81,7 @@ const BookerComponent = ({timeZones,eventMetaChildren,roundRobinHideOrgAndTeam,+ showNoAvailabilityDialog,}: BookerProps & WrappedBookerProps) => {const searchParams = useCompatSearchParams();const isPlatformBookerEmbed = useIsPlatformBookerEmbed();@@ -417,6 +418,7 @@ const BookerComponent = ({slots={schedule?.data?.slots}isLoading={schedule.isPending}scrollToTimeSlots={scrollToTimeSlots}+ showNoAvailabilityDialog={showNoAvailabilityDialog}/></div>)}@@ -445,6 +447,7 @@ const BookerComponent = ({slots={schedule?.data?.slots}isLoading={schedule.isPending}scrollToTimeSlots={scrollToTimeSlots}+ showNoAvailabilityDialog={showNoAvailabilityDialog}/></BookerSection>diff --git a/packages/features/bookings/Booker/components/DatePicker.tsx b/packages/features/bookings/Booker/components/DatePicker.tsxindex 6ef0afe42e4..cf257b5c735 100644--- a/packages/features/bookings/Booker/components/DatePicker.tsx+++ b/packages/features/bookings/Booker/components/DatePicker.tsx@@ -57,6 +57,7 @@ export const DatePicker = ({isLoading,classNames,scrollToTimeSlots,+ showNoAvailabilityDialog,}: {event: {data?: {@@ -72,6 +73,7 @@ export const DatePicker = ({isLoading?: boolean;classNames?: DatePickerClassNames;scrollToTimeSlots?: () => void;+ showNoAvailabilityDialog?: boolean;}) => {const { i18n } = useLocale();const [month, selectedDate, layout] = useBookerStore(@@ -148,6 +150,7 @@ export const DatePicker = ({scrollToTimeSlots={scrollToTimeSlots}periodData={periodData}isCompact={isCompact}+ showNoAvailabilityDialog={showNoAvailabilityDialog}/>);};diff --git a/packages/features/bookings/Booker/types.ts b/packages/features/bookings/Booker/types.tsindex 45748a81384..02fc4343626 100644--- a/packages/features/bookings/Booker/types.ts+++ b/packages/features/bookings/Booker/types.ts@@ -98,6 +98,7 @@ export interface BookerProps {hashedLink?: string | null;isInstantMeeting?: boolean;teamMemberEmail?: string | null;+ showNoAvailabilityDialog?: boolean;crmOwnerRecordType?: string | null;crmAppSlug?: string | null;crmRecordId?: string | null;diff --git a/packages/features/calendars/DatePicker.tsx b/packages/features/calendars/DatePicker.tsxindex ef91d8f6063..e3fea1fba13 100644--- a/packages/features/calendars/DatePicker.tsx+++ b/packages/features/calendars/DatePicker.tsx@@ -59,6 +59,8 @@ export type DatePickerProps = {periodData?: PeriodData;// Whether this is a compact sidebar view or main monthly viewisCompact?: boolean;+ // Whether to show the no availability dialog+ showNoAvailabilityDialog?: boolean;};const Day = ({@@ -164,6 +166,7 @@ const Days = ({isBookingInPast,periodData,isCompact,+ showNoAvailabilityDialog = true,...props}: Omit<DatePickerProps, "locale" | "className" | "weekStart"> & {DayComponent?: React.FC<React.ComponentProps<typeof Day>>;@@ -345,14 +348,18 @@ const Days = ({)}</div>))}- {!props.isLoading && !isBookingInPast && includedDates && includedDates?.length === 0 && (- <NoAvailabilityDialog- month={month}- nextMonthButton={nextMonthButton}- browsingDate={browsingDate}- periodData={periodData}- />- )}+ {!props.isLoading &&+ !isBookingInPast &&+ includedDates &&+ includedDates?.length === 0 &&+ showNoAvailabilityDialog && (+ <NoAvailabilityDialog+ month={month}+ nextMonthButton={nextMonthButton}+ browsingDate={browsingDate}+ periodData={periodData}+ />+ )}</>);};@@ -374,6 +381,7 @@ const DatePicker = ({periodType: "UNLIMITED",},isCompact,+ showNoAvailabilityDialog,...passThroughProps}: DatePickerProps &Partial<React.ComponentProps<typeof Days>> & {@@ -484,6 +492,7 @@ const DatePicker = ({isBookingInPast={isBookingInPast}periodData={periodData}isCompact={isCompact}+ showNoAvailabilityDialog={showNoAvailabilityDialog}/></div></div>diff --git a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx b/packages/platform/atoms/booker/BookerPlatformWrapper.tsxindex 84ee9e2fa09..ddee3f25ba5 100644--- a/packages/platform/atoms/booker/BookerPlatformWrapper.tsx+++ b/packages/platform/atoms/booker/BookerPlatformWrapper.tsx@@ -58,6 +58,7 @@ export const BookerPlatformWrapper = (handleSlotReservation,onTimeslotsLoaded,startTime: customStartTime,+ showNoAvailabilityDialog,} = props;const layout = BookerLayouts[view];@@ -465,6 +466,7 @@ export const BookerPlatformWrapper = (customClassNames={props.customClassNames}eventSlug={props.eventSlug}username={username}+ showNoAvailabilityDialog={showNoAvailabilityDialog}entity={event?.data?.entity ?? {considerUnpublished: false,