diff --git a/package-lock.json b/package-lock.json index 58365acc..4fb1c0a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6142,6 +6142,11 @@ "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.0.0.tgz", "integrity": "sha512-S4AHriUkTX9FoFvL4G8hXDcx6t3gp2HpfCza3Q0v6S78gul2hKWifLQbeW+ZF89+hSm2ZIc/uF3J97ZgytgTRg==" }, + "diacritics": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/diacritics/-/diacritics-1.3.0.tgz", + "integrity": "sha1-PvqHMj67hj5mls67AILUj/PW96E=" + }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -7908,6 +7913,14 @@ } } }, + "i18n-iso-countries": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/i18n-iso-countries/-/i18n-iso-countries-6.2.2.tgz", + "integrity": "sha512-sZJeKs5IP93Y+dq/8/NonrEdOudVVuH6BbZVd66edjxVkKVFMtvbM6EkpTbDO3B+d9qFW9XZqdgmGNgNDzciSw==", + "requires": { + "diacritics": "1.3.0" + } + }, "icss-utils": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz", diff --git a/package.json b/package.json index 2f12f5b2..9a8b4708 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@sentry/node": "^5.24.2", "core-js": "^3.6.5", "cssnano": "^4.1.10", + "i18n-iso-countries": "^6.2.2", "leaflet": "^1.7.1", "leaflet.markercluster": "^1.4.1", "mobx": "^5.15.7", diff --git a/templates/data-providers/index.jsx b/templates/data-providers/index.jsx index 40aaf105..e8d7ccbc 100644 --- a/templates/data-providers/index.jsx +++ b/templates/data-providers/index.jsx @@ -1,5 +1,6 @@ import React, { useEffect, useRef, useLayoutEffect } from 'react' import { Button } from '@oacore/design' +import { countries } from 'i18n-iso-countries/langs/en.json' import styles from './styles.module.css' import DataProvidersSelect from './search' @@ -10,6 +11,11 @@ import { formatNumber } from 'utils/format-number' import Search from 'modules/search-layout' import RepositoriesMap from 'modules/repositories-map' +const getCountryName = (code) => { + const countryName = countries[String(code).toUpperCase()] + return Array.isArray(countryName) ? countryName[0] : countryName +} + const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect @@ -37,19 +43,15 @@ const SearchResults = ({ return ( - {results.slice(0, dataProvidersSize).map((el) => { - console.log(JSON.stringify(el)) - - return ( - - ) - })} + {results.slice(0, dataProvidersSize).map((el) => ( + + ))} {dataProvidersSize < results.length && (