dev-jaanvi #1

Open
jaanvi wants to merge 155 commits from dev-jaanvi into main
5 changed files with 266 additions and 225 deletions
Showing only changes of commit d558697888 - Show all commits

1
package-lock.json generated
View file

@ -15041,6 +15041,7 @@
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.7.3", "version": "5.7.3",
"dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",

View file

@ -1,3 +1,12 @@
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden; /* Prevents scrolling */
}
.App { .App {
text-align: center; text-align: center;
} }

View file

@ -1,6 +1,7 @@
import { BrowserRouter as Router } from "react-router-dom"; import { BrowserRouter as Router } from "react-router-dom";
import AppRouter from "./router"; import AppRouter from "./router";
function App() { function App() {
return ( return (
<Router> <Router>

View file

@ -1,14 +1,24 @@
import React from 'react'; import React from 'react';
import { useSelector } from 'react-redux'; import { CircularProgress, Box, Typography } from '@mui/material';
// import styled from './Loading.style';
function LoadingComponent() { function LoadingComponent() {
// const { isdarktheme } = useSelector((state) => ({ return (
// isdarktheme: state?.authReducer?.isDarkTheme, <Box
// })); sx={{
display: 'flex',
return (<h1>Loading</h1>); justifyContent: 'center',
alignItems: 'center',
height: '100vh',
width: '100%',
flexDirection: 'column',
}}
>
<CircularProgress size={50} color="primary" />
<Typography variant="h6" sx={{ marginTop: 2 }}>
Loading...
</Typography>
</Box>
);
} }
export default LoadingComponent; export default LoadingComponent;

View file

@ -11,6 +11,7 @@ import {
Grid, Grid,
IconButton, IconButton,
Link, Link,
InputAdornment
} from "@mui/material"; } from "@mui/material";
import { useForm, Controller, SubmitHandler } from "react-hook-form"; import { useForm, Controller, SubmitHandler } from "react-hook-form";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
@ -29,7 +30,9 @@ interface ILoginForm {
export default function Login(props: { disableCustomTheme?: boolean }) { export default function Login(props: { disableCustomTheme?: boolean }) {
const [open, setOpen] = React.useState(false); const [open, setOpen] = React.useState(false);
const [isClicked, setIsClicked] = React.useState(false);
const [showPassword, setShowPassword] = React.useState(false); const [showPassword, setShowPassword] = React.useState(false);
const { const {
control, control,
handleSubmit, handleSubmit,
@ -69,7 +72,7 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
md={7} md={7}
sx={{ sx={{
background: `url('/mainPageLogo.png') center/cover no-repeat`, background: `url('/mainPageLogo.png') center/cover no-repeat`,
height: { xs: "0%", sm: "0%", md: "100%" }, // height: { xs: "0%", sm: "50%", md: "100%" },
backgroundSize: "cover", backgroundSize: "cover",
display: { xs: "none", md: "block" }, // Hide the image on xs and sm screens display: { xs: "none", md: "block" }, // Hide the image on xs and sm screens
}} }}
@ -87,9 +90,11 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
alignItems: "center", alignItems: "center",
flexDirection: "column", flexDirection: "column",
padding: { xs: "2rem", md: "3rem", lg: "3rem" }, padding: { xs: "2rem", md: "3rem", lg: "3rem" },
height: "100%",
height: "auto", // ✅ Allows the height to adjust dynamically
}} }}
> >
<Typography <Typography
variant="h3" variant="h3"
sx={{ sx={{
@ -105,13 +110,8 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
Welcome Back! Welcome Back!
</Typography> </Typography>
<Card <Card variant="outlined" sx={{ width: { xs: "100%", sm: "300px",lg:"408px" }, padding: "24px", borderRadius: "12px", backgroundColor: "#1E1E1E", border: "1px solid #4B5255" }}>
variant="outlined"
sx={{
maxWidth: "400px",
width: { xs: "80%", sm: "80%", md: "100%" },
}}
>
<Box <Box
component="form" component="form"
onSubmit={handleSubmit(onSubmit)} onSubmit={handleSubmit(onSubmit)}
@ -122,38 +122,24 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
gap: 2, gap: 2,
}} }}
> >
<Typography <Typography component="h1" variant="h4" sx={{ textAlign: "center", color: "white", fontFamily: "Gilroy", fontSize: "24px" }}>Login</Typography>
component="h1"
variant="h4"
sx={{
textAlign: "center",
color: "white",
fontSize: { xs: "1.5rem", sm: "2rem" },
}}
>
Login
</Typography>
<Typography <Typography
component="h6" component="h6"
variant="subtitle2" variant="subtitle2"
sx={{ sx={{ textAlign: "center", color: "white", fontFamily: "Gilroy", fontSize: "16px" }}
textAlign: "center",
color: "white",
fontSize: { xs: "0.9rem", sm: "1rem" },
}}
> >
Log in with your email and password Log in with your email and password
</Typography> </Typography>
<FormControl sx={{ width: "100%" }}>
{/* -------------------------------- Email Field ----------------- */}
<FormControl sx={{ width: "100%" }}>
<FormLabel <FormLabel
htmlFor="email" htmlFor="email"
sx={{ sx={{
fontSize: { fontSize: { xs: "0.9rem", sm: "1rem" },
xs: "0.9rem",
sm: "1rem",
},
color: "white", color: "white",
fontFamily: "Gilroy, sans-serif", // ✅ Apply Gilroy font
}} }}
> >
Email Email
@ -166,17 +152,14 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
required: "Email is required", required: "Email is required",
pattern: { pattern: {
value: /\S+@\S+\.\S+/, value: /\S+@\S+\.\S+/,
message: message: "Please enter a valid email address.",
"Please enter a valid email address.",
}, },
}} }}
render={({ field }) => ( render={({ field }) => (
<TextField <TextField
{...field} {...field}
error={!!errors.email} error={!!errors.email}
helperText={ helperText={errors.email?.message}
errors.email?.message
}
id="email" id="email"
type="email" type="email"
placeholder="Email" placeholder="Email"
@ -185,33 +168,48 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
required required
fullWidth fullWidth
variant="outlined" variant="outlined"
color={ color={errors.email ? "error" : "primary"}
errors.email InputProps={{
? "error" sx: {
: "primary" height: "50px",
} alignItems: "center",
sx={{ backgroundColor: "#1E1F1F",
input: { fontFamily: "Gilroy, sans-serif",
fontSize: {
xs: "0.9rem",
sm: "1rem",
}, },
}}
sx={{
"& .MuiOutlinedInput-root": {
backgroundColor: "#1E1F1F",
borderRadius: "4px",
"& fieldset": { borderColor: "#4b5255" },
"&:hover fieldset": { borderColor: "#4b5255" },
"&.Mui-focused fieldset": { borderColor: "#4b5255" },
},
"& input": {
color: "white",
fontSize: { xs: "0.9rem", sm: "1rem" },
fontFamily: "Gilroy, sans-serif",
},
"& .MuiInputBase-input::placeholder": {
color: "white",
opacity: 1,
fontFamily: "Gilroy, sans-serif",
}, },
}} }}
/> />
)} )}
/> />
</FormControl> </FormControl>
<FormControl sx={{ width: "100%" }}>
{/* -------------------------------- Password Field ----------------- */}
<FormControl sx={{ width: "100%" }}>
<FormLabel <FormLabel
htmlFor="password" htmlFor="password"
sx={{ sx={{
fontSize: { fontSize: { xs: "0.9rem", sm: "1rem" },
xs: "0.9rem",
sm: "1rem",
},
color: "white", color: "white",
fontFamily: "Gilroy, sans-serif",
}} }}
> >
Password Password
@ -224,80 +222,78 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
required: "Password is required", required: "Password is required",
minLength: { minLength: {
value: 6, value: 6,
message: message: "Password must be at least 6 characters long.",
"Password must be at least 6 characters long.",
}, },
pattern: { pattern: {
value: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,}$/, value:
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{6,}$/,
message: message:
"Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character.", "Password must contain at least one uppercase letter, one lowercase letter, one number, and one special character.",
}, },
}} }}
render={({ field }) => ( render={({ field }) => (
<Box sx={{ position: "relative" }}>
<TextField <TextField
{...field} {...field}
error={!!errors.password} error={!!errors.password}
helperText={ helperText={errors.password?.message}
errors.password?.message
}
name="password" name="password"
placeholder="Password" placeholder="Password"
type={ type={showPassword ? "text" : "password"}
showPassword
? "text"
: "password"
}
id="password" id="password"
autoComplete="current-password" autoComplete="current-password"
autoFocus
required required
fullWidth fullWidth
variant="outlined" variant="outlined"
color={ color={errors.password ? "error" : "primary"}
errors.password InputProps={{
? "error" sx: {
: "primary" height: "50px",
} fontFamily: "Gilroy, sans-serif", // Apply Gilroy font
sx={{ },
paddingRight: "40px",
height: "40px", endAdornment: (
marginBottom: "8px",
}}
/>
<IconButton <IconButton
onClick={() => setShowPassword((prev) => !prev)}
edge="end"
sx={{ sx={{
position: "absolute", color: "white",
top: "50%", padding: 0,
right: "10px", margin: 0,
transform: backgroundColor: "transparent",
"translateY(-50%)", border: "none",
background: "none", boxShadow: "none",
borderColor: "&:hover": { backgroundColor: "transparent" },
"transparent", "&:focus": { outline: "none", border: "none" },
"&:hover": { }}
backgroundColor: >
"transparent", {showPassword ? <VisibilityOff /> : <Visibility />}
borderColor: </IconButton>
"transparent", ),
}}
sx={{
"& .MuiOutlinedInput-root": {
backgroundColor: "#1E1F1F",
borderRadius: "4px",
"& fieldset": { borderColor: "#4b5255" },
"&:hover fieldset": { borderColor: "#4b5255" },
"&.Mui-focused fieldset": { borderColor: "#4b5255" },
},
"& input": {
color: "white",
fontSize: { xs: "0.9rem", sm: "1rem" },
fontFamily: "Gilroy, sans-serif",
},
"& .MuiInputBase-input::placeholder": {
color: "white",
opacity: 1,
fontFamily: "Gilroy, sans-serif",
}, },
}} }}
onClick={() => />
setShowPassword(
(prev) => !prev
)
}
>
{showPassword ? (
<VisibilityOff />
) : (
<Visibility />
)}
</IconButton>
</Box>
)} )}
/> />
</FormControl> </FormControl>
<Box <Box
sx={{ sx={{
@ -312,23 +308,46 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
control={ control={
<Checkbox <Checkbox
value="remember" value="remember"
color="primary" sx={{
width: 20,
height: 20,
fontFamily: "Gilroy, sans-serif",
border: "2px solid #4b5255",
borderRadius: "4px",
backgroundColor: "transparent",
"&:hover": {
backgroundColor: "transparent",
},
"&.Mui-checked": {
backgroundColor: "transparent",
borderColor: "#4b5255",
"&:hover": {
backgroundColor: "transparent",
},
},
}}
/> />
} }
label="Remember me" label="Remember me"
/> />
<Link
<Link
component="button" component="button"
type="button" type="button"
onClick={handleClickOpen} onClick={handleClickOpen}
variant="body2" variant="body2"
sx={{ sx={{
alignSelf: "center", alignSelf: "center",
fontFamily: "Gilroy, sans-serif",
color: "#01579b", color: "#01579b",
textDecoration: "none", // ✅ Removes underline
}} }}
> >
Forgot password? Forgot password?
</Link> </Link>
</Box> </Box>
<ForgotPassword <ForgotPassword
open={open} open={open}
@ -340,6 +359,7 @@ export default function Login(props: { disableCustomTheme?: boolean }) {
disabled={!isValid} disabled={!isValid}
sx={{ sx={{
color: "white", color: "white",
fontFamily: "Gilroy, sans-serif",
backgroundColor: "#52ACDF", backgroundColor: "#52ACDF",
"&:hover": { "&:hover": {
backgroundColor: "#52ACDF", backgroundColor: "#52ACDF",