diff --git a/apps/web/components/dialog/EditLocationDialog.tsx b/apps/web/components/dialog/EditLocationDialog.tsx index 8c04866436..11bd6f8251 100644 --- a/apps/web/components/dialog/EditLocationDialog.tsx +++ b/apps/web/components/dialog/EditLocationDialog.tsx @@ -17,7 +17,7 @@ import { import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { RouterOutputs, trpc } from "@calcom/trpc/react"; -import { Button, Dialog, DialogContent, Form, Icon, PhoneInput } from "@calcom/ui"; +import { Button, Dialog, DialogClose, DialogContent, DialogFooter, Form, Icon, PhoneInput } from "@calcom/ui"; import { QueryCell } from "@lib/QueryCell"; @@ -212,13 +212,13 @@ export const EditLocationDialog = (props: ISetLocationDialog) => { return ( - -
-
-
- -
-
+ +
+
+ +
+
+
@@ -226,148 +226,152 @@ export const EditLocationDialog = (props: ISetLocationDialog) => {

{t("this_input_will_shown_booking_this_event")}

)}
-
-
- {booking && ( - <> -

{t("current_location")}:

-

- {getHumanReadableLocationValue(booking.location, t)} -

- - )} -
{ - const { locationType: newLocation, displayLocationPublicly } = values; +
- let details = {}; - if (newLocation === LocationType.InPerson) { - details = { - address: values.locationAddress, - }; - } - const eventLocationType = getEventLocationType(newLocation); + {booking && ( + <> +

{t("current_location")}:

+

+ {getHumanReadableLocationValue(booking.location, t)} +

+ + )} + { + const { locationType: newLocation, displayLocationPublicly } = values; - // TODO: There can be a property that tells if it is to be saved in `link` - if ( - newLocation === LocationType.Link || - (!eventLocationType?.default && eventLocationType?.linkType === "static") - ) { - details = { link: values.locationLink }; - } - - if (newLocation === LocationType.UserPhone) { - details = { hostPhoneNumber: values.locationPhoneNumber }; - } - - if (eventLocationType?.organizerInputType) { - details = { - ...details, - displayLocationPublicly, - }; - } - - saveLocation(newLocation, details); - setShowLocationModal(false); - setSelectedLocation?.(undefined); - locationFormMethods.unregister([ - "locationType", - "locationLink", - "locationAddress", - "locationPhoneNumber", - ]); - }}> - { - if (!locationOptions.length) return null; - if (booking) { - locationOptions.forEach((location) => { - if (location.label === "phone") { - location.options.filter((l) => l.value !== "phone"); - } else if (location.label === "in person") { - location.options.filter((l) => l.value !== "attendeeInPerson"); - } - }); + let details = {}; + if (newLocation === LocationType.InPerson) { + details = { + address: values.locationAddress, + }; } - return ( - ( - - maxMenuHeight={150} - name="location" - defaultValue={selection} - options={locationOptions} - components={{ - Option: (props) => ( - -
- {props.data.icon && ( - cover - )} - - {props.data.label} - -
-
- ), - }} - formatOptionLabel={(e) => ( -
- {e.icon && app-icon} - {e.label} -
- )} - formatGroupLabel={(e) => ( -

{e.label}

- )} - isSearchable - className="my-4 block w-full min-w-0 flex-1 rounded-sm border border-gray-300 text-sm" - onChange={(val) => { - if (val) { - locationFormMethods.setValue("locationType", val.value); - locationFormMethods.unregister([ - "locationLink", - "locationAddress", - "locationPhoneNumber", - ]); - locationFormMethods.clearErrors([ - "locationLink", - "locationPhoneNumber", - "locationAddress", - ]); - setSelectedLocation?.(val); - } - }} - /> - )} - /> - ); - }} - /> - {selectedLocation && LocationOptions} -
- - -
- + /> + {selectedLocation && LocationOptions} + +
+ + + +
+
+ +