diff --git a/packages/features/eventtypes/components/tabs/recurring/EventRecurringTab.tsx b/packages/features/eventtypes/components/tabs/recurring/EventRecurringTab.tsx index 2a2aec5d87..ed62fa493e 100644 --- a/packages/features/eventtypes/components/tabs/recurring/EventRecurringTab.tsx +++ b/packages/features/eventtypes/components/tabs/recurring/EventRecurringTab.tsx @@ -1,12 +1,20 @@ -import type { EventRecurringWebWrapperProps } from "@calcom/atoms/event-types/wrappers/EventRecurringWebWrapper"; import getPaymentAppData from "@calcom/lib/getPaymentAppData"; +import type { RecurringEventControllerProps } from "./RecurringEventController"; import RecurringEventController from "./RecurringEventController"; -export const EventRecurringTab = ({ eventType }: EventRecurringWebWrapperProps) => { +export type EventRecurringTabProps = Omit; + +export const EventRecurringTab = ({ eventType, customClassNames }: EventRecurringTabProps) => { const paymentAppData = getPaymentAppData(eventType); const requirePayment = paymentAppData.price > 0; - return ; + return ( + + ); }; diff --git a/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx b/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx index 3822009f25..65c475c56b 100644 --- a/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx +++ b/packages/features/eventtypes/components/tabs/recurring/RecurringEventController.tsx @@ -2,7 +2,12 @@ import { useState } from "react"; import { useFormContext } from "react-hook-form"; import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager"; -import type { EventTypeSetup } from "@calcom/features/eventtypes/lib/types"; +import type { + EventTypeSetup, + InputClassNames, + SelectClassNames, + SettingsToggleClassNames, +} from "@calcom/features/eventtypes/lib/types"; import type { FormValues } from "@calcom/features/eventtypes/lib/types"; import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; @@ -10,14 +15,31 @@ import { Frequency } from "@calcom/prisma/zod-utils"; import type { RecurringEvent } from "@calcom/types/Calendar"; import { Alert, Select, SettingsToggle, TextField } from "@calcom/ui"; -type RecurringEventControllerProps = { +export type RecurringEventControllerProps = { eventType: EventTypeSetup; paymentEnabled: boolean; + customClassNames?: EventRecurringTabCustomClassNames; +}; + +export type EventRecurringTabCustomClassNames = { + container?: string; + recurringToggle?: SettingsToggleClassNames; + frequencyInput?: InputClassNames; + frequencyUnitSelect?: SelectClassNames; + maxEventsInput?: { + countInput?: string; + labelText?: string; + suffixText?: string; + container?: string; + }; + experimentalAlert?: string; + paymentAlert?: string; }; export default function RecurringEventController({ eventType, paymentEnabled, + customClassNames, }: RecurringEventControllerProps) { const { t } = useLocale(); const formMethods = useFormContext(); @@ -37,25 +59,31 @@ export default function RecurringEventController({ const recurringLocked = shouldLockDisableProps("recurringEvent"); return ( -
+
{paymentEnabled ? ( - + ) : ( <>
-

{t("repeats_every")}

+

+ {t("repeats_every")} +

{ const newVal = { @@ -100,7 +134,11 @@ export default function RecurringEventController({ options={recurringEventFreqOptions} value={recurringEventFreqOptions[recurringEventState.freq]} isSearchable={false} - className="w-18 ml-2 block min-w-0 rounded-md text-sm" + className={classNames( + "w-18 ml-2 block min-w-0 rounded-md text-sm", + customClassNames?.frequencyUnitSelect?.select + )} + innerClassNames={customClassNames?.frequencyUnitSelect?.innerClassNames} isDisabled={recurringLocked.disabled} onChange={(event) => { const newVal = { @@ -112,15 +150,25 @@ export default function RecurringEventController({ }} />
-
-

{t("for_a_maximum_of")}

+
+

+ {t("for_a_maximum_of")} +

{ const newVal = { ...recurringEventState, @@ -130,7 +178,11 @@ export default function RecurringEventController({ setRecurringEventState(newVal); }} /> -

+

{t("events", { count: recurringEventState.count, })} diff --git a/packages/features/eventtypes/lib/types.ts b/packages/features/eventtypes/lib/types.ts index 3d0390b5b5..5e5d64a2c7 100644 --- a/packages/features/eventtypes/lib/types.ts +++ b/packages/features/eventtypes/lib/types.ts @@ -166,3 +166,37 @@ export type TabMap = { workflows?: React.ReactNode; payments?: React.ReactNode; }; + +export type SettingsToggleClassNames = { + container?: string; + label?: string; + description?: string; + children?: string; +}; + +export type InputClassNames = { + container?: string; + label?: string; + input?: string; + addOn?: string; +}; +export type CheckboxClassNames = { + checkbox?: string; + description?: string; + container?: string; +}; +export type SelectClassNames = { + innerClassNames?: { + input?: string; + option?: string; + control?: string; + singleValue?: string; + valueContainer?: string; + multiValue?: string; + menu?: string; + menuList?: string; + }; + select?: string; + label?: string; + container?: string; +}; diff --git a/packages/platform/atoms/event-types/wrappers/EventRecurringTabPlatformWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventRecurringTabPlatformWrapper.tsx index c7436e91d5..d14f94dd03 100644 --- a/packages/platform/atoms/event-types/wrappers/EventRecurringTabPlatformWrapper.tsx +++ b/packages/platform/atoms/event-types/wrappers/EventRecurringTabPlatformWrapper.tsx @@ -1,9 +1,7 @@ +import type { EventRecurringTabProps } from "@calcom/features/eventtypes/components/tabs/recurring/EventRecurringTab"; import { EventRecurringTab } from "@calcom/features/eventtypes/components/tabs/recurring/EventRecurringTab"; -import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types"; -export type EventRecurringWebWrapperProps = Pick; - -const EventRecurringTabPlatformWrapper = (props: EventRecurringWebWrapperProps) => { +const EventRecurringTabPlatformWrapper = (props: EventRecurringTabProps) => { return ; }; diff --git a/packages/platform/atoms/event-types/wrappers/EventRecurringWebWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventRecurringWebWrapper.tsx index 5061a9a4e3..846fa74869 100644 --- a/packages/platform/atoms/event-types/wrappers/EventRecurringWebWrapper.tsx +++ b/packages/platform/atoms/event-types/wrappers/EventRecurringWebWrapper.tsx @@ -1,9 +1,7 @@ +import type { EventRecurringTabProps } from "@calcom/features/eventtypes/components/tabs/recurring/EventRecurringTab"; import { EventRecurringTab } from "@calcom/features/eventtypes/components/tabs/recurring/EventRecurringTab"; -import type { EventTypeSetupProps } from "@calcom/features/eventtypes/lib/types"; -export type EventRecurringWebWrapperProps = Pick; - -const EventRecurringWebWrapper = (props: EventRecurringWebWrapperProps) => { +const EventRecurringWebWrapper = (props: EventRecurringTabProps) => { return ; }; diff --git a/packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx b/packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx index 10ce1abab4..ea3924c960 100644 --- a/packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx +++ b/packages/platform/atoms/event-types/wrappers/EventTypePlatformWrapper.tsx @@ -6,6 +6,7 @@ import { useRef, useState, useEffect } from "react"; import type { ChildrenEventType } from "@calcom/features/eventtypes/components/ChildrenEventTypeSelect"; import { EventType as EventTypeComponent } from "@calcom/features/eventtypes/components/EventType"; import ManagedEventTypeDialog from "@calcom/features/eventtypes/components/dialogs/ManagedEventDialog"; +import type { EventRecurringTabCustomClassNames } from "@calcom/features/eventtypes/components/tabs/recurring/RecurringEventController"; import type { EventTypeSetupProps, FormValues, TabMap } from "@calcom/features/eventtypes/lib/types"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { SchedulingType } from "@calcom/prisma/enums"; @@ -30,6 +31,11 @@ import EventTeamAssignmentTabPlatformWrapper from "./EventTeamAssignmentTabPlatf export type PlatformTabs = keyof Omit; +export type EventTypeCustomClassNames = { + atomsWrapper?: string; + eventRecurringTab?: EventRecurringTabCustomClassNames; +}; + export type EventTypePlatformWrapperProps = { id: number; tabs?: PlatformTabs[]; @@ -38,9 +44,7 @@ export type EventTypePlatformWrapperProps = { onDeleteSuccess?: () => void; onDeleteError?: (msg: string) => void; allowDelete: boolean; - customClassNames?: { - atomsWrapper?: string; - }; + customClassNames?: EventTypeCustomClassNames; disableToasts?: boolean; }; @@ -178,7 +182,10 @@ const EventType = ({ limits: tabs.includes("limits") ? : <>, instant: <>, recurring: tabs.includes("recurring") ? ( - + ) : ( <> ), diff --git a/packages/platform/examples/base/src/pages/event-types.tsx b/packages/platform/examples/base/src/pages/event-types.tsx index debf207ce0..a20b070810 100644 --- a/packages/platform/examples/base/src/pages/event-types.tsx +++ b/packages/platform/examples/base/src/pages/event-types.tsx @@ -95,7 +95,47 @@ export default function Bookings(props: { calUsername: string; calEmail: string {eventTypeId && (