Scheduling infrastructure for absolutely everyone.
fix: add sortByLabel (#6797)
Udit Takkara46a31040a8c
diff --git a/apps/web/components/eventtype/EventTeamTab.tsx b/apps/web/components/eventtype/EventTeamTab.tsxindex 7835c3d0005..afe0b0ba49b 100644--- a/apps/web/components/eventtype/EventTeamTab.tsx+++ b/apps/web/components/eventtype/EventTeamTab.tsx@@ -25,6 +25,16 @@ const mapUserToValue = ({ id, name, username, email }: IMemberToValue) => ({email,});+const sortByLabel = (a: ReturnType<typeof mapUserToValue>, b: ReturnType<typeof mapUserToValue>) => {+ if (a.label < b.label) {+ return -1;+ }+ if (a.label > b.label) {+ return 1;+ }+ return 0;+};+const FixedHosts = ({control,labelText,@@ -103,7 +113,6 @@ export const EventTeamTab = ({ team, teamMembers }: Pick<EventTypeSetupProps, "t];const teamMembersOptions = teamMembers.map(mapUserToValue);-return (<div>{team && (@@ -128,17 +137,16 @@ export const EventTeamTab = ({ team, teamMembers }: Pick<EventTypeSetupProps, "t{schedulingType === SchedulingType.COLLECTIVE && (<FixedHosts- options={teamMembersOptions}+ options={teamMembersOptions.sort(sortByLabel)}placeholder={t("add_attendees")}labelText={t("team")}control={formMethods.control}/>)}-{schedulingType === SchedulingType.ROUND_ROBIN && (<><FixedHosts- options={teamMembersOptions}+ options={teamMembersOptions.sort(sortByLabel)}isOptionDisabled={(option) =>!!formMethods.getValues("hosts").find((host) => host.userId.toString() === option.value)}@@ -173,7 +181,7 @@ export const EventTeamTab = ({ team, teamMembers }: Pick<EventTypeSetupProps, "t).filter(Boolean)}controlShouldRenderValue={false}- options={teamMembers.map(mapUserToValue)}+ options={teamMembersOptions.sort(sortByLabel)}isOptionDisabled={(option) =>!!formMethods.getValues("hostsFixed")