Scheduling infrastructure for absolutely everyone.
refactor: event type settings (#11539)
Udit Takkaref45cbfb3ff7
diff --git a/apps/web/components/eventtype/EventAdvancedTab.tsx b/apps/web/components/eventtype/EventAdvancedTab.tsxindex c95d28a4f93..9379776d510 100644--- a/apps/web/components/eventtype/EventAdvancedTab.tsx+++ b/apps/web/components/eventtype/EventAdvancedTab.tsx@@ -34,7 +34,7 @@ import {TextField,Tooltip,} from "@calcom/ui";-import { Copy, Edit } from "@calcom/ui/components/icon";+import { Copy, Edit, Info } from "@calcom/ui/components/icon";import { IS_VISUAL_REGRESSION_TESTING } from "@calcom/web/constants";import RequiresConfirmationController from "./RequiresConfirmationController";@@ -124,79 +124,81 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,const setEventName = (value: string) => formMethods.setValue("eventName", value);return (- <div className="flex flex-col space-y-8">+ <div className="flex flex-col space-y-4">{/*** Only display calendar selector if user has connected calendars AND if it's not* a team event. Since we don't have logic to handle each attendee calendar (for now).* This will fallback to each user selected destination calendar.*/}- {!!connectedCalendarsQuery.data?.connectedCalendars.length && !team && (- <div className="flex flex-col">- <div className="flex justify-between">- <Label>{t("add_to_calendar")}</Label>- <Link- href="/apps/categories/calendar"- target="_blank"- className="hover:text-emphasis text-default text-sm">- {t("add_another_calendar")}- </Link>- </div>- <div className="-mt-1 w-full">- <Controller- control={formMethods.control}- name="destinationCalendar"- defaultValue={eventType.destinationCalendar || undefined}- render={({ field: { onChange, value } }) => (- <DestinationCalendarSelector- destinationCalendar={eventType.destinationCalendar}- value={value ? value.externalId : undefined}- onChange={onChange}- hidePlaceholder- />- )}- />+ <div className="border-subtle space-y-6 rounded-md border p-6">+ {!!connectedCalendarsQuery.data?.connectedCalendars.length && !team && (+ <div className="flex flex-col">+ <div className="flex justify-between">+ <Label className="font-medium">{t("add_to_calendar")}</Label>+ <Link+ href="/apps/categories/calendar"+ target="_blank"+ className="hover:text-emphasis text-default text-sm">+ {t("add_another_calendar")}+ </Link>+ </div>+ <div className="-mt-1 w-full">+ <Controller+ control={formMethods.control}+ name="destinationCalendar"+ defaultValue={eventType.destinationCalendar || undefined}+ render={({ field: { onChange, value } }) => (+ <DestinationCalendarSelector+ destinationCalendar={eventType.destinationCalendar}+ value={value ? value.externalId : undefined}+ onChange={onChange}+ hidePlaceholder+ />+ )}+ />+ </div>+ <p className="text-subtle text-sm">{t("select_which_cal")}</p></div>- <p className="text-default text-sm">{t("select_which_cal")}</p>+ )}+ <div className="w-full">+ <TextField+ label={t("event_name_in_calendar")}+ type="text"+ {...shouldLockDisableProps("eventName")}+ placeholder={eventNamePlaceholder}+ defaultValue={eventType.eventName || ""}+ {...formMethods.register("eventName")}+ addOnSuffix={+ <Button+ color="minimal"+ size="sm"+ aria-label="edit custom name"+ className="hover:stroke-3 hover:text-emphasis min-w-fit !py-0 px-0 hover:bg-transparent"+ onClick={() => setShowEventNameTip((old) => !old)}>+ <Edit className="h-4 w-4" />+ </Button>+ }+ /></div>- )}- <div className="w-full">- <TextField- label={t("event_name_in_calendar")}- type="text"- {...shouldLockDisableProps("eventName")}- placeholder={eventNamePlaceholder}- defaultValue={eventType.eventName || ""}- {...formMethods.register("eventName")}- addOnSuffix={- <Button- color="minimal"- size="sm"- aria-label="edit custom name"- className="hover:stroke-3 hover:text-emphasis min-w-fit !py-0 px-0 hover:bg-transparent"- onClick={() => setShowEventNameTip((old) => !old)}>- <Edit className="h-4 w-4" />- </Button>- }- /></div>- <hr className="border-subtle [&:has(+div:empty)]:hidden" />- <div>- <BookerLayoutSelector fallbackToUserSettings isDark={selectedThemeIsDark} />++ <BookerLayoutSelector fallbackToUserSettings isDark={selectedThemeIsDark} />++ <div className="border-subtle space-y-6 rounded-md border p-6">+ <FormBuilder+ title={t("booking_questions_title")}+ description={t("booking_questions_description")}+ addFieldLabel={t("add_a_booking_question")}+ formProp="bookingFields"+ {...shouldLockDisableProps("bookingFields")}+ dataStore={{+ options: {+ locations: getLocationsOptionsForSelect(eventType?.locations ?? [], t),+ },+ }}+ /></div>- <hr className="border-subtle" />- <FormBuilder- title={t("booking_questions_title")}- description={t("booking_questions_description")}- addFieldLabel={t("add_a_booking_question")}- formProp="bookingFields"- {...shouldLockDisableProps("bookingFields")}- dataStore={{- options: {- locations: getLocationsOptionsForSelect(eventType?.locations ?? [], t),- },- }}- />- <hr className="border-subtle" />+<RequiresConfirmationControllereventType={eventType}seatsEnabled={seatsEnabled}@@ -204,13 +206,15 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,requiresConfirmation={requiresConfirmation}onRequiresConfirmation={setRequiresConfirmation}/>- <hr className="border-subtle" />+<Controllername="requiresBookerEmailVerification"control={formMethods.control}defaultValue={eventType.requiresBookerEmailVerification}render={({ field: { value, onChange } }) => (<SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName="border-subtle rounded-md border py-6 px-4 sm:px-6"title={t("requires_booker_email_verification")}{...shouldLockDisableProps("requiresBookerEmailVerification")}description={t("description_requires_booker_email_verification")}@@ -219,13 +223,15 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,/>)}/>- <hr className="border-subtle" />+<Controllername="hideCalendarNotes"control={formMethods.control}defaultValue={eventType.hideCalendarNotes}render={({ field: { value, onChange } }) => (<SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName="border-subtle rounded-md border py-6 px-4 sm:px-6"title={t("disable_notes")}{...shouldLockDisableProps("hideCalendarNotes")}description={t("disable_notes_description")}@@ -234,13 +240,19 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,/>)}/>- <hr className="border-subtle" />+<Controllername="successRedirectUrl"control={formMethods.control}render={({ field: { value, onChange } }) => (<><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle rounded-md border py-6 px-4 sm:px-6",+ redirectUrlVisible && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"title={t("redirect_success_booking")}{...successRedirectUrlLocked}description={t("redirect_url_description")}@@ -249,8 +261,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,setRedirectUrlVisible(e);onChange(e ? value : "");}}>- {/* Textfield has some margin by default we remove that so we can keep consistent alignment */}- <div className="lg:-mb-2 lg:-ml-2">+ <div className="border-subtle rounded-b-md border border-t-0 p-6"><TextFieldclassName="w-full"label={t("redirect_success_booking")}@@ -274,10 +285,24 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,</>)}/>- <hr className="border-subtle" />+<SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle rounded-md border py-6 px-4 sm:px-6",+ hashedLinkVisible && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"data-testid="hashedLinkCheck"title={t("private_link")}+ Badge={+ <a+ target="_blank"+ rel="noreferrer"+ href="https://cal.com/docs/core-features/event-types/single-use-private-links">+ <Info className="mb-2 ml-1.5 h-4 w-4 cursor-pointer" />+ </a>+ }{...shouldLockDisableProps("hashedLinkCheck")}description={t("private_link_description", { appName: APP_NAME })}checked={hashedLinkVisible}@@ -285,8 +310,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,formMethods.setValue("hashedLink", e ? hashedUrl : undefined);setHashedLinkVisible(e);}}>- {/* Textfield has some margin by default we remove that so we can keep consitant aligment */}- <div className="lg:-ml-2">+ <div className="border-subtle rounded-b-md border border-t-0 p-6">{!IS_VISUAL_REGRESSION_TESTING && (<TextFielddisabled@@ -321,7 +345,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,)}</div></SettingsToggle>- <hr className="border-subtle" />+<Controllername="seatsPerTimeSlotEnabled"control={formMethods.control}@@ -329,6 +353,12 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,render={({ field: { value, onChange } }) => (<><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle rounded-md border py-6 px-4 sm:px-6",+ value && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"data-testid="offer-seats-toggle"title={t("offer_seats")}{...seatsLocked}@@ -349,45 +379,49 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,}onChange(e);}}>- <Controller- name="seatsPerTimeSlot"- control={formMethods.control}- defaultValue={eventType.seatsPerTimeSlot}- render={({ field: { value, onChange } }) => (- <div className="lg:-ml-2">- <TextField- required- name="seatsPerTimeSlot"- labelSrOnly- label={t("number_of_seats")}- type="number"- disabled={seatsLocked.disabled}- defaultValue={value || 2}- min={1}- addOnSuffix={<>{t("seats")}</>}- onChange={(e) => {- onChange(Math.abs(Number(e.target.value)));- }}- />- <div className="mt-2">- <CheckboxField- description={t("show_attendees")}- disabled={seatsLocked.disabled}- onChange={(e) => formMethods.setValue("seatsShowAttendees", e.target.checked)}- defaultChecked={!!eventType.seatsShowAttendees}- />- </div>- <div className="mt-2">- <CheckboxField- description={t("show_available_seats_count")}+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <Controller+ name="seatsPerTimeSlot"+ control={formMethods.control}+ defaultValue={eventType.seatsPerTimeSlot}+ render={({ field: { value, onChange } }) => (+ <div className="lg:-ml-2">+ <TextField+ required+ name="seatsPerTimeSlot"+ labelSrOnly+ label={t("number_of_seats")}+ type="number"disabled={seatsLocked.disabled}- onChange={(e) => formMethods.setValue("seatsShowAvailabilityCount", e.target.checked)}- defaultChecked={!!eventType.seatsShowAvailabilityCount}+ defaultValue={value || 2}+ min={1}+ addOnSuffix={<>{t("seats")}</>}+ onChange={(e) => {+ onChange(Math.abs(Number(e.target.value)));+ }}/>+ <div className="mt-2">+ <CheckboxField+ description={t("show_attendees")}+ disabled={seatsLocked.disabled}+ onChange={(e) => formMethods.setValue("seatsShowAttendees", e.target.checked)}+ defaultChecked={!!eventType.seatsShowAttendees}+ />+ </div>+ <div className="mt-2">+ <CheckboxField+ description={t("show_available_seats_count")}+ disabled={seatsLocked.disabled}+ onChange={(e) =>+ formMethods.setValue("seatsShowAvailabilityCount", e.target.checked)+ }+ defaultChecked={!!eventType.seatsShowAvailabilityCount}+ />+ </div></div>- </div>- )}- />+ )}+ />+ </div></SettingsToggle>{noShowFeeEnabled && <Alert severity="warning" title={t("seats_and_no_show_fee_error")} />}</>@@ -395,13 +429,14 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,/>{allowDisablingAttendeeConfirmationEmails(workflows) && (<>- <hr className="border-subtle" /><Controllername="metadata.disableStandardEmails.confirmation.attendee"control={formMethods.control}render={({ field: { value, onChange } }) => (<><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName="border-subtle rounded-md border py-6 px-4 sm:px-6"title={t("disable_attendees_confirmation_emails")}description={t("disable_attendees_confirmation_emails_description")}checked={value || false}@@ -417,7 +452,6 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,)}{allowDisablingHostConfirmationEmails(workflows) && (<>- <hr className="border-subtle" /><Controllername="metadata.disableStandardEmails.confirmation.host"control={formMethods.control}@@ -425,6 +459,8 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,render={({ field: { value, onChange } }) => (<><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName="border-subtle rounded-md border py-6 px-4 sm:px-6"title={t("disable_host_confirmation_emails")}description={t("disable_host_confirmation_emails_description")}checked={value || false}diff --git a/apps/web/components/eventtype/EventAppsTab.tsx b/apps/web/components/eventtype/EventAppsTab.tsxindex 067a09a76eb..72e041744f6 100644--- a/apps/web/components/eventtype/EventAppsTab.tsx+++ b/apps/web/components/eventtype/EventAppsTab.tsx@@ -158,7 +158,7 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {</div></div>{!shouldLockDisableProps("apps").disabled && (- <div className="bg-muted rounded-md p-8">+ <div className="bg-muted mt-6 rounded-md p-8">{!isLoading && notInstalledApps?.length ? (<><h2 className="text-emphasis mb-2 text-xl font-semibold leading-5 tracking-[0.01em]">@@ -166,7 +166,7 @@ export const EventAppsTab = ({ eventType }: { eventType: EventType }) => {</h2><p className="text-default mb-6 text-sm font-normal"><Trans i18nKey="available_apps_desc">- You have no apps installed. View popular apps below and explore more in our + View popular apps below and explore more in our <Link className="cursor-pointer underline" href="/apps">App Store</Link>diff --git a/apps/web/components/eventtype/EventAvailabilityTab.tsx b/apps/web/components/eventtype/EventAvailabilityTab.tsxindex 07ed8a9515e..caf04147de8 100644--- a/apps/web/components/eventtype/EventAvailabilityTab.tsx+++ b/apps/web/components/eventtype/EventAvailabilityTab.tsx@@ -98,42 +98,43 @@ const EventTypeScheduleDetails = memo(schedule?.schedule.filter((item) => item.days.includes((dayNum + 1) % 7)) || [];return (- <div className="border-default space-y-4 rounded border px-6 pb-4">- <ol className="table border-collapse text-sm">- {weekdayNames(i18n.language, 1, "long").map((day, index) => {- const isAvailable = !!filterDays(index).length;- return (- <li key={day} className="my-6 flex border-transparent last:mb-2">- <span- className={classNames(- "w-20 font-medium sm:w-32 ",- !isAvailable ? "text-subtle line-through" : "text-default"- )}>- {day}- </span>- {isLoading ? (- <SkeletonText className="block h-5 w-60" />- ) : isAvailable ? (- <div className="space-y-3 text-right">- {filterDays(index).map((dayRange, i) => (- <div key={i} className="text-default flex items-center leading-4">- <span className="w-16 sm:w-28 sm:text-left">- {format(dayRange.startTime, timeFormat === 12)}- </span>- <span className="ms-4">-</span>- <div className="ml-6 sm:w-28">{format(dayRange.endTime, timeFormat === 12)}</div>- </div>- ))}- </div>- ) : (- <span className="text-subtle ml-6 sm:ml-0">{t("unavailable")}</span>- )}- </li>- );- })}- </ol>- <hr className="border-subtle" />- <div className="flex flex-col justify-center gap-2 sm:flex-row sm:justify-between">+ <div>+ <div className="border-subtle space-y-4 border-x p-6">+ <ol className="table border-collapse text-sm">+ {weekdayNames(i18n.language, 1, "long").map((day, index) => {+ const isAvailable = !!filterDays(index).length;+ return (+ <li key={day} className="my-6 flex border-transparent last:mb-2">+ <span+ className={classNames(+ "w-20 font-medium sm:w-32 ",+ !isAvailable ? "text-subtle line-through" : "text-default"+ )}>+ {day}+ </span>+ {isLoading ? (+ <SkeletonText className="block h-5 w-60" />+ ) : isAvailable ? (+ <div className="space-y-3 text-right">+ {filterDays(index).map((dayRange, i) => (+ <div key={i} className="text-default flex items-center leading-4">+ <span className="w-16 sm:w-28 sm:text-left">+ {format(dayRange.startTime, timeFormat === 12)}+ </span>+ <span className="ms-4">-</span>+ <div className="ml-6 sm:w-28">{format(dayRange.endTime, timeFormat === 12)}</div>+ </div>+ ))}+ </div>+ ) : (+ <span className="text-subtle ml-6 sm:ml-0">{t("unavailable")}</span>+ )}+ </li>+ );+ })}+ </ol>+ </div>+ <div className="bg-muted border-subtle flex flex-col justify-center gap-2 rounded-b-md border p-6 sm:flex-row sm:justify-between"><span className="text-default flex items-center justify-center text-sm sm:justify-start"><Globe className="h-3.5 w-3.5 ltr:mr-2 rtl:ml-2" />{schedule?.timeZone || <SkeletonText className="block h-5 w-32" />}@@ -234,8 +235,8 @@ const EventTypeSchedule = ({ eventType }: { eventType: EventTypeSetup }) => {}, [availabilityValue, setValue]);return (- <div className="space-y-4">- <div>+ <div>+ <div className="border-subtle rounded-t-md border p-6"><label htmlFor="availability" className="text-default mb-2 block text-sm font-medium leading-none">{t("availability")}{shouldLockIndicator("availability")}diff --git a/apps/web/components/eventtype/EventLimitsTab.tsx b/apps/web/components/eventtype/EventLimitsTab.tsxindex 44ba1743f32..504bb01db38 100644--- a/apps/web/components/eventtype/EventLimitsTab.tsx+++ b/apps/web/components/eventtype/EventLimitsTab.tsx@@ -17,7 +17,7 @@ import { ascendingLimitKeys, intervalLimitKeyToUnit } from "@calcom/lib/intervalimport type { PeriodType } from "@calcom/prisma/enums";import type { IntervalLimit } from "@calcom/types/Calendar";import { Button, DateRangePicker, InputField, Label, Select, SettingsToggle, TextField } from "@calcom/ui";-import { Plus, Trash } from "@calcom/ui/components/icon";+import { Plus, Trash2 } from "@calcom/ui/components/icon";const MinimumBookingNoticeInput = React.forwardRef<HTMLInputElement,@@ -83,14 +83,14 @@ const MinimumBookingNoticeInput = React.forwardRef<type="number"placeholder="0"min={0}- className="mb-0 h-[38px] rounded-[4px] ltr:mr-2 rtl:ml-2"+ className="mb-0 h-9 rounded-[4px] ltr:mr-2 rtl:ml-2"/><input type="hidden" ref={ref} {...passThroughProps} /></div><SelectisSearchable={false}isDisabled={passThroughProps.disabled}- className="mb-0 ml-2 h-[38px] w-full capitalize md:min-w-[150px] md:max-w-[200px]"+ className="mb-0 ml-2 h-9 w-full capitalize md:min-w-[150px] md:max-w-[200px]"defaultValue={durationTypeOptions.find((option) => option.value === minimumBookingNoticeDisplayValues.type)}@@ -170,8 +170,8 @@ export const EventLimitsTab = ({ eventType }: Pick<EventTypeSetupProps, "eventTyconst offsetAdjustedTime = new Date(offsetOriginalTime.getTime() + offsetStartValue * 60 * 1000);return (- <div className="space-y-8">- <div className="space-y-4 lg:space-y-8">+ <div>+ <div className="border-subtle space-y-6 rounded-md border p-6"><div className="flex flex-col space-y-4 lg:flex-row lg:space-x-4 lg:space-y-0"><div className="w-full"><Label htmlFor="beforeBufferTime">@@ -295,159 +295,195 @@ export const EventLimitsTab = ({ eventType }: Pick<EventTypeSetupProps, "eventTy</div></div></div>- <hr className="border-subtle" /><Controllername="bookingLimits"control={formMethods.control}- render={({ field: { value } }) => (- <SettingsToggle- title={t("limit_booking_frequency")}- {...bookingLimitsLocked}- description={t("limit_booking_frequency_description")}- checked={Object.keys(value ?? {}).length > 0}- onCheckedChange={(active) => {- if (active) {- formMethods.setValue("bookingLimits", {- PER_DAY: 1,- });- } else {- formMethods.setValue("bookingLimits", {});- }- }}>- <IntervalLimitsManager- disabled={bookingLimitsLocked.disabled}- propertyName="bookingLimits"- defaultLimit={1}- step={1}- />- </SettingsToggle>- )}+ render={({ field: { value } }) => {+ const isChecked = Object.keys(value ?? {}).length > 0;+ return (+ <SettingsToggle+ toggleSwitchAtTheEnd={true}+ title={t("limit_booking_frequency")}+ {...bookingLimitsLocked}+ description={t("limit_booking_frequency_description")}+ checked={isChecked}+ onCheckedChange={(active) => {+ if (active) {+ formMethods.setValue("bookingLimits", {+ PER_DAY: 1,+ });+ } else {+ formMethods.setValue("bookingLimits", {});+ }+ }}+ switchContainerClassName={classNames(+ "border-subtle mt-6 rounded-md border py-6 px-4 sm:px-6",+ isChecked && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0">+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <IntervalLimitsManager+ disabled={bookingLimitsLocked.disabled}+ propertyName="bookingLimits"+ defaultLimit={1}+ step={1}+ />+ </div>+ </SettingsToggle>+ );+ }}/>- <hr className="border-subtle" /><Controllername="durationLimits"control={formMethods.control}- render={({ field: { value } }) => (- <SettingsToggle- title={t("limit_total_booking_duration")}- description={t("limit_total_booking_duration_description")}- {...durationLimitsLocked}- checked={Object.keys(value ?? {}).length > 0}- onCheckedChange={(active) => {- if (active) {- formMethods.setValue("durationLimits", {- PER_DAY: 60,- });- } else {- formMethods.setValue("durationLimits", {});- }- }}>- <IntervalLimitsManager- propertyName="durationLimits"- defaultLimit={60}- disabled={durationLimitsLocked.disabled}- step={15}- textFieldSuffix={t("minutes")}- />- </SettingsToggle>- )}+ render={({ field: { value } }) => {+ const isChecked = Object.keys(value ?? {}).length > 0;+ return (+ <SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle mt-6 rounded-md border py-6 px-4 sm:px-6",+ isChecked && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"+ title={t("limit_total_booking_duration")}+ description={t("limit_total_booking_duration_description")}+ {...durationLimitsLocked}+ checked={isChecked}+ onCheckedChange={(active) => {+ if (active) {+ formMethods.setValue("durationLimits", {+ PER_DAY: 60,+ });+ } else {+ formMethods.setValue("durationLimits", {});+ }+ }}>+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <IntervalLimitsManager+ propertyName="durationLimits"+ defaultLimit={60}+ disabled={durationLimitsLocked.disabled}+ step={15}+ textFieldSuffix={t("minutes")}+ />+ </div>+ </SettingsToggle>+ );+ }}/>- <hr className="border-subtle" /><Controllername="periodType"control={formMethods.control}- render={({ field: { value } }) => (- <SettingsToggle- title={t("limit_future_bookings")}- description={t("limit_future_bookings_description")}- {...periodTypeLocked}- checked={value && value !== "UNLIMITED"}- onCheckedChange={(bool) => formMethods.setValue("periodType", bool ? "ROLLING" : "UNLIMITED")}>- <RadioGroup.Root- defaultValue={watchPeriodType}- value={watchPeriodType}- onValueChange={(val) => formMethods.setValue("periodType", val as PeriodType)}>- {PERIOD_TYPES.filter((opt) =>- periodTypeLocked.disabled ? watchPeriodType === opt.type : true- ).map((period) => {- if (period.type === "UNLIMITED") return null;- return (- <div- className={classNames(- "text-default mb-2 flex flex-wrap items-center text-sm",- watchPeriodType === "UNLIMITED" && "pointer-events-none opacity-30"- )}- key={period.type}>- {!periodTypeLocked.disabled && (- <RadioGroup.Item- id={period.type}- value={period.type}- className="min-w-4 bg-default border-default flex h-4 w-4 cursor-pointer items-center rounded-full border focus:border-2 focus:outline-none ltr:mr-2 rtl:ml-2">- <RadioGroup.Indicator className="after:bg-inverted relative flex h-4 w-4 items-center justify-center after:block after:h-2 after:w-2 after:rounded-full" />- </RadioGroup.Item>- )}- {period.prefix ? <span>{period.prefix} </span> : null}- {period.type === "ROLLING" && (- <div className="flex items-center">- <TextField- labelSrOnly- type="number"- className="border-default my-0 block w-16 text-sm [appearance:textfield] ltr:mr-2 rtl:ml-2"- placeholder="30"- disabled={periodTypeLocked.disabled}- {...formMethods.register("periodDays", { valueAsNumber: true })}- defaultValue={eventType.periodDays || 30}- />- <Select- options={optionsPeriod}- isSearchable={false}- isDisabled={periodTypeLocked.disabled}- onChange={(opt) => {- formMethods.setValue(- "periodCountCalendarDays",- opt?.value.toString() as "0" | "1"- );- }}- defaultValue={- optionsPeriod.find(- (opt) => opt.value === (eventType.periodCountCalendarDays ? 1 : 0)- ) ?? optionsPeriod[0]- }- />- </div>- )}- {period.type === "RANGE" && (- <div className="me-2 ms-2 inline-flex space-x-2 rtl:space-x-reverse">- <Controller- name="periodDates"- control={formMethods.control}- defaultValue={periodDates}- render={() => (- <DateRangePicker- startDate={formMethods.getValues("periodDates").startDate}- endDate={formMethods.getValues("periodDates").endDate}+ render={({ field: { value } }) => {+ const isChecked = value && value !== "UNLIMITED";++ return (+ <SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle mt-6 rounded-md border py-6 px-4 sm:px-6",+ isChecked && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"+ title={t("limit_future_bookings")}+ description={t("limit_future_bookings_description")}+ {...periodTypeLocked}+ checked={isChecked}+ onCheckedChange={(bool) => formMethods.setValue("periodType", bool ? "ROLLING" : "UNLIMITED")}>+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <RadioGroup.Root+ defaultValue={watchPeriodType}+ value={watchPeriodType}+ onValueChange={(val) => formMethods.setValue("periodType", val as PeriodType)}>+ {PERIOD_TYPES.filter((opt) =>+ periodTypeLocked.disabled ? watchPeriodType === opt.type : true+ ).map((period) => {+ if (period.type === "UNLIMITED") return null;+ return (+ <div+ className={classNames(+ "text-default mb-2 flex flex-wrap items-center text-sm",+ watchPeriodType === "UNLIMITED" && "pointer-events-none opacity-30"+ )}+ key={period.type}>+ {!periodTypeLocked.disabled && (+ <RadioGroup.Item+ id={period.type}+ value={period.type}+ className="min-w-4 bg-default border-default flex h-4 w-4 cursor-pointer items-center rounded-full border focus:border-2 focus:outline-none ltr:mr-2 rtl:ml-2">+ <RadioGroup.Indicator className="after:bg-inverted relative flex h-4 w-4 items-center justify-center after:block after:h-2 after:w-2 after:rounded-full" />+ </RadioGroup.Item>+ )}+ {period.prefix ? <span>{period.prefix} </span> : null}+ {period.type === "ROLLING" && (+ <div className="flex items-center">+ <TextField+ labelSrOnly+ type="number"+ className="border-default my-0 block w-16 text-sm [appearance:textfield] ltr:mr-2 rtl:ml-2"+ placeholder="30"disabled={periodTypeLocked.disabled}- onDatesChange={({ startDate, endDate }) => {- formMethods.setValue("periodDates", {- startDate,- endDate,- });+ {...formMethods.register("periodDays", { valueAsNumber: true })}+ defaultValue={eventType.periodDays || 30}+ />+ <Select+ options={optionsPeriod}+ isSearchable={false}+ isDisabled={periodTypeLocked.disabled}+ onChange={(opt) => {+ formMethods.setValue(+ "periodCountCalendarDays",+ opt?.value.toString() as "0" | "1"+ );}}+ defaultValue={+ optionsPeriod.find(+ (opt) => opt.value === (eventType.periodCountCalendarDays ? 1 : 0)+ ) ?? optionsPeriod[0]+ }+ />+ </div>+ )}+ {period.type === "RANGE" && (+ <div className="me-2 ms-2 inline-flex space-x-2 rtl:space-x-reverse">+ <Controller+ name="periodDates"+ control={formMethods.control}+ defaultValue={periodDates}+ render={() => (+ <DateRangePicker+ startDate={formMethods.getValues("periodDates").startDate}+ endDate={formMethods.getValues("periodDates").endDate}+ disabled={periodTypeLocked.disabled}+ onDatesChange={({ startDate, endDate }) => {+ formMethods.setValue("periodDates", {+ startDate,+ endDate,+ });+ }}+ />+ )}/>- )}- />+ </div>+ )}+ {period.suffix ? <span className="me-2 ms-2"> {period.suffix}</span> : null}</div>- )}- {period.suffix ? <span className="me-2 ms-2"> {period.suffix}</span> : null}- </div>- );- })}- </RadioGroup.Root>- </SettingsToggle>- )}+ );+ })}+ </RadioGroup.Root>+ </div>+ </SettingsToggle>+ );+ }}/>- <hr className="border-subtle" /><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle mt-6 rounded-md border py-6 px-4 sm:px-6",+ offsetToggle && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"title={t("offset_toggle")}description={t("offset_toggle_description")}{...offsetStartLockedProps}@@ -458,18 +494,20 @@ export const EventLimitsTab = ({ eventType }: Pick<EventTypeSetupProps, "eventTyformMethods.setValue("offsetStart", 0);}}}>- <TextField- required- type="number"- {...offsetStartLockedProps}- label={t("offset_start")}- {...formMethods.register("offsetStart")}- addOnSuffix={<>{t("minutes")}</>}- hint={t("offset_start_description", {- originalTime: offsetOriginalTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),- adjustedTime: offsetAdjustedTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),- })}- />+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <TextField+ required+ type="number"+ {...offsetStartLockedProps}+ label={t("offset_start")}+ {...formMethods.register("offsetStart")}+ addOnSuffix={<>{t("minutes")}</>}+ hint={t("offset_start_description", {+ originalTime: offsetOriginalTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),+ adjustedTime: offsetAdjustedTime.toLocaleTimeString(i18n.language, { timeStyle: "short" }),+ })}+ />+ </div></SettingsToggle></div>);@@ -509,19 +547,19 @@ const IntervalLimitItem = ({onIntervalSelect,}: IntervalLimitItemProps) => {return (- <div className="mb-2 flex items-center space-x-2 text-sm rtl:space-x-reverse" key={limitKey}>+ <div className="mb-4 flex max-h-9 items-center space-x-2 text-sm rtl:space-x-reverse" key={limitKey}><TextFieldrequiredtype="number"containerClassName={textFieldSuffix ? "w-44 -mb-1" : "w-16 mb-0"}- className="mb-0 !h-auto"+ className="mb-0"placeholder={`${value}`}disabled={disabled}min={step}step={step}defaultValue={value}addOnSuffix={textFieldSuffix}- onChange={(e) => onLimitChange(limitKey, parseInt(e.target.value))}+ onChange={(e) => onLimitChange(limitKey, parseInt(e.target.value || "0", 10))}/><Selectoptions={selectOptions}@@ -529,9 +567,16 @@ const IntervalLimitItem = ({isDisabled={disabled}defaultValue={INTERVAL_LIMIT_OPTIONS.find((option) => option.value === limitKey)}onChange={onIntervalSelect}+ className="w-36"/>{hasDeleteButton && !disabled && (- <Button variant="icon" StartIcon={Trash} color="destructive" onClick={() => onDelete(limitKey)} />+ <Button+ variant="icon"+ StartIcon={Trash2}+ color="destructive"+ className="border-none"+ onClick={() => onDelete(limitKey)}+ />)}</div>);diff --git a/apps/web/components/eventtype/EventSetupTab.tsx b/apps/web/components/eventtype/EventSetupTab.tsxindex 07a7d7d3b3b..e210cf4eaff 100644--- a/apps/web/components/eventtype/EventSetupTab.tsx+++ b/apps/web/components/eventtype/EventSetupTab.tsx@@ -387,178 +387,185 @@ export const EventSetupTab = (return (<div>- <div className="space-y-8">- <TextField- required- label={t("title")}- {...shouldLockDisableProps("title")}- defaultValue={eventType.title}- {...formMethods.register("title")}- />- <div>- <Label>- {t("description")}- {shouldLockIndicator("description")}- </Label>- <DescriptionEditor- description={eventType?.description}- editable={!descriptionLockedProps.disabled}+ <div className="space-y-4">+ <div className="border-subtle space-y-6 rounded-md border p-6">+ <TextField+ required+ label={t("title")}+ {...shouldLockDisableProps("title")}+ defaultValue={eventType.title}+ {...formMethods.register("title")}+ />+ <div>+ <Label>+ {t("description")}+ {shouldLockIndicator("description")}+ </Label>+ <DescriptionEditor+ description={eventType?.description}+ editable={!descriptionLockedProps.disabled}+ />+ </div>+ <TextField+ required+ label={t("URL")}+ {...shouldLockDisableProps("slug")}+ defaultValue={eventType.slug}+ addOnLeading={+ <>+ {urlPrefix}/+ {!isManagedEventType+ ? team+ ? (orgBranding ? "" : "team/") + team.slug+ : eventType.users[0].username+ : t("username_placeholder")}+ /+ </>+ }+ {...formMethods.register("slug", {+ setValueAs: (v) => slugify(v),+ })}/></div>- <TextField- required- label={t("URL")}- {...shouldLockDisableProps("slug")}- defaultValue={eventType.slug}- addOnLeading={- <>- {urlPrefix}/- {!isManagedEventType- ? team- ? (orgBranding ? "" : "team/") + team.slug- : eventType.users[0].username- : t("username_placeholder")}- /- </>- }- {...formMethods.register("slug", {- setValueAs: (v) => slugify(v),- })}- />- {multipleDuration ? (- <div className="space-y-4">- <div>- <Skeleton as={Label} loadingClassName="w-16">- {t("available_durations")}- </Skeleton>- <Select- isMulti- defaultValue={selectedMultipleDuration}- name="metadata.multipleDuration"- isSearchable={false}- className="h-auto !min-h-[36px] text-sm"- options={multipleDurationOptions}- value={selectedMultipleDuration}- onChange={(options) => {- let newOptions = [...options];- newOptions = newOptions.sort((a, b) => {- return a?.value - b?.value;- });- const values = newOptions.map((opt) => opt.value);- setMultipleDuration(values);- setSelectedMultipleDuration(newOptions);- if (!newOptions.find((opt) => opt.value === defaultDuration?.value)) {- if (newOptions.length > 0) {+ <div className="border-subtle rounded-md border p-6">+ {multipleDuration ? (+ <div className="space-y-6">+ <div>+ <Skeleton as={Label} loadingClassName="w-16">+ {t("available_durations")}+ </Skeleton>+ <Select+ isMulti+ defaultValue={selectedMultipleDuration}+ name="metadata.multipleDuration"+ isSearchable={false}+ className="h-auto !min-h-[36px] text-sm"+ options={multipleDurationOptions}+ value={selectedMultipleDuration}+ onChange={(options) => {+ let newOptions = [...options];+ newOptions = newOptions.sort((a, b) => {+ return a?.value - b?.value;+ });+ const values = newOptions.map((opt) => opt.value);+ setMultipleDuration(values);+ setSelectedMultipleDuration(newOptions);+ if (!newOptions.find((opt) => opt.value === defaultDuration?.value)) {+ if (newOptions.length > 0) {+ setDefaultDuration(newOptions[0]);+ formMethods.setValue("length", newOptions[0].value);+ } else {+ setDefaultDuration(null);+ }+ }+ if (newOptions.length === 1 && defaultDuration === null) {setDefaultDuration(newOptions[0]);formMethods.setValue("length", newOptions[0].value);- } else {- setDefaultDuration(null);}- }- if (newOptions.length === 1 && defaultDuration === null) {- setDefaultDuration(newOptions[0]);- formMethods.setValue("length", newOptions[0].value);- }- formMethods.setValue("metadata.multipleDuration", values);- }}- />+ formMethods.setValue("metadata.multipleDuration", values);+ }}+ />+ </div>+ <div>+ <Skeleton as={Label} loadingClassName="w-16">+ {t("default_duration")}+ {shouldLockIndicator("length")}+ </Skeleton>+ <Select+ value={defaultDuration}+ isSearchable={false}+ name="length"+ className="text-sm"+ isDisabled={lengthLockedProps.disabled}+ noOptionsMessage={() => t("default_duration_no_options")}+ options={selectedMultipleDuration}+ onChange={(option) => {+ setDefaultDuration(+ selectedMultipleDuration.find((opt) => opt.value === option?.value) ?? null+ );+ if (option) formMethods.setValue("length", option.value);+ }}+ />+ </div></div>- <div>- <Skeleton as={Label} loadingClassName="w-16">- {t("default_duration")}- {shouldLockIndicator("length")}- </Skeleton>- <Select- value={defaultDuration}- isSearchable={false}- name="length"- className="text-sm"- isDisabled={lengthLockedProps.disabled}- noOptionsMessage={() => t("default_duration_no_options")}- options={selectedMultipleDuration}- onChange={(option) => {- setDefaultDuration(- selectedMultipleDuration.find((opt) => opt.value === option?.value) ?? null- );- if (option) formMethods.setValue("length", option.value);+ ) : (+ <TextField+ required+ type="number"+ {...lengthLockedProps}+ label={t("duration")}+ defaultValue={eventType.length ?? 15}+ {...formMethods.register("length")}+ addOnSuffix={<>{t("minutes")}</>}+ min={1}+ />+ )}+ {!lengthLockedProps.disabled && (+ <div className="!mt-4 [&_label]:my-1 [&_label]:font-normal">+ <SettingsToggle+ title={t("allow_booker_to_select_duration")}+ checked={multipleDuration !== undefined}+ disabled={seatsEnabled}+ tooltip={seatsEnabled ? t("seat_options_doesnt_multiple_durations") : undefined}+ onCheckedChange={() => {+ if (multipleDuration !== undefined) {+ setMultipleDuration(undefined);+ formMethods.setValue("metadata.multipleDuration", undefined);+ formMethods.setValue("length", eventType.length);+ } else {+ setMultipleDuration([]);+ formMethods.setValue("metadata.multipleDuration", []);+ formMethods.setValue("length", 0);+ }}}/></div>- </div>- ) : (- <TextField- required- type="number"- {...lengthLockedProps}- label={t("duration")}- defaultValue={eventType.length ?? 15}- {...formMethods.register("length")}- addOnSuffix={<>{t("minutes")}</>}- min={1}- />- )}- {!lengthLockedProps.disabled && (- <div className="!mt-4 [&_label]:my-1 [&_label]:font-normal">- <SettingsToggle- title={t("allow_booker_to_select_duration")}- checked={multipleDuration !== undefined}- disabled={seatsEnabled}- tooltip={seatsEnabled ? t("seat_options_doesnt_multiple_durations") : undefined}- onCheckedChange={() => {- if (multipleDuration !== undefined) {- setMultipleDuration(undefined);- formMethods.setValue("metadata.multipleDuration", undefined);- formMethods.setValue("length", eventType.length);- } else {- setMultipleDuration([]);- formMethods.setValue("metadata.multipleDuration", []);- formMethods.setValue("length", 0);- }- }}+ )}+ </div>++ <div className="border-subtle rounded-md border p-6">+ <div>+ <Skeleton as={Label} loadingClassName="w-16">+ {t("location")}+ {shouldLockIndicator("locations")}+ </Skeleton>++ <Controller+ name="locations"+ control={formMethods.control}+ defaultValue={eventType.locations || []}+ render={() => <Locations />}/></div>- )}- <div>- <Skeleton as={Label} loadingClassName="w-16">- {t("location")}- {shouldLockIndicator("locations")}- </Skeleton>-- <Controller- name="locations"- control={formMethods.control}- defaultValue={eventType.locations || []}- render={() => <Locations />}- /></div>- </div>- {/* We portal this modal so we can submit the form inside. Otherwise we get issues submitting two forms at once */}- <EditLocationDialog- isOpenDialog={showLocationModal}- setShowLocationModal={setShowLocationModal}- saveLocation={saveLocation}- defaultValues={formMethods.getValues("locations")}- selection={- selectedLocation- ? selectedLocation.address- ? {- value: selectedLocation.value,- label: t(selectedLocation.label),- icon: selectedLocation.icon,- address: selectedLocation.address,- }- : {- value: selectedLocation.value,- label: t(selectedLocation.label),- icon: selectedLocation.icon,- }- : undefined- }- setSelectedLocation={setSelectedLocation}- setEditingLocationType={setEditingLocationType}- teamId={eventType.team?.id}- />+ {/* We portal this modal so we can submit the form inside. Otherwise we get issues submitting two forms at once */}+ <EditLocationDialog+ isOpenDialog={showLocationModal}+ setShowLocationModal={setShowLocationModal}+ saveLocation={saveLocation}+ defaultValues={formMethods.getValues("locations")}+ selection={+ selectedLocation+ ? selectedLocation.address+ ? {+ value: selectedLocation.value,+ label: t(selectedLocation.label),+ icon: selectedLocation.icon,+ address: selectedLocation.address,+ }+ : {+ value: selectedLocation.value,+ label: t(selectedLocation.label),+ icon: selectedLocation.icon,+ }+ : undefined+ }+ setSelectedLocation={setSelectedLocation}+ setEditingLocationType={setEditingLocationType}+ teamId={eventType.team?.id}+ />+ </div></div>);};diff --git a/apps/web/components/eventtype/EventWebhooksTab.tsx b/apps/web/components/eventtype/EventWebhooksTab.tsxindex 59f7bc7d36e..b00bc863622 100644--- a/apps/web/components/eventtype/EventWebhooksTab.tsx+++ b/apps/web/components/eventtype/EventWebhooksTab.tsx@@ -1,5 +1,7 @@import type { Webhook } from "@prisma/client";import { Webhook as TbWebhook } from "lucide-react";+import { Trans } from "next-i18next";+import Link from "next/link";import type { EventTypeSetupProps } from "pages/event-types/[type]";import { useState } from "react";@@ -8,6 +10,7 @@ import { WebhookForm } from "@calcom/features/webhooks/components";import type { WebhookFormSubmitData } from "@calcom/features/webhooks/components/WebhookForm";import WebhookListItem from "@calcom/features/webhooks/components/WebhookListItem";import { subscriberUrlReserved } from "@calcom/features/webhooks/lib/subscriberUrlReserved";+import { APP_NAME } from "@calcom/lib/constants";import { useLocale } from "@calcom/lib/hooks/useLocale";import { trpc } from "@calcom/trpc/react";import { Alert, Button, Dialog, DialogContent, EmptyScreen, showToast } from "@calcom/ui";@@ -115,23 +118,40 @@ export const EventWebhooksTab = ({ eventType }: Pick<EventTypeSetupProps, "event)}{webhooks.length ? (<>- <div className="mb-2 rounded-md border">- {webhooks.map((webhook, index) => {- return (- <WebhookListItem- key={webhook.id}- webhook={webhook}- lastItem={webhooks.length === index + 1}- canEditWebhook={!webhookLockedStatus.disabled}- onEditWebhook={() => {- setEditModalOpen(true);- setWebhookToEdit(webhook);- }}- />- );- })}+ <div className="border-subtle mb-2 rounded-md border p-8">+ <div className="text-default text-sm font-semibold">{t("webhooks")}</div>+ <p className="text-subtle max-w-[280px] break-words text-sm sm:max-w-[500px]">+ {t("add_webhook_description", { appName: APP_NAME })}+ </p>++ <div className="border-subtle mt-8 rounded-md border">+ {webhooks.map((webhook, index) => {+ return (+ <WebhookListItem+ key={webhook.id}+ webhook={webhook}+ lastItem={webhooks.length === index + 1}+ canEditWebhook={!webhookLockedStatus.disabled}+ onEditWebhook={() => {+ setEditModalOpen(true);+ setWebhookToEdit(webhook);+ }}+ />+ );+ })}+ </div>++ <p className="text-default mt-8 text-sm font-normal">+ <Trans i18nKey="edit_or_manage_webhooks">+ If you wish to edit or manage your web hooks, please head over to + <Link+ className="cursor-pointer font-semibold underline"+ href="/settings/developer/webhooks">+ webhooks settings+ </Link>+ </Trans>+ </p></div>- <NewWebhookButton /></>) : (<EmptyScreendiff --git a/apps/web/components/eventtype/RecurringEventController.tsx b/apps/web/components/eventtype/RecurringEventController.tsxindex 29227256552..c485438e485 100644--- a/apps/web/components/eventtype/RecurringEventController.tsx+++ b/apps/web/components/eventtype/RecurringEventController.tsx@@ -3,6 +3,7 @@ import { useState } from "react";import { useFormContext } from "react-hook-form";import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";+import { classNames } from "@calcom/lib";import { useLocale } from "@calcom/lib/hooks/useLocale";import { Frequency } from "@calcom/prisma/zod-utils";import type { RecurringEvent } from "@calcom/types/Calendar";@@ -47,6 +48,12 @@ export default function RecurringEventController({) : (<><SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle rounded-md border py-6 px-4 sm:px-6",+ recurringEventState !== null && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"title={t("recurring_event")}{...recurringLocked}description={t("recurring_event_description")}@@ -66,68 +73,70 @@ export default function RecurringEventController({setRecurringEventState(newVal);}}}>- {recurringEventState && (- <div data-testid="recurring-event-collapsible" className="text-sm">- <div className="flex items-center">- <p className="text-emphasis ltr:mr-2 rtl:ml-2">{t("repeats_every")}</p>- <TextField- disabled={recurringLocked.disabled}- type="number"- min="1"- max="20"- className="mb-0"- defaultValue={recurringEventState.interval}- onChange={(event) => {- const newVal = {- ...recurringEventState,- interval: parseInt(event?.target.value),- };- formMethods.setValue("recurringEvent", newVal);- setRecurringEventState(newVal);- }}- />- <Select- options={recurringEventFreqOptions}- value={recurringEventFreqOptions[recurringEventState.freq]}- isSearchable={false}- className="w-18 ml-2 block min-w-0 rounded-md text-sm"- isDisabled={recurringLocked.disabled}- onChange={(event) => {- const newVal = {- ...recurringEventState,- freq: parseInt(event?.value || `${Frequency.WEEKLY}`),- };- formMethods.setValue("recurringEvent", newVal);- setRecurringEventState(newVal);- }}- />- </div>- <div className="mt-4 flex items-center">- <p className="text-emphasis ltr:mr-2 rtl:ml-2">{t("for_a_maximum_of")}</p>- <TextField- disabled={recurringLocked.disabled}- type="number"- min="1"- max="20"- defaultValue={recurringEventState.count}- className="mb-0"- onChange={(event) => {- const newVal = {- ...recurringEventState,- count: parseInt(event?.target.value),- };- formMethods.setValue("recurringEvent", newVal);- setRecurringEventState(newVal);- }}- />- <p className="text-emphasis ltr:ml-2 rtl:mr-2">- {t("events", {- count: recurringEventState.count,- })}- </p>+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ {recurringEventState && (+ <div data-testid="recurring-event-collapsible" className="text-sm">+ <div className="flex items-center">+ <p className="text-emphasis ltr:mr-2 rtl:ml-2">{t("repeats_every")}</p>+ <TextField+ disabled={recurringLocked.disabled}+ type="number"+ min="1"+ max="20"+ className="mb-0"+ defaultValue={recurringEventState.interval}+ onChange={(event) => {+ const newVal = {+ ...recurringEventState,+ interval: parseInt(event?.target.value),+ };+ formMethods.setValue("recurringEvent", newVal);+ setRecurringEventState(newVal);+ }}+ />+ <Select+ options={recurringEventFreqOptions}+ value={recurringEventFreqOptions[recurringEventState.freq]}+ isSearchable={false}+ className="w-18 ml-2 block min-w-0 rounded-md text-sm"+ isDisabled={recurringLocked.disabled}+ onChange={(event) => {+ const newVal = {+ ...recurringEventState,+ freq: parseInt(event?.value || `${Frequency.WEEKLY}`),+ };+ formMethods.setValue("recurringEvent", newVal);+ setRecurringEventState(newVal);+ }}+ />+ </div>+ <div className="mt-4 flex items-center">+ <p className="text-emphasis ltr:mr-2 rtl:ml-2">{t("for_a_maximum_of")}</p>+ <TextField+ disabled={recurringLocked.disabled}+ type="number"+ min="1"+ max="20"+ defaultValue={recurringEventState.count}+ className="mb-0"+ onChange={(event) => {+ const newVal = {+ ...recurringEventState,+ count: parseInt(event?.target.value),+ };+ formMethods.setValue("recurringEvent", newVal);+ setRecurringEventState(newVal);+ }}+ />+ <p className="text-emphasis ltr:ml-2 rtl:mr-2">+ {t("events", {+ count: recurringEventState.count,+ })}+ </p>+ </div></div>- </div>- )}+ )}+ </div></SettingsToggle></>)}diff --git a/apps/web/components/eventtype/RequiresConfirmationController.tsx b/apps/web/components/eventtype/RequiresConfirmationController.tsxindex a9f94a28c0f..e8789a2a484 100644--- a/apps/web/components/eventtype/RequiresConfirmationController.tsx+++ b/apps/web/components/eventtype/RequiresConfirmationController.tsx@@ -67,6 +67,12 @@ export default function RequiresConfirmationController({control={formMethods.control}render={() => (<SettingsToggle+ toggleSwitchAtTheEnd={true}+ switchContainerClassName={classNames(+ "border-subtle rounded-md border py-6 px-4 sm:px-6",+ requiresConfirmation && "rounded-b-none"+ )}+ childrenClassName="lg:ml-0"title={t("requires_confirmation")}disabled={seatsEnabled || requiresConfirmationLockedProps.disabled}tooltip={seatsEnabled ? t("seat_options_doesnt_support_confirmation") : undefined}@@ -77,107 +83,111 @@ export default function RequiresConfirmationController({formMethods.setValue("requiresConfirmation", val);onRequiresConfirmation(val);}}>- <RadioGroup.Root- defaultValue={- requiresConfirmation- ? requiresConfirmationSetup === undefined- ? "always"- : "notice"- : undefined- }- onValueChange={(val) => {- if (val === "always") {- formMethods.setValue("requiresConfirmation", true);- onRequiresConfirmation(true);- formMethods.setValue("metadata.requiresConfirmationThreshold", undefined);- setRequiresConfirmationSetup(undefined);- } else if (val === "notice") {- formMethods.setValue("requiresConfirmation", true);- onRequiresConfirmation(true);- formMethods.setValue(- "metadata.requiresConfirmationThreshold",- requiresConfirmationSetup || defaultRequiresConfirmationSetup- );+ <div className="border-subtle rounded-b-md border border-t-0 p-6">+ <RadioGroup.Root+ defaultValue={+ requiresConfirmation+ ? requiresConfirmationSetup === undefined+ ? "always"+ : "notice"+ : undefined}- }}>- <div className="flex flex-col flex-wrap justify-start gap-y-2">- {(requiresConfirmationSetup === undefined || !requiresConfirmationLockedProps.disabled) && (- <RadioField- label={t("always_requires_confirmation")}- disabled={requiresConfirmationLockedProps.disabled}- id="always"- value="always"- />- )}- {(requiresConfirmationSetup !== undefined || !requiresConfirmationLockedProps.disabled) && (- <RadioField- disabled={requiresConfirmationLockedProps.disabled}- className="items-center"- label={- <>- <Trans- i18nKey="when_booked_with_less_than_notice"- defaults="When booked with less than <time></time> notice"- components={{- time: (- <div className="mx-2 inline-flex">- <Input- type="number"- min={1}- disabled={requiresConfirmationLockedProps.disabled}- onChange={(evt) => {- const val = Number(evt.target?.value);- setRequiresConfirmationSetup({- unit:- requiresConfirmationSetup?.unit ??- defaultRequiresConfirmationSetup.unit,- time: val,- });- formMethods.setValue(- "metadata.requiresConfirmationThreshold.time",- val- );- }}- className="border-default !m-0 block w-16 rounded-md text-sm [appearance:textfield]"- defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}- />- <label- className={classNames(- requiresConfirmationLockedProps.disabled && "cursor-not-allowed"- )}>- <Select- inputId="notice"- options={options}- isSearchable={false}- isDisabled={requiresConfirmationLockedProps.disabled}- className="ml-2"- onChange={(opt) => {+ onValueChange={(val) => {+ if (val === "always") {+ formMethods.setValue("requiresConfirmation", true);+ onRequiresConfirmation(true);+ formMethods.setValue("metadata.requiresConfirmationThreshold", undefined);+ setRequiresConfirmationSetup(undefined);+ } else if (val === "notice") {+ formMethods.setValue("requiresConfirmation", true);+ onRequiresConfirmation(true);+ formMethods.setValue(+ "metadata.requiresConfirmationThreshold",+ requiresConfirmationSetup || defaultRequiresConfirmationSetup+ );+ }+ }}>+ <div className="flex flex-col flex-wrap justify-start gap-y-2">+ {(requiresConfirmationSetup === undefined ||+ !requiresConfirmationLockedProps.disabled) && (+ <RadioField+ label={t("always_requires_confirmation")}+ disabled={requiresConfirmationLockedProps.disabled}+ id="always"+ value="always"+ />+ )}+ {(requiresConfirmationSetup !== undefined ||+ !requiresConfirmationLockedProps.disabled) && (+ <RadioField+ disabled={requiresConfirmationLockedProps.disabled}+ className="items-center"+ label={+ <>+ <Trans+ i18nKey="when_booked_with_less_than_notice"+ defaults="When booked with less than <time></time> notice"+ components={{+ time: (+ <div className="mx-2 inline-flex">+ <Input+ type="number"+ min={1}+ disabled={requiresConfirmationLockedProps.disabled}+ onChange={(evt) => {+ const val = Number(evt.target?.value);setRequiresConfirmationSetup({- time:- requiresConfirmationSetup?.time ??- defaultRequiresConfirmationSetup.time,- unit: opt?.value as UnitTypeLongPlural,+ unit:+ requiresConfirmationSetup?.unit ??+ defaultRequiresConfirmationSetup.unit,+ time: val,});formMethods.setValue(- "metadata.requiresConfirmationThreshold.unit",- opt?.value as UnitTypeLongPlural+ "metadata.requiresConfirmationThreshold.time",+ val);}}- defaultValue={defaultValue}+ className="border-default !m-0 block w-16 rounded-r-none border-r-0 text-sm [appearance:textfield]"+ defaultValue={metadata?.requiresConfirmationThreshold?.time || 30}/>- </label>- </div>- ),- }}- />- </>- }- id="notice"- value="notice"- />- )}- </div>- </RadioGroup.Root>+ <label+ className={classNames(+ requiresConfirmationLockedProps.disabled && "cursor-not-allowed"+ )}>+ <Select+ inputId="notice"+ options={options}+ isSearchable={false}+ isDisabled={requiresConfirmationLockedProps.disabled}+ innerClassNames={{ control: "rounded-l-none bg-subtle" }}+ onChange={(opt) => {+ setRequiresConfirmationSetup({+ time:+ requiresConfirmationSetup?.time ??+ defaultRequiresConfirmationSetup.time,+ unit: opt?.value as UnitTypeLongPlural,+ });+ formMethods.setValue(+ "metadata.requiresConfirmationThreshold.unit",+ opt?.value as UnitTypeLongPlural+ );+ }}+ defaultValue={defaultValue}+ />+ </label>+ </div>+ ),+ }}+ />+ </>+ }+ id="notice"+ value="notice"+ />+ )}+ </div>+ </RadioGroup.Root>+ </div></SettingsToggle>)}/>diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsxindex 91b3901e0e0..04bbeae8245 100644--- a/apps/web/pages/event-types/[type]/index.tsx+++ b/apps/web/pages/event-types/[type]/index.tsx@@ -449,7 +449,8 @@ const EventTypePage = (props: EventTypeSetupProps) => {availability={availability}isUpdateMutationLoading={updateMutation.isLoading}formMethods={formMethods}- disableBorder={tabName === "apps" || tabName === "workflows" || tabName === "webhooks"}+ // disableBorder={tabName === "apps" || tabName === "workflows" || tabName === "webhooks"}+ disableBorder={true}currentUserMembership={currentUserMembership}isUserOrganizationAdmin={props.isUserOrganizationAdmin}><Formdiff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.jsonindex d25b59d80c8..4a6abe4213a 100644--- a/apps/web/public/static/locales/en/common.json+++ b/apps/web/public/static/locales/en/common.json@@ -255,7 +255,7 @@"yours": "Your account","available_apps": "Available Apps","available_apps_lower_case": "Available apps",- "available_apps_desc": "You have no apps installed. View popular apps below and explore more in our <1>App Store</1>",+ "available_apps_desc": "View popular apps below and explore more in our <1>App Store</1>","fixed_host_helper": "Add anyone who needs to attend the event. <1>Learn more</1>","round_robin_helper":"People in the group take turns and only one person will show up for the event.","check_email_reset_password": "Check your email. We sent you a link to reset your password.",diff --git a/packages/features/calendars/DestinationCalendarSelector.tsx b/packages/features/calendars/DestinationCalendarSelector.tsxindex c16979a8fab..c33db96f312 100644--- a/packages/features/calendars/DestinationCalendarSelector.tsx+++ b/packages/features/calendars/DestinationCalendarSelector.tsx@@ -6,7 +6,7 @@ import { components } from "react-select";import { useLocale } from "@calcom/lib/hooks/useLocale";import type { DestinationCalendar } from "@calcom/prisma/client";import { trpc } from "@calcom/trpc/react";-import { Select } from "@calcom/ui";+import { Select, Badge } from "@calcom/ui";import { Check } from "@calcom/ui/components/icon";interface Props {@@ -133,9 +133,9 @@ const DestinationCalendarSelector = ({`${t("create_events_on")}`) : (<span className="text-default min-w-0 overflow-hidden truncate whitespace-nowrap">- {t("default_calendar_selected")}{" "}+ <Badge variant="blue">Default</Badge>{" "}{queryDestinationCalendar.name &&- `| ${queryDestinationCalendar.name} (${queryDestinationCalendar?.integrationTitle} - ${queryDestinationCalendar.primaryEmail})`}+ `${queryDestinationCalendar.name} (${queryDestinationCalendar?.integrationTitle} - ${queryDestinationCalendar.primaryEmail})`}</span>)}diff --git a/packages/features/form-builder/FormBuilder.tsx b/packages/features/form-builder/FormBuilder.tsxindex 643e116cbdc..dc3b51c68de 100644--- a/packages/features/form-builder/FormBuilder.tsx+++ b/packages/features/form-builder/FormBuilder.tsx@@ -112,7 +112,7 @@ export const FormBuilder = function FormBuilder({{LockedIcon}</div><p className="text-subtle max-w-[280px] break-words py-1 text-sm sm:max-w-[500px]">{description}</p>- <ul className="border-default divide-subtle mt-2 divide-y rounded-md border">+ <ul className="border-subtle divide-subtle mt-2 divide-y rounded-md border">{fields.map((field, index) => {const options = field.options? field.options@@ -155,7 +155,7 @@ export const FormBuilder = function FormBuilder({{index >= 1 && (<buttontype="button"- className="bg-default text-muted hover:text-emphasis disabled:hover:text-muted border-default hover:border-emphasis invisible absolute -left-[12px] -ml-4 -mt-4 mb-4 hidden h-6 w-6 scale-0 items-center justify-center rounded-md border p-1 transition-all hover:shadow disabled:hover:border-inherit disabled:hover:shadow-none group-hover:visible group-hover:scale-100 sm:ml-0 sm:flex"+ className="bg-default text-muted hover:text-emphasis disabled:hover:text-muted border-subtle hover:border-emphasis invisible absolute -left-[12px] -ml-4 -mt-4 mb-4 hidden h-6 w-6 scale-0 items-center justify-center rounded-md border p-1 transition-all hover:shadow disabled:hover:border-inherit disabled:hover:shadow-none group-hover:visible group-hover:scale-100 sm:ml-0 sm:flex"onClick={() => swap(index, index - 1)}><ArrowUp className="h-5 w-5" /></button>@@ -163,7 +163,7 @@ export const FormBuilder = function FormBuilder({{index < fields.length - 1 && (<buttontype="button"- className="bg-default text-muted hover:border-emphasis border-default hover:text-emphasis disabled:hover:text-muted invisible absolute -left-[12px] -ml-4 mt-8 hidden h-6 w-6 scale-0 items-center justify-center rounded-md border p-1 transition-all hover:shadow disabled:hover:border-inherit disabled:hover:shadow-none group-hover:visible group-hover:scale-100 sm:ml-0 sm:flex"+ className="bg-default text-muted hover:border-emphasis border-subtle hover:text-emphasis disabled:hover:text-muted invisible absolute -left-[12px] -ml-4 mt-8 hidden h-6 w-6 scale-0 items-center justify-center rounded-md border p-1 transition-all hover:shadow disabled:hover:border-inherit disabled:hover:shadow-none group-hover:visible group-hover:scale-100 sm:ml-0 sm:flex"onClick={() => swap(index, index + 1)}><ArrowDown className="h-5 w-5" /></button>@@ -628,7 +628,7 @@ function VariantFields({<ulclassName={classNames(- !isSimpleVariant ? "border-default divide-subtle mt-2 divide-y rounded-md border" : ""+ !isSimpleVariant ? "border-subtle divide-subtle mt-2 divide-y rounded-md border" : "")}>{variantFields.map((f, index) => {const rhfVariantFieldPrefix = `variantsConfig.variants.${variantName}.fields.${index}` as const;diff --git a/packages/features/webhooks/components/WebhookListItem.tsx b/packages/features/webhooks/components/WebhookListItem.tsxindex 3ba075dd680..00bf7d00235 100644--- a/packages/features/webhooks/components/WebhookListItem.tsx+++ b/packages/features/webhooks/components/WebhookListItem.tsx@@ -15,7 +15,7 @@ import {Switch,Tooltip,} from "@calcom/ui";-import { AlertCircle, Edit, MoreHorizontal, Trash } from "@calcom/ui/components/icon";+import { Edit, MoreHorizontal, Trash, Zap } from "@calcom/ui/components/icon";type WebhookProps = {id: string;@@ -87,7 +87,7 @@ export default function WebhookListItem(props: {key={trigger}className="mt-2.5 basis-1/5 ltr:mr-2 rtl:ml-2"variant="gray"- startIcon={AlertCircle}>+ startIcon={Zap}>{t(`${trigger.toLowerCase()}`)}</Badge>))}diff --git a/packages/ui/components/form/select/Select.tsx b/packages/ui/components/form/select/Select.tsxindex 3a3cbe84f1c..5f4afa4a500 100644--- a/packages/ui/components/form/select/Select.tsx+++ b/packages/ui/components/form/select/Select.tsx@@ -24,8 +24,19 @@ export const Select = <menuPlacement,variant = "default",...props-}: SelectProps<Option, IsMulti, Group>) => {- const { classNames, ...restProps } = props;+}: SelectProps<Option, IsMulti, Group> & {+ innerClassNames?: {+ input?: string;+ option?: string;+ control?: string;+ singleValue?: string;+ valueContainer?: string;+ multiValue?: string;+ menu?: string;+ menuList?: string;+ };+}) => {+ const { classNames, innerClassNames, ...restProps } = props;const reactSelectProps = React.useMemo(() => {return getReactSelectProps<Option, IsMulti, Group>({components: components || {},@@ -39,14 +50,14 @@ export const Select = <<ReactSelect{...reactSelectProps}classNames={{- input: () => cx("text-emphasis", props.classNames?.input),+ input: () => cx("text-emphasis", innerClassNames?.input),option: (state) =>cx("bg-default flex cursor-pointer justify-between py-2.5 px-3 rounded-none text-default ",state.isFocused && "bg-subtle",state.isDisabled && "bg-muted",state.isSelected && "bg-emphasis text-default",- props.classNames?.option+ innerClassNames?.option),placeholder: (state) => cx("text-muted", state.isFocused && variant !== "checkbox" && "hidden"),dropdownIndicator: () => "text-default",@@ -59,25 +70,25 @@ export const Select = <: state.hasValue? "p-1 h-fit": "px-3 py-2 h-fit"- : "py-2 px-3 h-fit",+ : "py-2 px-3",props.isDisabled && "bg-subtle",- props.classNames?.control+ innerClassNames?.control),- singleValue: () => cx("text-emphasis placeholder:text-muted", props.classNames?.singleValue),+ singleValue: () => cx("text-emphasis placeholder:text-muted", innerClassNames?.singleValue),valueContainer: () =>- cx("text-emphasis placeholder:text-muted flex gap-1", props.classNames?.valueContainer),+ cx("text-emphasis placeholder:text-muted flex gap-1", innerClassNames?.valueContainer),multiValue: () =>cx("bg-subtle text-default rounded-md py-1.5 px-2 flex items-center text-sm leading-none",- props.classNames?.multiValue+ innerClassNames?.multiValue),menu: () =>cx("rounded-md bg-default text-sm leading-4 text-default mt-1 border border-subtle",- props.classNames?.menu+ innerClassNames?.menu),groupHeading: () => "leading-none text-xs uppercase text-default pl-2.5 pt-4 pb-2",- menuList: () => cx("scroll-bar scrollbar-track-w-20 rounded-md", props.classNames?.menuList),+ menuList: () => cx("scroll-bar scrollbar-track-w-20 rounded-md", innerClassNames?.menuList),indicatorsContainer: (state) =>cx(state.selectProps.menuIsOpendiff --git a/packages/ui/components/form/switch/SettingsToggle.tsx b/packages/ui/components/form/switch/SettingsToggle.tsxindex c8909f9c915..e2385b4e25d 100644--- a/packages/ui/components/form/switch/SettingsToggle.tsx+++ b/packages/ui/components/form/switch/SettingsToggle.tsx@@ -1,6 +1,8 @@import { useAutoAnimate } from "@formkit/auto-animate/react";import type { ReactNode } from "react";+import { classNames } from "@calcom/lib";+import { Label } from "..";import Switch from "./Switch";@@ -11,9 +13,13 @@ type Props = {checked: boolean;disabled?: boolean;LockedIcon?: React.ReactNode;+ Badge?: React.ReactNode;onCheckedChange?: (checked: boolean) => void;"data-testid"?: string;tooltip?: string;+ toggleSwitchAtTheEnd?: boolean;+ childrenClassName?: string;+ switchContainerClassName?: string;};function SettingsToggle({@@ -21,10 +27,14 @@ function SettingsToggle({onCheckedChange,description,LockedIcon,+ Badge,title,children,disabled,tooltip,+ toggleSwitchAtTheEnd = false,+ childrenClassName,+ switchContainerClassName,...rest}: Props) {const [animateRef] = useAutoAnimate<HTMLDivElement>();@@ -33,27 +43,52 @@ function SettingsToggle({<><div className="flex w-full flex-col space-y-4 lg:flex-row lg:space-x-4 lg:space-y-0"><fieldset className="block w-full flex-col sm:flex">- <div className="flex space-x-3">- <Switch- data-testid={rest["data-testid"]}- fitToHeight={true}- checked={checked}- onCheckedChange={onCheckedChange}- disabled={disabled}- tooltip={tooltip}- />+ {toggleSwitchAtTheEnd ? (+ <div className={classNames("flex justify-between space-x-3", switchContainerClassName)}>+ <div>+ <div className="flex items-center">+ <Label className="text-emphasis text-base font-semibold leading-none">+ {title}+ {LockedIcon}+ </Label>+ {Badge}+ </div>+ {description && <p className="text-default -mt-1.5 text-sm leading-normal">{description}</p>}+ </div>+ <div className="my-auto h-full">+ <Switch+ data-testid={rest["data-testid"]}+ fitToHeight={true}+ checked={checked}+ onCheckedChange={onCheckedChange}+ disabled={disabled}+ tooltip={tooltip}+ />+ </div>+ </div>+ ) : (+ <div className="flex space-x-3">+ <Switch+ data-testid={rest["data-testid"]}+ fitToHeight={true}+ checked={checked}+ onCheckedChange={onCheckedChange}+ disabled={disabled}+ tooltip={tooltip}+ />- <div>- <Label className="text-emphasis text-sm font-semibold leading-none">- {title}- {LockedIcon}- </Label>- {description && <p className="text-default -mt-1.5 text-sm leading-normal">{description}</p>}+ <div>+ <Label className="text-emphasis text-sm font-semibold leading-none">+ {title}+ {LockedIcon}+ </Label>+ {description && <p className="text-default -mt-1.5 text-sm leading-normal">{description}</p>}+ </div></div>- </div>+ )}{children && (- <div className="lg:ml-14" ref={animateRef}>- {checked && <div className="mt-4">{children}</div>}+ <div className={classNames("lg:ml-14", childrenClassName)} ref={animateRef}>+ {checked && <div className={classNames(!toggleSwitchAtTheEnd && "mt-4")}>{children}</div>}</div>)}</fieldset>