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