Skip to content

Commit e4e6b05

Browse files
authored
Merge branch 'master' into feat/pro-stats
2 parents c82e144 + e2239b2 commit e4e6b05

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/pages/UserSettings/content/sections/UserInfos.section.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Field } from 'react-final-form';
2-
import { countries } from 'countries-list';
2+
import { getCountryDataList, getEmojiFlag } from 'countries-list';
33
import { observer } from 'mobx-react';
44
import { FieldInput, FieldTextarea, Username } from 'oa-components';
55
import { SelectField } from 'src/common/Form/Select.field';
@@ -17,6 +17,11 @@ import { ProfileTags } from './ProfileTags.section';
1717

1818
import type { ProfileFormData } from 'oa-shared';
1919

20+
const countryOptions = getCountryDataList().map((country) => ({
21+
label: `${getEmojiFlag(country.iso2)} ${country.native}`,
22+
value: country.iso2,
23+
}));
24+
2025
interface IProps {
2126
formValues: Partial<ProfileFormData>;
2227
}
@@ -92,10 +97,7 @@ export const UserInfosSection = observer(({ formValues }: IProps) => {
9297
<Field data-cy="country-dropdown" name="country">
9398
{(field) => (
9499
<SelectField
95-
options={Object.keys(countries).map((countryCode) => ({
96-
label: `${countries[countryCode].emoji} ${countries[countryCode].native}`,
97-
value: countryCode, // Use the country code (e.g., 'US', 'PT') as the value
98-
}))}
100+
options={countryOptions}
99101
placeholder="Select your country..."
100102
{...field}
101103
/>

0 commit comments

Comments
 (0)