diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2023-08-19 18:04:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-19 18:04:34 -0700 |
commit | 2a51674d7efdefa917a54f293a10d915605ede0a (patch) | |
tree | 8d77586112266238af7aa6e45209056fcd08bc81 /modern/src | |
parent | c36d1bed4a8781b2307fe2bfcdd1c6d4ddd00d64 (diff) | |
parent | 651e03d16e0609ff57aafd41334feed3441288ba (diff) | |
download | trackermap-web-2a51674d7efdefa917a54f293a10d915605ede0a.tar.gz trackermap-web-2a51674d7efdefa917a54f293a10d915605ede0a.tar.bz2 trackermap-web-2a51674d7efdefa917a54f293a10d915605ede0a.zip |
Merge pull request #1165 from jguthrie100/add_country_flags
Use country flags in language select
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/common/components/LocalizationProvider.jsx | 3 | ||||
-rw-r--r-- | modern/src/login/LoginPage.jsx | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/modern/src/common/components/LocalizationProvider.jsx b/modern/src/common/components/LocalizationProvider.jsx index 1c87bc7d..2ace1e24 100644 --- a/modern/src/common/components/LocalizationProvider.jsx +++ b/modern/src/common/components/LocalizationProvider.jsx @@ -186,6 +186,3 @@ export const useTranslationKeys = (predicate) => { const { data } = context.languages[context.language]; return Object.keys(data).filter(predicate); }; - -export const getFlagEmoji = (country) => String.fromCodePoint(...[...country].map(x=>0x1f1a5+x.charCodeAt())); - diff --git a/modern/src/login/LoginPage.jsx b/modern/src/login/LoginPage.jsx index 5dcdbeb4..cdcd6df6 100644 --- a/modern/src/login/LoginPage.jsx +++ b/modern/src/login/LoginPage.jsx @@ -3,6 +3,7 @@ import moment from 'moment'; import { useMediaQuery, InputLabel, Select, MenuItem, FormControl, Button, TextField, Link, Snackbar, IconButton, Tooltip, LinearProgress, Box, } 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'; @@ -10,7 +11,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, getFlagEmoji } from '../common/components/LocalizationProvider'; +import { useLocalization, useTranslation } from '../common/components/LocalizationProvider'; import LoginLayout from './LoginLayout'; import usePersistedState from '../common/util/usePersistedState'; import { handleLoginTokenListeners, nativeEnvironment, nativePostMessage } from '../common/components/NativeInterface'; @@ -211,9 +212,9 @@ const LoginPage = () => { <Select label={t('loginLanguage')} value={language} onChange={(e) => setLanguage(e.target.value)}> {languageList.map((it) => ( <MenuItem key={it.code} value={it.code}> - {navigator.platform.indexOf('Win') < 0 && ( - <Box component="span" sx={{ mr: 1 }}>{getFlagEmoji(it.country)}</Box> - )} + <Box component="span" sx={{ mr: 1 }}> + <ReactCountryFlag countryCode={it.country} /> + </Box> {it.name} </MenuItem> ))} |