From 4b92683c7268dc67534c31740ed2d4dd3f6fdcce Mon Sep 17 00:00:00 2001 From: mohadeseh safari Date: Mon, 21 Apr 2025 22:00:28 -0400 Subject: [PATCH] some modification --- client/src/Pages/Auth/Login/Login.jsx | 49 ++++++++++++++++++++++----- client/src/locales/gb.json | 4 ++- client/src/locales/ru.json | 2 ++ client/src/locales/tr.json | 2 ++ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/client/src/Pages/Auth/Login/Login.jsx b/client/src/Pages/Auth/Login/Login.jsx index 0440d14b6..a5eec8898 100644 --- a/client/src/Pages/Auth/Login/Login.jsx +++ b/client/src/Pages/Auth/Login/Login.jsx @@ -48,6 +48,7 @@ const Login = () => { // State variables for backend connectivity status and loading state const [backendReachable, setBackendReachable] = useState(true); const [isCheckingConnection, setIsCheckingConnection] = useState(false); + const [initialCheckComplete, setInitialCheckComplete] = useState(false); // Function to check if the backend server is reachable and handle connectivity status // Wrapped in useCallback to prevent recreation on each render @@ -100,6 +101,7 @@ const Login = () => { } } finally { setIsCheckingConnection(false); + setInitialCheckComplete(true); } }, [t]); // Removed navigate since we no longer use it within this function @@ -272,8 +274,13 @@ const Login = () => { }, }} > - {!backendReachable ? ( - + {!initialCheckComplete ? ( + + {/* Show loading state while doing initial connectivity check */} + {t("retryingConnection")} + + ) : !backendReachable ? ( + { > {t("backendUnreachable")} - + {t("backendUnreachableMessage")} @@ -323,10 +334,32 @@ const Login = () => { ) )} {backendReachable && ( - + <> + + + {/* Registration link */} + + + {t("doNotHaveAccount")} + + navigate("/register")} + > + {t("registerHere")} + + + )} diff --git a/client/src/locales/gb.json b/client/src/locales/gb.json index 3bfb07fcf..e24362dc8 100644 --- a/client/src/locales/gb.json +++ b/client/src/locales/gb.json @@ -1,5 +1,7 @@ { "dontHaveAccount": "Don't have account", + "doNotHaveAccount": "Do not have an account?", + "registerHere": "Register here", "email": "E-mail", "forgotPassword": "Forgot Password", "password": "password", @@ -102,7 +104,7 @@ "backendUnreachable": "Server Connection Error", "backendUnreachableMessage": "We're unable to connect to the server. Please check your internet connection or contact your administrator if the problem persists.", "backendUnreachableError": "Cannot connect to the server. Please try again later.", - "retryConnection": "Retry Connection", + "retryConnection": "Retry connection", "retryingConnection": "Connecting...", "backendReconnected": "Successfully reconnected to the server.", "backendStillUnreachable": "Server is still unreachable. Please try again later.", diff --git a/client/src/locales/ru.json b/client/src/locales/ru.json index 4845830ef..33a7c615c 100644 --- a/client/src/locales/ru.json +++ b/client/src/locales/ru.json @@ -1,5 +1,7 @@ { "dontHaveAccount": "Нет аккаунта", + "doNotHaveAccount": "У вас нет учетной записи?", + "registerHere": "Зарегистрироваться здесь", "email": "Почта", "forgotPassword": "Забыли пароль", "password": "пароль", diff --git a/client/src/locales/tr.json b/client/src/locales/tr.json index 11d79fabc..767384b9d 100644 --- a/client/src/locales/tr.json +++ b/client/src/locales/tr.json @@ -1,5 +1,7 @@ { "dontHaveAccount": "Hesabınız yok mu", + "doNotHaveAccount": "Hesabınız yok mu?", + "registerHere": "Buradan kayıt olun", "email": "E-posta", "forgotPassword": "Parolamı unuttum", "password": "Parola",