aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
authorJamie Guthrie <jamie.guthrie@gmail.com>2023-08-19 23:04:47 +0200
committerJamie Guthrie <jamie.guthrie@gmail.com>2023-08-19 23:04:47 +0200
commit5a3c8d0ed1ecdce69963e79c95d4f910d86e0537 (patch)
tree3056d813ab12daeacefecebf0fbc645983d7ee7b /modern
parent28d4bf17b1c5217b13f44f69bfdd4bb6b40873ed (diff)
downloadtrackermap-web-5a3c8d0ed1ecdce69963e79c95d4f910d86e0537.tar.gz
trackermap-web-5a3c8d0ed1ecdce69963e79c95d4f910d86e0537.tar.bz2
trackermap-web-5a3c8d0ed1ecdce69963e79c95d4f910d86e0537.zip
Use emojis for flags
Diffstat (limited to 'modern')
-rw-r--r--modern/package.json1
-rw-r--r--modern/src/common/components/LocalizationProvider.js8
-rw-r--r--modern/src/login/LoginPage.js5
3 files changed, 10 insertions, 4 deletions
diff --git a/modern/package.json b/modern/package.json
index 7988d78b..0faec5e7 100644
--- a/modern/package.json
+++ b/modern/package.json
@@ -20,7 +20,6 @@
"maplibre-gl": "^3.0.1",
"moment": "^2.29.4",
"react": "^18.2.0",
- "react-country-flag": "3.1.0",
"react-dom": "^18.2.0",
"react-draggable": "^4.4.5",
"react-mui-dropzone": "^4.0.6",
diff --git a/modern/src/common/components/LocalizationProvider.js b/modern/src/common/components/LocalizationProvider.js
index 226f1be2..a6a14859 100644
--- a/modern/src/common/components/LocalizationProvider.js
+++ b/modern/src/common/components/LocalizationProvider.js
@@ -186,3 +186,11 @@ export const useTranslationKeys = (predicate) => {
const { data } = context.languages[context.language];
return Object.keys(data).filter(predicate);
};
+
+export const getFlagEmoji = (countryCode) => {
+ const codePoints = countryCode
+ .toUpperCase()
+ .split('')
+ .map((char) => 127397 + char.charCodeAt());
+ return String.fromCodePoint(...codePoints);
+};
diff --git a/modern/src/login/LoginPage.js b/modern/src/login/LoginPage.js
index 8a64bebf..3ccb954f 100644
--- a/modern/src/login/LoginPage.js
+++ b/modern/src/login/LoginPage.js
@@ -3,7 +3,6 @@ import moment from 'moment';
import {
useMediaQuery, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link, Snackbar, IconButton, Tooltip, LinearProgress,
} from '@mui/material';
-import ReactCountryFlag from 'react-country-flag';
import makeStyles from '@mui/styles/makeStyles';
import CloseIcon from '@mui/icons-material/Close';
import LockOpenIcon from '@mui/icons-material/LockOpen';
@@ -11,7 +10,7 @@ import { useTheme } from '@mui/material/styles';
import { useDispatch, useSelector } from 'react-redux';
import { useNavigate } from 'react-router-dom';
import { sessionActions } from '../store';
-import { useLocalization, useTranslation } from '../common/components/LocalizationProvider';
+import { useLocalization, useTranslation, getFlagEmoji } from '../common/components/LocalizationProvider';
import LoginLayout from './LoginLayout';
import usePersistedState from '../common/util/usePersistedState';
import { handleLoginTokenListeners, nativeEnvironment, nativePostMessage } from '../common/components/NativeInterface';
@@ -212,7 +211,7 @@ const LoginPage = () => {
<Select label={t('loginLanguage')} value={language} onChange={(e) => setLanguage(e.target.value)}>
{languageList.map((it) => (
<MenuItem key={it.code} value={it.code}>
- <ReactCountryFlag countryCode={it.countryCode} />
+ {getFlagEmoji(it.countryCode)}
&nbsp;&nbsp;
{it.name}
</MenuItem>