Repository: twentyhq/twenty
File: packages/twenty-front/src/modules/settings/data-model/fields/forms/currency/components/SettingsDataModelFieldCurrencyForm.tsx (TypeScript)

Code before:
        )}
      />
      <Separator />
      <Controller
        name="settings"
        control={control}
        defaultValue={initialSettingsValue}
        render={({ field: { onChange, value } }) => {
          const format = value?.format ?? 'short';
          const decimals = value?.decimals ?? DEFAULT_DECIMAL_VALUE;

          return (
            <>
              <SettingsOptionCardContentSelect
                Icon={IconCheckbox}
                title={t`Format`}
                description={t`Choose between Short and Full`}
              >
                <Select<FieldCurrencyFormat>
                  dropdownWidth={140}
                  value={format}
                  onChange={(newFormat) =>
                    onChange({
                      format: newFormat,
                      decimals:
                        newFormat === 'short'
                          ? DEFAULT_DECIMAL_VALUE
                          : decimals,
                    })
                  }
                  disabled={disabled}
                  dropdownId="object-field-format-select"
                  options={[
                    { label: 'Short', value: 'short' },
                    { label: 'Full', value: 'full' },
                  ]}
                  selectSizeVariant="small"
                  withSearchInput={false}
                />
              </SettingsOptionCardContentSelect>
              <Separator />
              {format === 'full' && (
                <SettingsOptionCardContentCounter
                  Icon={IconDecimal}
                  title={t`Number of decimals`}
                  description={plural(decimals, {
                    one: `E.g. ${(1000).toFixed(decimals)} for ${decimals} decimal`,
                    other: `E.g. ${(1000).toFixed(decimals)} for ${decimals} decimals`,
                  })}
                  value={decimals}
                  onChange={(newDecimals: number) =>

Review comment (suggestion):
Let's maybe update to use clean const (update fieldMetadataCurrencyFormat) instead of hardcoded values for 'short', 'shortNumber', etc

Code after:
              withSearchInput={true}
            />
          </SettingsOptionCardContentSelect>
        )}
      />
      <Separator />
      <Controller
        name="settings"
        control={control}
        defaultValue={initialSettingsValue}
        render={({ field: { onChange, value } }) => {
          const format = value?.format ?? fieldMetadataCurrencyFormat[0];
          const decimals = value?.decimals ?? DEFAULT_DECIMAL_VALUE;

          return (
            <>
              <SettingsOptionCardContentSelect
                Icon={IconCheckbox}
                title={t`Format`}
                description={t`Choose between Short and Full`}
              >
                <Select<FieldCurrencyFormat>
                  dropdownWidth={140}
                  value={format}
                  onChange={(newFormat) =>
                    onChange({
                      format: newFormat,
                      decimals:
                        newFormat === fieldMetadataCurrencyFormat[0]
                          ? DEFAULT_DECIMAL_VALUE
                          : decimals,
                    })
                  }
                  disabled={disabled}
                  dropdownId="object-field-format-select"
                  options={[
                    { label: 'Short', value: fieldMetadataCurrencyFormat[0] },
                    { label: 'Full', value: fieldMetadataCurrencyFormat[1] },
                  ]}
                  selectSizeVariant="small"
                  withSearchInput={false}
                />
              </SettingsOptionCardContentSelect>
              <Separator />
              {format === 'full' && (
                <SettingsOptionCardContentCounter
                  Icon={IconDecimal}
                  title={t`Number of decimals`}
                  description={plural(decimals, {
                    one: `E.g. ${(1000).toFixed(decimals)} for ${decimals} decimal`,
                    other: `E.g. ${(1000).toFixed(decimals)} for ${decimals} decimals`,