From 5fb4d7331aeb309989028b8bd44264f7148a8055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Wed, 3 Sep 2025 10:45:19 +0200 Subject: [PATCH 1/3] refactor: Update naming of inputs in custom server view to prepare multiple inputs --- src/locales/en.json | 4 +++- src/locales/es.json | 4 +++- src/locales/fr.json | 4 +++- .../components/TwakeCustomServerView.tsx | 20 +++++++++---------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 7a3acb86c..3ec051fab 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -117,7 +117,9 @@ }, "companyServer": { "title": "Login", - "body": "To log in and access your Twake, please enter its URL", + "body": { + "byUrl": "To log in and access your Twake, please enter its URL" + }, "textFieldLabel": "Url", "buttonLogin": "Next" } diff --git a/src/locales/es.json b/src/locales/es.json index 6fdcb48d8..1e14d5220 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -117,7 +117,9 @@ }, "companyServer": { "title": "Acceso", - "body": "Para conectarse y acceder a su Twake, introduzca su URL", + "body": { + "byUrl": "Para conectarse y acceder a su Twake, introduzca su URL" + }, "textFieldLabel": "Url", "buttonLogin": "Siguiente" } diff --git a/src/locales/fr.json b/src/locales/fr.json index b46487cb6..31ff8d5f6 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -117,7 +117,9 @@ }, "companyServer": { "title": "Se connecter", - "body": "Pour vous connecter et accéder à votre Twake, veuillez saisir son URL", + "body": { + "byUrl": "Pour vous connecter et accéder à votre Twake, veuillez saisir son URL" + }, "textFieldLabel": "Serveur", "buttonLogin": "Suivant" } diff --git a/src/screens/login/components/TwakeCustomServerView.tsx b/src/screens/login/components/TwakeCustomServerView.tsx index 1f3904ff6..4e42ad580 100644 --- a/src/screens/login/components/TwakeCustomServerView.tsx +++ b/src/screens/login/components/TwakeCustomServerView.tsx @@ -46,7 +46,7 @@ export const TwakeCustomServerView = ({ setInstanceData, startOidcOauthNoCode }: TwakeCustomServerViewProps): JSX.Element => { - const [input, setInput] = useState('') + const [urlInput, setUrlInput] = useState('') const [error, setError] = useState() const version = useMemo(() => getVersion(), []) @@ -63,14 +63,14 @@ export const TwakeCustomServerView = ({ BackHandler.removeEventListener('hardwareBackPress', handleBackPress) }, [handleBackPress]) - const handleInput = (input: string): void => { - setInput(input) + const handleUrlInput = (input: string): void => { + setUrlInput(input) } - const handleLogin = async (): Promise => { + const handleLoginByUrl = async (): Promise => { setError(undefined) try { - const sanitizedInput = sanitizeUrlInput(input) + const sanitizedInput = sanitizeUrlInput(urlInput) const details = await fetchRegistrationDetails(new URL(sanitizedInput)) @@ -119,16 +119,16 @@ export const TwakeCustomServerView = ({ textAlign: 'center' }} > - {t('screens.companyServer.body')} + {t('screens.companyServer.body.byUrl')}