diff --git a/package.json b/package.json index 5d8f25926..867f01c21 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "bowser": "^2.11.0", "connect-typeorm": "^1.1.4", "cookie-parser": "^1.4.5", - "country-code-emoji": "^2.2.0", + "country-flag-icons": "^1.2.9", "csurf": "^1.11.0", "email-templates": "^8.0.3", "express": "^4.17.1", @@ -83,6 +83,7 @@ "@types/bcrypt": "^3.0.0", "@types/body-parser": "^1.19.0", "@types/cookie-parser": "^1.4.2", + "@types/country-flag-icons": "^1.2.0", "@types/csurf": "^1.11.0", "@types/email-templates": "^8.0.2", "@types/express": "^4.17.11", diff --git a/src/components/RegionSelector/index.tsx b/src/components/RegionSelector/index.tsx index 5d717c18b..a254eaf16 100644 --- a/src/components/RegionSelector/index.tsx +++ b/src/components/RegionSelector/index.tsx @@ -1,10 +1,11 @@ import React, { useEffect, useMemo, useState } from 'react'; import { Listbox, Transition } from '@headlessui/react'; -import { countryCodeEmoji } from 'country-code-emoji'; import useSWR from 'swr'; import type { Region } from '../../../server/lib/settings'; import { defineMessages, useIntl } from 'react-intl'; import useSettings from '../../hooks/useSettings'; +import { hasFlag } from 'country-flag-icons'; +import 'country-flag-icons/3x2/flags.css'; const messages = defineMessages({ regionDefault: 'All Regions', @@ -64,11 +65,15 @@ const RegionSelector: React.FC = ({
- {selectedRegion && selectedRegion.iso_3166_1 !== 'all' && ( - - {countryCodeEmoji(selectedRegion.iso_3166_1)} - - )} + {selectedRegion && + selectedRegion.iso_3166_1 !== 'all' && + hasFlag(selectedRegion?.iso_3166_1) && ( + + + + )} {selectedRegion && selectedRegion.iso_3166_1 !== 'all' ? intl.formatDisplayName(selectedRegion.iso_3166_1, { @@ -180,7 +185,7 @@ const RegionSelector: React.FC = ({ {intl.formatMessage(messages.regionDefault)} @@ -217,8 +222,14 @@ const RegionSelector: React.FC = ({ : 'text-gray-300' } cursor-default select-none relative py-2 pl-8 pr-4 flex items-center`} > - - {countryCodeEmoji(region.iso_3166_1)} + +