diff --git a/client/src/pages/openalex-ror/components/ror-name.jsx b/client/src/pages/openalex-ror/components/ror-name.jsx index 0150336..f008216 100644 --- a/client/src/pages/openalex-ror/components/ror-name.jsx +++ b/client/src/pages/openalex-ror/components/ror-name.jsx @@ -1,5 +1,6 @@ import { Badge } from '@dataesr/dsfr-plus'; import PropTypes from 'prop-types'; +import getFlagEmoji from '../../../utils/flags'; export default function RorName({ isRemoved, ror }) { return ( @@ -23,10 +24,7 @@ export default function RorName({ isRemoved, ror }) { ror.rorName )} - {`${ror.rorCountry} + {getFlagEmoji(ror.rorCountry)} {isRemoved && ( affiliation.rors.map((ror) => ror.rorCountry)))] .sort((a, b) => allAffiliations.filter((aff) => aff.rors.some((r) => r.rorCountry === b)).length - allAffiliations.filter((aff) => aff.rors.some((r) => r.rorCountry === a)).length) .map((country) => ( - )) diff --git a/client/src/utils/flags.jsx b/client/src/utils/flags.jsx new file mode 100644 index 0000000..940660c --- /dev/null +++ b/client/src/utils/flags.jsx @@ -0,0 +1,7 @@ +export default function getFlagEmoji(countryCode) { + const codePoints = countryCode + .toUpperCase() + .split('') + .map((char) => 127397 + char.charCodeAt()); + return String.fromCodePoint(...codePoints); +}