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