mirror of
https://github.com/lingble/twenty.git
synced 2025-11-01 05:07:56 +00:00
lint
This commit is contained in:
@@ -43,14 +43,14 @@ export const computeDraftValueFromFieldValue = <FieldValue>({
|
|||||||
} as unknown as FieldInputDraftValue<FieldValue>;
|
} as unknown as FieldInputDraftValue<FieldValue>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isFieldAddress(fieldDefinition)){
|
if (isFieldAddress(fieldDefinition)) {
|
||||||
if(
|
if (
|
||||||
isFieldValueEmpty({ fieldValue, fieldDefinition })
|
isFieldValueEmpty({ fieldValue, fieldDefinition }) &&
|
||||||
&& fieldDefinition.metadata.settings?.defaultCountry
|
!!fieldDefinition.metadata.settings?.defaultCountry
|
||||||
){
|
) {
|
||||||
return {
|
return {
|
||||||
...fieldValue,
|
...fieldValue,
|
||||||
addressCountry: fieldDefinition.metadata.settings.defaultCountry
|
addressCountry: fieldDefinition.metadata.settings.defaultCountry,
|
||||||
} as unknown as FieldInputDraftValue<FieldValue>;
|
} as unknown as FieldInputDraftValue<FieldValue>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,23 +40,24 @@ export const SettingsDataModelFieldAddressForm = ({
|
|||||||
fieldMetadataItem,
|
fieldMetadataItem,
|
||||||
}: SettingsDataModelFieldAddressFormProps) => {
|
}: SettingsDataModelFieldAddressFormProps) => {
|
||||||
const { control } = useFormContext<SettingsDataModelFieldTextFormValues>();
|
const { control } = useFormContext<SettingsDataModelFieldTextFormValues>();
|
||||||
const countries = useCountries().map(country => ({
|
const countries = useCountries().map((country) => ({
|
||||||
label: country.countryName,
|
label: country.countryName,
|
||||||
value: country.countryName
|
value: country.countryName,
|
||||||
}))
|
}));
|
||||||
return (
|
return (
|
||||||
<Controller
|
<Controller
|
||||||
name="settings"
|
name="settings"
|
||||||
defaultValue={{
|
defaultValue={{
|
||||||
defaultCountry: fieldMetadataItem?.settings?.defaultCountry || 'United States',
|
defaultCountry:
|
||||||
}}
|
fieldMetadataItem?.settings?.defaultCountry || 'United States',
|
||||||
control={control}
|
}}
|
||||||
render={({ field: { onChange, value } }) => {
|
control={control}
|
||||||
const defaultCountry = value?.defaultCountry ?? 0;
|
render={({ field: { onChange, value } }) => {
|
||||||
|
const defaultCountry = value?.defaultCountry ?? 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SettingsOptionCardContentSelect
|
<SettingsOptionCardContentSelect
|
||||||
Icon={IconMap}
|
Icon={IconMap}
|
||||||
dropdownId="selectDefaultCountry"
|
dropdownId="selectDefaultCountry"
|
||||||
title="Default Country"
|
title="Default Country"
|
||||||
@@ -66,9 +67,9 @@ export const SettingsDataModelFieldAddressForm = ({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
options={countries}
|
options={countries}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user