CAL-300 Ensure we show the default calendar name based in the advanced tab for event types. (#5551)
parent
fac0b0fa32
commit
112efbbda2
|
@ -74,6 +74,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupInfered
|
||||||
defaultValue={eventType.destinationCalendar || undefined}
|
defaultValue={eventType.destinationCalendar || undefined}
|
||||||
render={({ field: { onChange, value } }) => (
|
render={({ field: { onChange, value } }) => (
|
||||||
<DestinationCalendarSelector
|
<DestinationCalendarSelector
|
||||||
|
destinationCalendar={eventType.destinationCalendar}
|
||||||
value={value ? value.externalId : undefined}
|
value={value ? value.externalId : undefined}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
hidePlaceholder
|
hidePlaceholder
|
||||||
|
|
|
@ -115,6 +115,11 @@ const DestinationCalendarSelector = ({
|
||||||
value: `${cal.integration}:${cal.externalId}`,
|
value: `${cal.integration}:${cal.externalId}`,
|
||||||
})),
|
})),
|
||||||
})) ?? [];
|
})) ?? [];
|
||||||
|
|
||||||
|
// Get primary calendar, which is shown in the placeholder since this is the calendar that will
|
||||||
|
// be used when no destination calendar is selected.
|
||||||
|
const primaryCalendar = query.data.connectedCalendars.filter((cal) => Boolean(cal.primary))[0];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative" title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
|
<div className="relative" title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
|
||||||
<Select
|
<Select
|
||||||
|
@ -124,7 +129,8 @@ const DestinationCalendarSelector = ({
|
||||||
`${t("select_destination_calendar")}`
|
`${t("select_destination_calendar")}`
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
{t("default_calendar_selected")} ({destinationCalendar?.externalId})
|
{t("default_calendar_selected")}{" "}
|
||||||
|
{primaryCalendar?.primary?.externalId && `(${primaryCalendar?.primary?.externalId})`}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue