Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login page design fixes #212

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 36 additions & 43 deletions src/app/ui/Layout.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,62 @@
import React, { Suspense, useEffect, useState } from "react";
import GlobalStyles from "@/styles/LayoutStyles";
import BackButton from "@/components/common/BackButton";
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import { translate } from "@/config/localisation";
import ErrorBoundary from "../ErrorBoundary";
const Header = React.lazy(() => import("@/components/common/Header"));


const Layout= (props) => {
/* eslint-disable react-hooks/exhaustive-deps */
const { type, index, component,Backbutton, backPressNavigationPath } = props;
const Layout = (props) => {
/* eslint-disable react-hooks/exhaustive-deps */
const { type, index, component, Backbutton, backPressNavigationPath } = props;
const [show, setShow] = useState(false);
const classes = GlobalStyles();

useEffect(() => {
if (show) {
window.removeEventListener('scroll', (e) => { });
window.removeEventListener("scroll", (e) => {});
}
}, [show])
}, [show]);

if (typeof window !== 'undefined') {
window.addEventListener('scroll', e => {
if (window.pageYOffset > 100 && !show) {
setShow(true);
}
})
if (typeof window !== "undefined") {
window.addEventListener("scroll", (e) => {
if (window.pageYOffset > 100 && !show) {
setShow(true);
}
});
}

useEffect(() => {
if (typeof window !== 'undefined') {
if (localStorage.getItem('rtl') === "true") {
let style = document.createElement('style');
style.innerHTML = 'input, textarea { direction: RTL; }'
document.head.appendChild(style);
if (typeof window !== "undefined") {
if (localStorage.getItem("rtl") === "true") {
let style = document.createElement("style");
style.innerHTML = "input, textarea { direction: RTL; }";
document.head.appendChild(style);
}
}
}
}, []);

return (
<div
className={classes.root}
>
<Suspense fallback={<div>Loading....</div>}>
<Header
type={type}
index={index}
className={classes.headerContainer}

<div className={classes.root}>
<Suspense fallback={<div>Loading....</div>}>
<Header type={type} index={index} className={classes.headerContainer} />
</Suspense>
<div className={classes.container} style={{ marginTop: "88px" }}>
{Backbutton && (
<BackButton
startIcon={<ArrowBackIcon />}
sx={{ color: "white", mb: 4, mt: 2 }}
backPressNavigationPath={
backPressNavigationPath ? backPressNavigationPath : ""
}
label={translate("label.backToPreviousPage")}
/>
)}
<Suspense fallback={<div>Loading....</div>}>
<ErrorBoundary>{component}</ErrorBoundary>
</Suspense>
<div
className={classes.container}
style={{marginTop:"88px"}}
>
{ Backbutton &&
< BackButton startIcon={< ArrowBackIcon />} sx={{ color:"white" , mb:4
,mt:2}} backPressNavigationPath={backPressNavigationPath ? backPressNavigationPath : ""} label={translate("label.backToPreviousPage")}/>
}
<Suspense fallback={<div>Loading....</div>}>
<ErrorBoundary>
{component}
</ErrorBoundary>
</Suspense>
</div>
</div>
</div>
);
}
};
export default Layout;
42 changes: 21 additions & 21 deletions src/app/ui/pages/forgot-password/forgot-password.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use client'
"use client";
import React, { useEffect, useState } from "react";
// import CustomCard from "@/component/common/Card";
import { Grid, Typography, Link, ThemeProvider } from "@mui/material";
Expand All @@ -15,7 +15,7 @@ import { useDispatch } from "react-redux";
import CustomizedSnackbars from "@/components/common/Snackbar";

const ForgotPassword = () => {
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-hooks/exhaustive-deps */

const classes = LoginStyle();
const dispatch = useDispatch();
Expand Down Expand Up @@ -44,31 +44,31 @@ const ForgotPassword = () => {
setLoading(true);
let obj = new ForgotPasswordAPI(ForgotPassword);
const res = await fetch(obj.apiEndPoint(), {
method: "POST",
body: JSON.stringify(obj.getBody()),
headers: obj.getHeaders().headers,
method: "POST",
body: JSON.stringify(obj.getBody()),
headers: obj.getHeaders().headers,
});
const resp = await res.json();
setLoading(false);
if (res.ok) {
setSnackbarInfo({
open: true,
message: resp?.message,
variant: "success",
})
navigate("/login");
setSnackbarInfo({
open: true,
message: resp?.message,
variant: "success",
});
navigate("/login");
} else {
setSnackbarInfo({
open: true,
message: resp?.message,
variant: "error",
})
setSnackbarInfo({
open: true,
message: resp?.message,
variant: "error",
});
}
}
};
const ValidateEmail = (mail) => {
if (
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(
mail
mail,
)
) {
return true;
Expand Down Expand Up @@ -127,8 +127,8 @@ const ForgotPassword = () => {
/>
</Grid>
<Grid item xs={12} sm={12} md={12} lg={12} xl={12} textAlign={"right"}>
<Typography>
<Link href="/" style={{ fontSize: "14px" }}>
<Typography onClick={() => navigate("/login")}>
<Link style={{ fontSize: "14px", cursor: "pointer" }}>
{" "}
Back to Login
</Link>
Expand Down Expand Up @@ -167,4 +167,4 @@ const ForgotPassword = () => {
);
};

export default ForgotPassword;
export default ForgotPassword;
Loading
Loading