fix: add location publicly

fix/organizer-location
Udit Takkar 2023-10-26 15:22:48 +05:30
parent 52b3120fd9
commit 82c5f6f22c
1 changed files with 13 additions and 11 deletions

View File

@ -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")}