Skip to content

Commit fc2e81e

Browse files
authored
feat: add toggle for no availability dialog (#23052)
* feat: add toggle for no availability dialog * Create great-hands-lick.md * fix: correct spelling from showNoAvailabilityDailog to showNoAvailabilityDialog * remove comment and redundant
1 parent 293dd1a commit fc2e81e

File tree

7 files changed

+32
-8
lines changed

7 files changed

+32
-8
lines changed

.changeset/great-hands-lick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@calcom/atoms": minor
3+
---
4+
5+
Added showNoAvailabilityDialog prop to the Booker atom – a Boolean that controls whether the 'no availability' dialog is displayed

docs/platform/atoms/booker.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Below is a list of props that can be passed to the booker atom.
127127
| timeZones | No | Array of valid IANA timezones to be used in the booker. Eg. ["Asia/Kolkata", "Europe/London"] |
128128
| onTimeslotsLoaded | No | Callback function triggered once the available timeslots have been fetched. |
129129
| 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. |
130+
| showNoAvailabilityDialog | No | Boolean indicating if the no availability dialog should be shown, defaults to true. |
130131

131132
## Styling
132133

packages/features/bookings/Booker/Booker.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const BookerComponent = ({
8181
timeZones,
8282
eventMetaChildren,
8383
roundRobinHideOrgAndTeam,
84+
showNoAvailabilityDialog,
8485
}: BookerProps & WrappedBookerProps) => {
8586
const searchParams = useCompatSearchParams();
8687
const isPlatformBookerEmbed = useIsPlatformBookerEmbed();
@@ -417,6 +418,7 @@ const BookerComponent = ({
417418
slots={schedule?.data?.slots}
418419
isLoading={schedule.isPending}
419420
scrollToTimeSlots={scrollToTimeSlots}
421+
showNoAvailabilityDialog={showNoAvailabilityDialog}
420422
/>
421423
</div>
422424
)}
@@ -445,6 +447,7 @@ const BookerComponent = ({
445447
slots={schedule?.data?.slots}
446448
isLoading={schedule.isPending}
447449
scrollToTimeSlots={scrollToTimeSlots}
450+
showNoAvailabilityDialog={showNoAvailabilityDialog}
448451
/>
449452
</BookerSection>
450453

packages/features/bookings/Booker/components/DatePicker.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const DatePicker = ({
5757
isLoading,
5858
classNames,
5959
scrollToTimeSlots,
60+
showNoAvailabilityDialog,
6061
}: {
6162
event: {
6263
data?: {
@@ -72,6 +73,7 @@ export const DatePicker = ({
7273
isLoading?: boolean;
7374
classNames?: DatePickerClassNames;
7475
scrollToTimeSlots?: () => void;
76+
showNoAvailabilityDialog?: boolean;
7577
}) => {
7678
const { i18n } = useLocale();
7779
const [month, selectedDate, layout] = useBookerStore(
@@ -148,6 +150,7 @@ export const DatePicker = ({
148150
scrollToTimeSlots={scrollToTimeSlots}
149151
periodData={periodData}
150152
isCompact={isCompact}
153+
showNoAvailabilityDialog={showNoAvailabilityDialog}
151154
/>
152155
);
153156
};

packages/features/bookings/Booker/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export interface BookerProps {
9898
hashedLink?: string | null;
9999
isInstantMeeting?: boolean;
100100
teamMemberEmail?: string | null;
101+
showNoAvailabilityDialog?: boolean;
101102
crmOwnerRecordType?: string | null;
102103
crmAppSlug?: string | null;
103104
crmRecordId?: string | null;

packages/features/calendars/DatePicker.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export type DatePickerProps = {
5959
periodData?: PeriodData;
6060
// Whether this is a compact sidebar view or main monthly view
6161
isCompact?: boolean;
62+
// Whether to show the no availability dialog
63+
showNoAvailabilityDialog?: boolean;
6264
};
6365

6466
const Day = ({
@@ -164,6 +166,7 @@ const Days = ({
164166
isBookingInPast,
165167
periodData,
166168
isCompact,
169+
showNoAvailabilityDialog = true,
167170
...props
168171
}: Omit<DatePickerProps, "locale" | "className" | "weekStart"> & {
169172
DayComponent?: React.FC<React.ComponentProps<typeof Day>>;
@@ -345,14 +348,18 @@ const Days = ({
345348
)}
346349
</div>
347350
))}
348-
{!props.isLoading && !isBookingInPast && includedDates && includedDates?.length === 0 && (
349-
<NoAvailabilityDialog
350-
month={month}
351-
nextMonthButton={nextMonthButton}
352-
browsingDate={browsingDate}
353-
periodData={periodData}
354-
/>
355-
)}
351+
{!props.isLoading &&
352+
!isBookingInPast &&
353+
includedDates &&
354+
includedDates?.length === 0 &&
355+
showNoAvailabilityDialog && (
356+
<NoAvailabilityDialog
357+
month={month}
358+
nextMonthButton={nextMonthButton}
359+
browsingDate={browsingDate}
360+
periodData={periodData}
361+
/>
362+
)}
356363
</>
357364
);
358365
};
@@ -374,6 +381,7 @@ const DatePicker = ({
374381
periodType: "UNLIMITED",
375382
},
376383
isCompact,
384+
showNoAvailabilityDialog,
377385
...passThroughProps
378386
}: DatePickerProps &
379387
Partial<React.ComponentProps<typeof Days>> & {
@@ -484,6 +492,7 @@ const DatePicker = ({
484492
isBookingInPast={isBookingInPast}
485493
periodData={periodData}
486494
isCompact={isCompact}
495+
showNoAvailabilityDialog={showNoAvailabilityDialog}
487496
/>
488497
</div>
489498
</div>

packages/platform/atoms/booker/BookerPlatformWrapper.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const BookerPlatformWrapper = (
5858
handleSlotReservation,
5959
onTimeslotsLoaded,
6060
startTime: customStartTime,
61+
showNoAvailabilityDialog,
6162
} = props;
6263
const layout = BookerLayouts[view];
6364

@@ -465,6 +466,7 @@ export const BookerPlatformWrapper = (
465466
customClassNames={props.customClassNames}
466467
eventSlug={props.eventSlug}
467468
username={username}
469+
showNoAvailabilityDialog={showNoAvailabilityDialog}
468470
entity={
469471
event?.data?.entity ?? {
470472
considerUnpublished: false,

0 commit comments

Comments
 (0)