feat: Schedule restriction and booker timezone (#21452)

* init migration and fix name for team event availability toggle

* show and save restriction schedule

* better naming around

* fix loading stored restricted schedule instead of default

* add the booker timezone checkbox in the form

* restriction schedule application babbbyyyy

* remove logs

* test

* typefix

* fix

* fix??

* fix???

* ---

* typefix

* functional fix

* restrictionschedule logic --1

* timezone adjustment for regular constraint

* noice

* test suite for restrictionSchedule

* auth restrictionschedule for eventtype

* remove unnecessary comments

* index

* type fix

* add concurrent

* resolve change request

* fix unauth erro

* type fix

* schedule select extracted from select

* revert

* fix auth vulnerabililty

* fix e22

* chore: hide restriction schedule on platform

* init review feedback resolutions

* fixes

* fix type

* multiple windows of recurring rule-same day

* team feature flag

* fix type err

* fix type

* improvements

* fix test

* improve

* fix error propagation

* fix unused var lint

* cleanup and using buildDateRanges

* travel schedule inclusion

* address comment

---------

Co-authored-by: supalarry <[email protected]>
This commit is contained in:
Syed Ali Shahbazandsupalarry authored and GitHub committed 2025-06-19 14:08:51 +01:00
1 parent 3bea03f4b1
commit e160a4add0
28 files changed
+1307 -73

No files matched your search

@@ -22,6 +22,7 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperPro
const { t } = useLocale();
const formMethods = useFormContext<FormValues>();
const scheduleId = formMethods.watch("schedule");
const restrictionScheduleId = formMethods.watch("restrictionScheduleId");
const { isManagedEventType, isChildrenManagedEventType } = useLockedFieldsManager({
eventType: props.eventType,
@@ -39,6 +40,15 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperPro
{ enabled: !!scheduleId || (!props.isTeamEvent && !!props.user?.defaultScheduleId) }
);
const { isPending: isRestrictionSchedulePending, data: restrictionScheduleQueryData } =
trpc.viewer.availability.schedule.get.useQuery(
{
scheduleId: restrictionScheduleId || undefined,
isManagedEventType: isManagedEventType || isChildrenManagedEventType,
},
{ enabled: !!restrictionScheduleId }
);
const { data: schedulesQueryData, isPending: isSchedulesPending } =
trpc.viewer.availability.list.useQuery(undefined);
@@ -51,7 +61,10 @@ const EventAvailabilityTabWebWrapper = (props: EventAvailabilityTabWebWrapperPro
isSchedulesPending={isSchedulesPending}
isSchedulePending={isSchedulePending}
scheduleQueryData={scheduleQueryData}
restrictionScheduleQueryData={restrictionScheduleQueryData}
isRestrictionSchedulePending={isRestrictionSchedulePending}
editAvailabilityRedirectUrl={`/availability/${scheduleQueryData?.id}`}
restrictionScheduleRedirectUrl={`/availability/${restrictionScheduleQueryData?.id}`}
hostSchedulesQuery={hostSchedulesQuery}
/>
);