fix: add location publicly
parent
52b3120fd9
commit
82c5f6f22c
|
@ -8,7 +8,7 @@ import { Controller, useFormContext, useFieldArray } from "react-hook-form";
|
|||
import type { MultiValue } from "react-select";
|
||||
|
||||
import type { EventLocationType } from "@calcom/app-store/locations";
|
||||
import { getEventLocationType, LocationType, MeetLocationType } from "@calcom/app-store/locations";
|
||||
import { getEventLocationType, MeetLocationType } from "@calcom/app-store/locations";
|
||||
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import { CAL_URL } from "@calcom/lib/constants";
|
||||
|
@ -256,21 +256,22 @@ export const EventSetupTab = (
|
|||
|
||||
const [showEmptyLocationSelect, setShowEmptyLocationSelect] = useState(false);
|
||||
const [selectedNewOption, setSelectedNewOption] = useState<SingleValueLocationOption | null>(null);
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<ul ref={animationRef} className="space-y-2">
|
||||
{locationFields.map((field, index) => {
|
||||
const eventLocationType = getEventLocationType(field.type);
|
||||
const defaultLocation = formMethods
|
||||
.getValues("locations")
|
||||
?.find((location: { type: EventLocationType["type"]; address?: string }) => {
|
||||
if (location.type === LocationType.InPerson) {
|
||||
return location.type === eventLocationType?.type && location.address === field?.address;
|
||||
} else {
|
||||
return location.type === eventLocationType?.type;
|
||||
}
|
||||
});
|
||||
const defaultLocation = formMethods.getValues("locations")?.find((location) => {
|
||||
if (eventLocationType?.organizerInputType) {
|
||||
return (
|
||||
location.type === eventLocationType?.type &&
|
||||
location[eventLocationType.defaultValueVariable] ===
|
||||
field?.[eventLocationType.defaultValueVariable]
|
||||
);
|
||||
} else {
|
||||
return location.type === eventLocationType?.type;
|
||||
}
|
||||
});
|
||||
|
||||
const option = getLocationFromType(field.type, locationOptions);
|
||||
|
||||
|
@ -338,6 +339,7 @@ export const EventSetupTab = (
|
|||
</div>
|
||||
<div className="ml-6">
|
||||
<CheckboxField
|
||||
name={`locations[${index}].displayLocationPublicly`}
|
||||
data-testid="display-location"
|
||||
defaultChecked={defaultLocation?.displayLocationPublicly}
|
||||
description={t("display_location_label")}
|
||||
|
|
Loading…
Reference in New Issue