diff --git a/apps/web/components/apps/installation/EventTypeConferencingAppSettings.tsx b/apps/web/components/apps/installation/EventTypeConferencingAppSettings.tsx index 17d3a617fd..c983a9f7fc 100644 --- a/apps/web/components/apps/installation/EventTypeConferencingAppSettings.tsx +++ b/apps/web/components/apps/installation/EventTypeConferencingAppSettings.tsx @@ -2,9 +2,11 @@ import { useMemo } from "react"; import { useFormContext } from "react-hook-form"; import type { UseFormGetValues, UseFormSetValue, Control, FormState } from "react-hook-form"; -import type { TLocationOptions } from "@calcom/features/eventtypes/components/Locations"; -import type { TEventTypeLocation } from "@calcom/features/eventtypes/components/Locations"; -import Locations from "@calcom/features/eventtypes/components/Locations"; +import type { + TLocationOptions, + TEventTypeLocation, +} from "@calcom/features/eventtypes/components/locations/Locations"; +import Locations from "@calcom/features/eventtypes/components/locations/Locations"; import type { LocationFormValues } from "@calcom/features/eventtypes/lib/types"; import type { SingleValueLocationOption } from "@calcom/features/form/components/LocationSelect"; import { useLocale } from "@calcom/lib/hooks/useLocale"; diff --git a/packages/features/eventtypes/components/locations/CalVideoSettings.tsx b/packages/features/eventtypes/components/locations/CalVideoSettings.tsx new file mode 100644 index 0000000000..08e910100b --- /dev/null +++ b/packages/features/eventtypes/components/locations/CalVideoSettings.tsx @@ -0,0 +1,143 @@ +import { ErrorMessage } from "@hookform/error-message"; +import { useFormContext, Controller } from "react-hook-form"; + +import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform"; +import type { FormValues } from "@calcom/features/eventtypes/lib/types"; +import type { CalVideoSettings as CalVideoSettingsType } from "@calcom/features/eventtypes/lib/types"; +import { useLocale } from "@calcom/lib/hooks/useLocale"; +import classNames from "@calcom/ui/classNames"; +import { UpgradeTeamsBadge } from "@calcom/ui/components/badge"; +import { TextField } from "@calcom/ui/components/form"; +import { SettingsToggle } from "@calcom/ui/components/form"; + +import LocationSettingsContainer from "./LocationSettingsContainer"; + +const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSettingsType }) => { + const { t } = useLocale(); + const formMethods = useFormContext(); + const isPlatform = useIsPlatform(); + return ( + + { + return ( + } + /> + ); + }} + /> + + { + return ( + } + /> + ); + }} + /> + + {!isPlatform && ( + { + return ( + } + /> + ); + }} + /> + )} + + { + return ( + } + /> + ); + }} + /> + + {!isPlatform && ( + { + return ( + } + /> + ); + }} + /> + )} + {!isPlatform && ( + { + return ( + } + /> + ); + }} + /> + )} + + (!v || v.trim() === "" ? null : v), + })} + /> + + + ); +}; + +export default CalVideoSettings; diff --git a/packages/features/eventtypes/components/locations/LocationSettingsContainer.tsx b/packages/features/eventtypes/components/locations/LocationSettingsContainer.tsx new file mode 100644 index 0000000000..a62359245f --- /dev/null +++ b/packages/features/eventtypes/components/locations/LocationSettingsContainer.tsx @@ -0,0 +1,11 @@ +const LocationSettingsContainer = ({ children }: { children: React.ReactNode }) => { + return ( +
+
+
{children}
+
+
+ ); +}; + +export default LocationSettingsContainer; diff --git a/packages/features/eventtypes/components/Locations.tsx b/packages/features/eventtypes/components/locations/Locations.tsx similarity index 74% rename from packages/features/eventtypes/components/Locations.tsx rename to packages/features/eventtypes/components/locations/Locations.tsx index bcaf84085f..cdd7003fad 100644 --- a/packages/features/eventtypes/components/Locations.tsx +++ b/packages/features/eventtypes/components/locations/Locations.tsx @@ -25,14 +25,13 @@ import ServerTrans from "@calcom/lib/components/ServerTrans"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import classNames from "@calcom/ui/classNames"; -import { UpgradeTeamsBadge } from "@calcom/ui/components/badge"; import { Button } from "@calcom/ui/components/button"; -import { TextField } from "@calcom/ui/components/form"; -import { SettingsToggle } from "@calcom/ui/components/form"; import { Input } from "@calcom/ui/components/form"; import { Icon } from "@calcom/ui/components/icon"; import { showToast } from "@calcom/ui/components/toast"; +import CalVideoSettings from "./CalVideoSettings"; + export type TEventTypeLocation = Pick; export type TLocationOptions = Pick["locationOptions"]; export type TDestinationCalendar = { integration: string } | null; @@ -342,132 +341,7 @@ const Locations: React.FC = ({ )} - {isCalVideo && !isPlatform && ( -
-
-
- { - return ( - } - /> - ); - }} - /> - - { - return ( - } - /> - ); - }} - /> - - {!isPlatform && ( - { - return ( - } - /> - ); - }} - /> - )} - - { - return ( - } - /> - ); - }} - /> - - {!isPlatform && ( - { - return ( - } - /> - ); - }} - /> - )} - {!isPlatform && ( - { - return ( - } - /> - ); - }} - /> - )} - - (!v || v.trim() === "" ? null : v), - })} - /> - -
-
-
- )} + {isCalVideo && !isPlatform && } {eventLocationType?.organizerInputType && (
diff --git a/packages/features/eventtypes/components/tabs/setup/EventSetupTab.tsx b/packages/features/eventtypes/components/tabs/setup/EventSetupTab.tsx index 56ee20296d..edda79f005 100644 --- a/packages/features/eventtypes/components/tabs/setup/EventSetupTab.tsx +++ b/packages/features/eventtypes/components/tabs/setup/EventSetupTab.tsx @@ -5,8 +5,6 @@ import type { MultiValue } from "react-select"; import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform"; import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager"; -import type { LocationCustomClassNames } from "@calcom/features/eventtypes/components/Locations"; -import Locations from "@calcom/features/eventtypes/components/Locations"; import type { EventTypeSetupProps, InputClassNames, @@ -28,6 +26,9 @@ import { Select } from "@calcom/ui/components/form"; import { SettingsToggle } from "@calcom/ui/components/form"; import { Skeleton } from "@calcom/ui/components/skeleton"; +import type { LocationCustomClassNames } from "../../locations/Locations"; +import Locations from "../../locations/Locations"; + export type EventSetupTabCustomClassNames = { wrapper?: string; titleSection?: { diff --git a/packages/features/eventtypes/lib/types.ts b/packages/features/eventtypes/lib/types.ts index d5d34505f7..cd74f47195 100644 --- a/packages/features/eventtypes/lib/types.ts +++ b/packages/features/eventtypes/lib/types.ts @@ -168,15 +168,7 @@ export type FormValues = { restrictionScheduleId: number | null; useBookerTimezone: boolean; restrictionScheduleName: string | null; - calVideoSettings?: { - disableRecordingForOrganizer?: boolean; - disableRecordingForGuests?: boolean; - enableAutomaticTranscription?: boolean; - enableAutomaticRecordingForOrganizer?: boolean; - disableTranscriptionForGuests?: boolean; - disableTranscriptionForOrganizer?: boolean; - redirectUrlOnExit?: string; - }; + calVideoSettings?: CalVideoSettings; maxActiveBookingPerBookerOfferReschedule: boolean; }; @@ -243,3 +235,13 @@ export interface EventTypePlatformWrapperRef { validateForm: () => Promise; handleFormSubmit: (callbacks?: { onSuccess?: () => void; onError?: (error: Error) => void }) => void; } + +export interface CalVideoSettings { + disableRecordingForOrganizer?: boolean; + disableRecordingForGuests?: boolean; + enableAutomaticTranscription?: boolean; + enableAutomaticRecordingForOrganizer?: boolean; + disableTranscriptionForGuests?: boolean; + disableTranscriptionForOrganizer?: boolean; + redirectUrlOnExit?: string; +}