chore: variables names (#12352)
This commit is contained in:
parent
6b2c59b733
commit
b945849736
|
@ -428,10 +428,11 @@ export const getTranslatedLocation = (
|
||||||
return translatedLocation;
|
return translatedLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getOrganizerInputLocationsType = () => {
|
export const getOrganizerInputLocationTypes = () => {
|
||||||
const locationTypes: DefaultEventLocationType["type"] | EventLocationTypeFromApp["type"][] = [];
|
const result: DefaultEventLocationType["type"] | EventLocationTypeFromApp["type"][] = [];
|
||||||
const locations = locationsTypes.filter((location) => !!location.organizerInputType);
|
|
||||||
locations?.forEach((l) => locationTypes.push(l.type));
|
|
||||||
|
|
||||||
return locationTypes;
|
const locations = locationsTypes.filter((location) => !!location.organizerInputType);
|
||||||
|
locations?.forEach((l) => result.push(l.type));
|
||||||
|
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { useFormContext } from "react-hook-form";
|
import { useFormContext } from "react-hook-form";
|
||||||
|
|
||||||
import type { LocationObject } from "@calcom/app-store/locations";
|
import type { LocationObject } from "@calcom/app-store/locations";
|
||||||
import { getOrganizerInputLocationsType } from "@calcom/app-store/locations";
|
import { getOrganizerInputLocationTypes } from "@calcom/app-store/locations";
|
||||||
import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
|
import type { GetBookingType } from "@calcom/features/bookings/lib/get-booking";
|
||||||
import getLocationOptionsForSelect from "@calcom/features/bookings/lib/getLocationOptionsForSelect";
|
import getLocationOptionsForSelect from "@calcom/features/bookings/lib/getLocationOptionsForSelect";
|
||||||
import { FormBuilderField } from "@calcom/features/form-builder/FormBuilderField";
|
import { FormBuilderField } from "@calcom/features/form-builder/FormBuilderField";
|
||||||
|
@ -107,14 +107,14 @@ export const BookingFields = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (field?.options) {
|
if (field?.options) {
|
||||||
const organzierInputTypes = getOrganizerInputLocationsType();
|
const organizerInputTypes = getOrganizerInputLocationTypes();
|
||||||
const organzierInputObj: Record<string, number> = {};
|
const organizerInputObj: Record<string, number> = {};
|
||||||
|
|
||||||
field.options.forEach((f) => {
|
field.options.forEach((f) => {
|
||||||
if (f.value in organzierInputObj) {
|
if (f.value in organizerInputObj) {
|
||||||
organzierInputObj[f.value]++;
|
organizerInputObj[f.value]++;
|
||||||
} else {
|
} else {
|
||||||
organzierInputObj[f.value] = 1;
|
organizerInputObj[f.value] = 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ export const BookingFields = ({
|
||||||
return {
|
return {
|
||||||
...field,
|
...field,
|
||||||
value:
|
value:
|
||||||
organzierInputTypes.includes(field.value) && organzierInputObj[field.value] > 1
|
organizerInputTypes.includes(field.value) && organizerInputObj[field.value] > 1
|
||||||
? field.label
|
? field.label
|
||||||
: field.value,
|
: field.value,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user