From 630b4226182249aab02bd58b136dfa90c4dd7427 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 13 Feb 2024 12:09:01 +0700 Subject: fix: localize the splash screen footer --- src/view/com/auth/SplashScreen.web.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/view/com/auth/SplashScreen.web.tsx b/src/view/com/auth/SplashScreen.web.tsx index 8ef64099f..5c4d55dd1 100644 --- a/src/view/com/auth/SplashScreen.web.tsx +++ b/src/view/com/auth/SplashScreen.web.tsx @@ -9,9 +9,10 @@ import {usePalette} from 'lib/hooks/usePalette' import {CenteredView} from '../util/Views' import {isWeb} from 'platform/detection' import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries' -import {Trans} from '@lingui/macro' +import {Trans, msg} from '@lingui/macro' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' +import {useLingui} from '@lingui/react' export const SplashScreen = ({ onDismiss, @@ -98,22 +99,23 @@ export const SplashScreen = ({ function Footer({styles}: {styles: ReturnType}) { const pal = usePalette('default') + const {_} = useLingui() return ( -- cgit 1.4.1 From a9029a5f4f15cbe906b96f935fabcf66749c507f Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 13 Feb 2024 12:46:29 +0700 Subject: feat: language selection on web splash screen --- src/view/com/auth/SplashScreen.web.tsx | 69 ++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/view/com/auth/SplashScreen.web.tsx b/src/view/com/auth/SplashScreen.web.tsx index 5c4d55dd1..ff8fe60b2 100644 --- a/src/view/com/auth/SplashScreen.web.tsx +++ b/src/view/com/auth/SplashScreen.web.tsx @@ -13,6 +13,9 @@ import {Trans, msg} from '@lingui/macro' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' import {useLingui} from '@lingui/react' +import {sanitizeAppLanguageSetting} from '#/locale/helpers' +import {useLanguagePrefs, useLanguagePrefsApi} from '#/state/preferences' +import {APP_LANGUAGES} from '#/locale/languages' export const SplashScreen = ({ onDismiss, @@ -101,6 +104,23 @@ function Footer({styles}: {styles: ReturnType}) { const pal = usePalette('default') const {_} = useLingui() + const langPrefs = useLanguagePrefs() + const setLangPrefs = useLanguagePrefsApi() + + const sanitizedLang = sanitizeAppLanguageSetting(langPrefs.appLanguage) + + const onChangeAppLanguage = React.useCallback( + (ev: React.ChangeEvent) => { + const value = ev.target.value + + if (!value) return + if (sanitizedLang !== value) { + setLangPrefs.setAppLanguage(sanitizeAppLanguageSetting(value)) + } + }, + [sanitizedLang, setLangPrefs], + ) + return ( }) { text={_(msg`Jobs`)} style={[styles.footerLink, pal.link]} /> + + + + + + {APP_LANGUAGES.find(l => l.code2 === sanitizedLang)?.name} + + + + + ) } @@ -190,9 +252,10 @@ const useStyles = () => { padding: 20, borderTopWidth: 1, flexDirection: 'row', + flexWrap: 'wrap', + gap: 20, }, - footerLink: { - marginRight: 20, - }, + footerDivider: {flexGrow: 1}, + footerLink: {}, }) } -- cgit 1.4.1 From 50fac737136c2339f3e40c0bc5a90cb5cb8a16e6 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 13 Feb 2024 12:52:09 +0700 Subject: fix: do not remove the outline --- src/view/com/auth/SplashScreen.web.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/view/com/auth/SplashScreen.web.tsx b/src/view/com/auth/SplashScreen.web.tsx index ff8fe60b2..9d09b067f 100644 --- a/src/view/com/auth/SplashScreen.web.tsx +++ b/src/view/com/auth/SplashScreen.web.tsx @@ -169,7 +169,6 @@ function Footer({styles}: {styles: ReturnType}) { width: '100%', color: 'transparent', background: 'transparent', - outline: 0, border: 0, padding: 0, }}> -- cgit 1.4.1 From aa43e4cd4e94ec23952676a32acb423d2db71057 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 13 Feb 2024 14:39:18 +0700 Subject: feat: language selection on mobile --- src/view/com/auth/SplashScreen.tsx | 76 +++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/view/com/auth/SplashScreen.tsx b/src/view/com/auth/SplashScreen.tsx index ffd07d945..222e9266b 100644 --- a/src/view/com/auth/SplashScreen.tsx +++ b/src/view/com/auth/SplashScreen.tsx @@ -9,6 +9,14 @@ import {Trans, msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {Logo} from '#/view/icons/Logo' import {Logotype} from '#/view/icons/Logotype' +import { + FontAwesomeIcon, + FontAwesomeIconStyle, +} from '@fortawesome/react-native-fontawesome' +import RNPickerSelect, {PickerSelectProps} from 'react-native-picker-select' +import {sanitizeAppLanguageSetting} from '#/locale/helpers' +import {useLanguagePrefs, useLanguagePrefsApi} from '#/state/preferences' +import {APP_LANGUAGES} from '#/locale/languages' export const SplashScreen = ({ onPressSignin, @@ -20,6 +28,21 @@ export const SplashScreen = ({ const pal = usePalette('default') const {_} = useLingui() + const langPrefs = useLanguagePrefs() + const setLangPrefs = useLanguagePrefsApi() + + const sanitizedLang = sanitizeAppLanguageSetting(langPrefs.appLanguage) + + const onChangeAppLanguage = React.useCallback( + (value: Parameters[0]) => { + if (!value) return + if (sanitizedLang !== value) { + setLangPrefs.setAppLanguage(sanitizeAppLanguageSetting(value)) + } + }, + [sanitizedLang, setLangPrefs], + ) + return ( @@ -58,6 +81,51 @@ export const SplashScreen = ({ + + + Boolean(l.code2)).map(l => ({ + label: l.name, + value: l.code2, + key: l.code2, + }))} + useNativeAndroidPickerStyle={false} + style={{ + inputAndroid: { + color: pal.textLight.color, + fontSize: 16, + paddingRight: 10 + 4, + }, + inputIOS: { + color: pal.text.color, + fontSize: 14, + paddingRight: 10 + 4, + }, + }} + /> + + + + + + ) @@ -73,7 +141,7 @@ const styles = StyleSheet.create({ alignItems: 'center', }, btns: { - paddingBottom: 40, + paddingBottom: 0, }, title: { textAlign: 'center', @@ -95,4 +163,10 @@ const styles = StyleSheet.create({ textAlign: 'center', fontSize: 21, }, + footer: { + paddingHorizontal: 16, + paddingVertical: 12, + justifyContent: 'center', + alignItems: 'center', + }, }) -- cgit 1.4.1 From ae19e600996cc3cd02e71a05fd3f164ccfaf62a2 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 13 Feb 2024 14:39:43 +0700 Subject: fix: use the size prop --- src/view/com/auth/SplashScreen.web.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/view/com/auth/SplashScreen.web.tsx b/src/view/com/auth/SplashScreen.web.tsx index 9d09b067f..f1921c7ff 100644 --- a/src/view/com/auth/SplashScreen.web.tsx +++ b/src/view/com/auth/SplashScreen.web.tsx @@ -153,7 +153,8 @@ function Footer({styles}: {styles: ReturnType}) {