make international tel codes a static object
This commit is contained in:
@@ -4,8 +4,8 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getCountriesWithTelephoneCodes,
|
|
||||||
getDefaultCountry,
|
getDefaultCountry,
|
||||||
|
INTERNATIONAL_TELEPHONE_CODES,
|
||||||
} from '#/lib/international-telephone-codes'
|
} from '#/lib/international-telephone-codes'
|
||||||
import {isWeb} from '#/platform/detection'
|
import {isWeb} from '#/platform/detection'
|
||||||
import {useGeolocationStatus} from '#/state/geolocation'
|
import {useGeolocationStatus} from '#/state/geolocation'
|
||||||
@@ -33,15 +33,13 @@ export function InternationalPhoneCodeSelect({
|
|||||||
}, [location])
|
}, [location])
|
||||||
|
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
const telCountryMap = getCountriesWithTelephoneCodes(i18n)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Object.entries(telCountryMap)
|
Object.entries(INTERNATIONAL_TELEPHONE_CODES)
|
||||||
.map(([value, {name, code, unicodeFlag, svgFlag}]) => ({
|
.map(([value, {name, code, unicodeFlag, svgFlag}]) => ({
|
||||||
value,
|
value,
|
||||||
name,
|
name: name(i18n),
|
||||||
code,
|
code,
|
||||||
label: `${name} ${code}`,
|
label: `${name(i18n)} ${code}`,
|
||||||
unicodeFlag,
|
unicodeFlag,
|
||||||
svgFlag,
|
svgFlag,
|
||||||
}))
|
}))
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user