some modification
This commit is contained in:
1 parent
c0adbb5bd7
commit
4b92683c72
4 files changed
+48
-9
No files matched your search
@@ -48,6 +48,7 @@ const Login = () => {
|
|||||||
// State variables for backend connectivity status and loading state
|
// State variables for backend connectivity status and loading state
|
||||||
const [backendReachable, setBackendReachable] = useState(true);
|
const [backendReachable, setBackendReachable] = useState(true);
|
||||||
const [isCheckingConnection, setIsCheckingConnection] = useState(false);
|
const [isCheckingConnection, setIsCheckingConnection] = useState(false);
|
||||||
|
const [initialCheckComplete, setInitialCheckComplete] = useState(false);
|
||||||
|
|
||||||
// Function to check if the backend server is reachable and handle connectivity status
|
// Function to check if the backend server is reachable and handle connectivity status
|
||||||
// Wrapped in useCallback to prevent recreation on each render
|
// Wrapped in useCallback to prevent recreation on each render
|
||||||
@@ -100,6 +101,7 @@ const Login = () => {
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setIsCheckingConnection(false);
|
setIsCheckingConnection(false);
|
||||||
|
setInitialCheckComplete(true);
|
||||||
}
|
}
|
||||||
}, [t]); // Removed navigate since we no longer use it within this function
|
}, [t]); // Removed navigate since we no longer use it within this function
|
||||||
|
|
||||||
@@ -272,8 +274,13 @@ const Login = () => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!backendReachable ? (
|
{!initialCheckComplete ? (
|
||||||
<Stack spacing={2} alignItems="center">
|
<Stack spacing={theme.spacing(6)} alignItems="center">
|
||||||
|
{/* Show loading state while doing initial connectivity check */}
|
||||||
|
<Typography variant="h1">{t("retryingConnection")}</Typography>
|
||||||
|
</Stack>
|
||||||
|
) : !backendReachable ? (
|
||||||
|
<Stack spacing={theme.spacing(6)} alignItems="center">
|
||||||
<Alert
|
<Alert
|
||||||
severity="error"
|
severity="error"
|
||||||
sx={{
|
sx={{
|
||||||
@@ -291,7 +298,11 @@ const Login = () => {
|
|||||||
>
|
>
|
||||||
{t("backendUnreachable")}
|
{t("backendUnreachable")}
|
||||||
</Alert>
|
</Alert>
|
||||||
<Typography variant="body1" align="center">
|
<Typography
|
||||||
|
variant="body1"
|
||||||
|
align="center"
|
||||||
|
mt={theme.spacing(2)}
|
||||||
|
>
|
||||||
{t("backendUnreachableMessage")}
|
{t("backendUnreachableMessage")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button
|
<Button
|
||||||
@@ -299,7 +310,7 @@ const Login = () => {
|
|||||||
color="accent"
|
color="accent"
|
||||||
onClick={handleRetry}
|
onClick={handleRetry}
|
||||||
disabled={isCheckingConnection}
|
disabled={isCheckingConnection}
|
||||||
|
mt={theme.spacing(4)}
|
||||||
>
|
>
|
||||||
{isCheckingConnection ? t("retryingConnection") : t("retryConnection")}
|
{isCheckingConnection ? t("retryingConnection") : t("retryConnection")}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -323,10 +334,32 @@ const Login = () => {
|
|||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
{backendReachable && (
|
{backendReachable && (
|
||||||
<ForgotPasswordLabel
|
<>
|
||||||
email={form.email}
|
<ForgotPasswordLabel
|
||||||
errorEmail={errors.email}
|
email={form.email}
|
||||||
/>
|
errorEmail={errors.email}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Registration link */}
|
||||||
|
<Box textAlign="center" >
|
||||||
|
<Typography
|
||||||
|
className="forgot-p"
|
||||||
|
display="inline-block"
|
||||||
|
color={theme.palette.primary.main}
|
||||||
|
>
|
||||||
|
{t("doNotHaveAccount")}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
component="span"
|
||||||
|
color={theme.palette.accent.main}
|
||||||
|
ml={theme.spacing(2)}
|
||||||
|
sx={{ userSelect: "none" }}
|
||||||
|
onClick={() => navigate("/register")}
|
||||||
|
>
|
||||||
|
{t("registerHere")}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dontHaveAccount": "Don't have account",
|
"dontHaveAccount": "Don't have account",
|
||||||
|
"doNotHaveAccount": "Do not have an account?",
|
||||||
|
"registerHere": "Register here",
|
||||||
"email": "E-mail",
|
"email": "E-mail",
|
||||||
"forgotPassword": "Forgot Password",
|
"forgotPassword": "Forgot Password",
|
||||||
"password": "password",
|
"password": "password",
|
||||||
@@ -102,7 +104,7 @@
|
|||||||
"backendUnreachable": "Server Connection Error",
|
"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.",
|
"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.",
|
"backendUnreachableError": "Cannot connect to the server. Please try again later.",
|
||||||
"retryConnection": "Retry Connection",
|
"retryConnection": "Retry connection",
|
||||||
"retryingConnection": "Connecting...",
|
"retryingConnection": "Connecting...",
|
||||||
"backendReconnected": "Successfully reconnected to the server.",
|
"backendReconnected": "Successfully reconnected to the server.",
|
||||||
"backendStillUnreachable": "Server is still unreachable. Please try again later.",
|
"backendStillUnreachable": "Server is still unreachable. Please try again later.",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dontHaveAccount": "Нет аккаунта",
|
"dontHaveAccount": "Нет аккаунта",
|
||||||
|
"doNotHaveAccount": "У вас нет учетной записи?",
|
||||||
|
"registerHere": "Зарегистрироваться здесь",
|
||||||
"email": "Почта",
|
"email": "Почта",
|
||||||
"forgotPassword": "Забыли пароль",
|
"forgotPassword": "Забыли пароль",
|
||||||
"password": "пароль",
|
"password": "пароль",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
{
|
{
|
||||||
"dontHaveAccount": "Hesabınız yok mu",
|
"dontHaveAccount": "Hesabınız yok mu",
|
||||||
|
"doNotHaveAccount": "Hesabınız yok mu?",
|
||||||
|
"registerHere": "Buradan kayıt olun",
|
||||||
"email": "E-posta",
|
"email": "E-posta",
|
||||||
"forgotPassword": "Parolamı unuttum",
|
"forgotPassword": "Parolamı unuttum",
|
||||||
"password": "Parola",
|
"password": "Parola",
|
||||||
|
|||||||
Reference in new issue
Block a user