diff --git a/apps/web/modules/event-types/components/AddMembersWithSwitch.tsx b/apps/web/modules/event-types/components/AddMembersWithSwitch.tsx index 216487786398d1..a9f1f59bb91e01 100644 --- a/apps/web/modules/event-types/components/AddMembersWithSwitch.tsx +++ b/apps/web/modules/event-types/components/AddMembersWithSwitch.tsx @@ -32,7 +32,7 @@ interface IUserToValue { } export const mapUserToValue = ( - { id, name, username, avatar, email, defaultScheduleId }: IUserToValue, + { id, name, username, avatar, email, defaultScheduleId, isOptional }: IUserToValue & { isOptional?: boolean }, pendingString: string ) => ({ value: `${id || ""}`, @@ -40,6 +40,7 @@ export const mapUserToValue = ( avatar, email, defaultScheduleId, + isOptional: isOptional || false, }); const sortByLabel = (a: ReturnType, b: ReturnType) => { diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 8890fa435505ca..08356163275419 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -4656,5 +4656,7 @@ "paypal_step_7": "You should be all set up after this.", "dashboard": "dashboard", "paypal_webhook_reminder": "Our integration creates a specific webhook on your PayPal account that we use to report back transactions to our system. If you delete this webhook, we will not be able to report back and you should uninstall and install the app again for this to work properly. Uninstalling the app won't delete your current event type price/currency configuration but you will not be able to receive bookings.", + "make_optional": "Make optional", + "make_required": "Make required", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts b/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts index 0dc5dfbb6e600d..8e4ba2c3a14acb 100644 --- a/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts +++ b/packages/features/availability/lib/getAggregatedAvailability/getAggregatedAvailability.ts @@ -26,7 +26,7 @@ export const getAggregatedAvailability = ( userAvailability: { dateRanges: DateRange[]; oooExcludedDateRanges: DateRange[]; - user?: { isFixed?: boolean; groupId?: string | null }; + user?: { isFixed?: boolean; groupId?: string | null; isOptional?: boolean }; }[], schedulingType: SchedulingType | null ): DateRange[] => { @@ -36,14 +36,14 @@ export const getAggregatedAvailability = ( userAvailability.length > 1; const fixedHosts = userAvailability.filter( - ({ user }) => !schedulingType || schedulingType === SchedulingType.COLLECTIVE || user?.isFixed + ({ user }) => (!schedulingType || schedulingType === SchedulingType.COLLECTIVE || user?.isFixed) && !user?.isOptional ); const fixedDateRanges = mergeOverlappingDateRanges( intersect(fixedHosts.map((s) => (!isTeamEvent ? s.dateRanges : s.oooExcludedDateRanges))) ); const dateRangesToIntersect = fixedDateRanges.length ? [fixedDateRanges] : []; - const roundRobinHosts = userAvailability.filter(({ user }) => user?.isFixed !== true); + const roundRobinHosts = userAvailability.filter(({ user }) => user?.isFixed !== true && !user?.isOptional); if (roundRobinHosts.length) { // Group round robin hosts by their groupId const hostsByGroup = roundRobinHosts.reduce( diff --git a/packages/features/eventtypes/components/CheckedTeamSelect.tsx b/packages/features/eventtypes/components/CheckedTeamSelect.tsx index 7b27d319b5a0c4..1fc7e7fd32865e 100644 --- a/packages/features/eventtypes/components/CheckedTeamSelect.tsx +++ b/packages/features/eventtypes/components/CheckedTeamSelect.tsx @@ -28,6 +28,7 @@ export type CheckedSelectOption = { priority?: number; weight?: number; isFixed?: boolean; + isOptional?: boolean; disabled?: boolean; defaultScheduleId?: number | null; groupId: string | null; @@ -136,6 +137,23 @@ export const CheckedTeamSelect = ({
{option && !option.isFixed ? ( <> + + +