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

Resolve Console Warnings and Errors for Improved Code Quality #5

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
94aace5
Refactor: Standardize data attribute naming convention to 'data-testid'
lokeshwar777 Mar 30, 2024
5b3fe1d
Refactor: Ensure IconButton Handles Click Events Directly
lokeshwar777 Mar 30, 2024
195a4c7
Fix: Ensure Proper Usage of spacing Prop in Grid Component
lokeshwar777 Mar 30, 2024
15dd24f
Refactor: Correct Usage of gutterBottom Prop
lokeshwar777 Mar 30, 2024
54e4132
Fix: Ensure Unique Keys for Child Components
lokeshwar777 Mar 30, 2024
da08359
Fixed 'key' prop warning and 'type is invalid' warning.
lokeshwar777 Mar 30, 2024
03924e0
Fixed 'Failed prop type' warning for prop scrollButtons in HomePage c…
lokeshwar777 Mar 30, 2024
14ca617
Remove invalid 'item' attribute from Box component
lokeshwar777 Mar 30, 2024
e8e885a
Fix: Correct usage of htmlType prop
lokeshwar777 Mar 30, 2024
acbd7f2
Fix DOM nesting warning by removing unnecessary <p> tag around <div> …
lokeshwar777 Mar 30, 2024
03b84fa
Fix warning by passing string value for loading attribute
lokeshwar777 Mar 30, 2024
2d78edf
Ensure sx prop is always provided as an object or function to resolve…
lokeshwar777 Mar 30, 2024
d9eeba9
Fix onClick event listener warning in UserDashboard component
lokeshwar777 Mar 30, 2024
0351100
Added unique 'key' prop to children in Organizations and UserEmail co…
lokeshwar777 Mar 30, 2024
979be5e
Resolved React warning by using 'helpertext' prop instead of 'helperT…
lokeshwar777 Mar 30, 2024
f6b82e3
Fix: spacing prop in Socialmedia component
lokeshwar777 Mar 30, 2024
2856a7f
Resolved 'key' prop warning in SwitchAccount
lokeshwar777 Mar 30, 2024
70a4c93
Fix: Ensure unique 'key' prop for children in OrgsCarousel component
lokeshwar777 Mar 30, 2024
d5e4ab4
Fix: Ensure correct usage of Grid props
lokeshwar777 Mar 30, 2024
eb7badb
Fixed: Passed danger prop as string instead of boolean to resolve DOM…
lokeshwar777 Mar 30, 2024
c49781b
Fix: Ensure valid children prop for StepsPanel and AddNewSteps compon…
lokeshwar777 Mar 31, 2024
009a5b2
Fix: Convert closable attribute to string format to resolve warning
lokeshwar777 Mar 31, 2024
29cff21
Fixed small bugs in StepsTitle component
lokeshwar777 Mar 31, 2024
50d807e
Refactor: Removed unused onOk event handler, adjusted modal attribute…
lokeshwar777 Mar 31, 2024
a9f99c8
Fix: Ensure unique 'key' prop for each child in the render method of …
lokeshwar777 Mar 31, 2024
2130e17
Refactored code to remove unnecessary Typography wrapper around HtmlT…
lokeshwar777 Mar 31, 2024
99569ee
Consistently use unique keys for mapped elements in various components.
lokeshwar777 Mar 31, 2024
0379f19
fix: Resolve warning for missing prop in CardMedia component
lokeshwar777 Mar 31, 2024
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
6 changes: 3 additions & 3 deletions src/components/AuthPage/ForgotPassword/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const ForgotPassword = ({
const classes = useStyles();

return (
<Card className={classes.root} data-testId="forgotPassword">
<Card className={classes.root} data-testid="forgotPassword">
<Typography
variant="h4"
className={"mb-24 text-center " + classes.heading}
Expand Down Expand Up @@ -130,7 +130,7 @@ const ForgotPassword = ({
className="mb-32"
fullWidth
height="10rem"
data-testId="forgotPasswordEmail"
data-testid="forgotPasswordEmail"
startAdornment={
<InputAdornment sposition="start">
<MailOutlineOutlinedIcon style={{ color: "rgba(0,0,0,.25)" }} />
Expand All @@ -145,7 +145,7 @@ const ForgotPassword = ({
className="mt-10"
type="submit"
fullWidth
data-testId="forgotPasswordButton"
data-testid="forgotPasswordButton"
disabled={!isValidEmail}
>
{loading ? "Sending..." : "Send me the link"}
Expand Down
10 changes: 5 additions & 5 deletions src/components/AuthPage/Login/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const Login = ({
raised
className={`${classes.card} `}
style={{ background: background }}
data-testId="login"
data-testid="login"
>
<CardContent>
<Typography
Expand All @@ -138,7 +138,7 @@ const Login = ({
placeholder="[email protected]"
value={email}
onChange={onChangeEmail}
helperText={emailValidateError ? emailValidateErrorMessage : null}
helpertext={emailValidateError ? emailValidateErrorMessage : null}
fullWidth
autoComplete="email"
required
Expand All @@ -156,7 +156,7 @@ const Login = ({
<TextField
label="Password"
variant="outlined"
helperText={
helpertext={
passwordValidateError ? passwordValidateErrorMessage : null
}
className="password"
Expand Down Expand Up @@ -201,7 +201,7 @@ const Login = ({
style={{ fontFamily: "Arial, sans-serif", fontSize: "1.5vh" }}
>
<Link
data-testId="forgotPassoword"
data-testid="forgotPassoword"
to="/forgotpassword"
className="login-form-forgot"
style={{ float: "right" }}
Expand All @@ -217,7 +217,7 @@ const Login = ({
fullWidth
onClick={onSubmit}
disabled={loading}
data-testId="loginButton"
data-testid="loginButton"
className="loginButton"
style={{
color: "white",
Expand Down
4 changes: 2 additions & 2 deletions src/components/AuthPage/SignUp/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const SignUp = ({ background = "white" }) => {
<Card
raised
className={classes.card}
data-testId="signUp"
data-testid="signUp"
style={{
background: background,
maxWidth: "520px",
Expand Down Expand Up @@ -51,7 +51,7 @@ const SignUp = ({ background = "white" }) => {
justify="center"
alignItems="center"
className="mt-24"
data-testId="signUpHaveAccount"
data-testid="signUpHaveAccount"
>
<Grid item={true} sm={12} className="center">
Already have a{" "}
Expand Down
18 changes: 9 additions & 9 deletions src/components/AuthPage/SignUp/signupForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,18 @@ const SignupForm = () => {
</Collapse>
)}

<Card data-testId="signUpForm" style={{ boxShadow: "none" }}>
<Card data-testid="signUpForm" style={{ boxShadow: "none" }}>
<TextField
label="Email"
variant="outlined"
autoFocus
placeholder="[email protected]"
value={email}
onChange={onChangeEmail}
helperText={emailValidateError ? emailValidateErrorMessage : null}
helpertext={emailValidateError ? emailValidateErrorMessage : null}
error={emailValidateError}
fullWidth
data-testId="signUpEmail"
data-testid="signUpEmail"
autoComplete="email"
required
onFocus={onFocusEmail}
Expand All @@ -234,7 +234,7 @@ const SignupForm = () => {
<TextField
label="New password"
variant="outlined"
helperText={
helpertext={
passwordValidateError ? passwordValidateErrorMessage : null
}
error={passwordValidateError}
Expand All @@ -243,7 +243,7 @@ const SignupForm = () => {
value={password}
onFocus={onFocusPassword}
onChange={onChangePassword}
data-testId="signUpPassword"
data-testid="signUpPassword"
autoComplete="new-password"
type={showPassword ? "text" : "password"}
style={{ marginBottom: "15px" }}
Expand All @@ -269,15 +269,15 @@ const SignupForm = () => {
<TextField
label="Confirm password"
variant="outlined"
helperText={
helpertext={
confirmPasswordValidateError
? confirmPasswordValidateErrorMessage
: null
}
error={confirmPasswordValidateError}
fullWidth
required
data-testId="signUpConfirmPassword"
data-testid="signUpConfirmPassword"
value={confirmPassword}
onFocus={onFocusConfirmPassword}
onChange={onChangeConfirmPassword}
Expand Down Expand Up @@ -309,7 +309,7 @@ const SignupForm = () => {
onChange={() => setAgreed(!agreed)}
name="remember"
color="primary"
data-testId="TnC"
data-testid="TnC"
style={{}}
/>
}
Expand All @@ -326,7 +326,7 @@ const SignupForm = () => {
color="primary"
fullWidth
disabled={loading}
data-testId="signUpButton"
data-testid="signUpButton"
onClick={onSubmit}
style={{
color: "white",
Expand Down
2 changes: 1 addition & 1 deletion src/components/AuthPage/smButton/smButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const SmButtons = () => {
<Grid
container
className={classes.root}
data-testId="smButtons"
data-testid="smButtons"
style={{
backgroundColor: "#EFF5F5",
borderRadius: "30px",
Expand Down
24 changes: 13 additions & 11 deletions src/components/Card/CardWithPicture.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,11 @@ export default function CardWithPicture({ tutorial }) {
<Link to={`/tutorial/${tutorial?.tutorial_id}`}>
<CardMedia
className={classes.media}
image={tutorial?.featured_image}
image={
tutorial?.featured_image || "src/assets/images/tutorialCard.png"
}
title="code"
data-testId="Image"
data-testid="Image"
/>
</Link>
<CardHeader
Expand All @@ -133,7 +135,7 @@ export default function CardWithPicture({ tutorial }) {
variant="h7"
className={classes.inline}
color="textPrimary"
data-testId="UserName"
data-testid="UserName"
>
{user?.displayName}
</Typography>
Expand All @@ -145,7 +147,7 @@ export default function CardWithPicture({ tutorial }) {
variant="h7"
className={classes.inline}
color="textPrimary"
data-testId="UserOrgName"
data-testid="UserOrgName"
>
{tutorial?.owner}
</Typography>
Expand All @@ -157,15 +159,15 @@ export default function CardWithPicture({ tutorial }) {
/>
<Link to={`/tutorial/${tutorial?.tutorial_id}`}>
<CardContent className={classes.contentPadding}>
<Typography variant="h5" color="text.primary" data-testId="Title">
<Typography variant="h5" color="text.primary" data-testid="Title">
{tutorial?.title}
</Typography>
<Typography
variant="body2"
color="textSecondary"
component="p"
paragraph
data-testId="Description"
data-testid="Description"
>
{tutorial?.summary}
</Typography>
Expand All @@ -184,7 +186,7 @@ export default function CardWithPicture({ tutorial }) {
variant="overline"
display="block"
className={classes.time}
data-testId="Time"
data-testid="Time"
>
{"10 min"}
</Typography>
Expand Down Expand Up @@ -215,16 +217,16 @@ export default function CardWithPicture({ tutorial }) {
<KeyboardArrowDownIcon />
</ToggleButton>
</ToggleButtonGroup>
<IconButton aria-label="share" data-testId="CommentIcon">
<IconButton aria-label="share" data-testid="CommentIcon">
<ChatOutlinedIcon />
</IconButton>
<IconButton aria-label="add to favorites" data-testId="ShareIcon">
<IconButton aria-label="add to favorites" data-testid="ShareIcon">
<ShareOutlinedIcon />
</IconButton>
<IconButton aria-label="share" data-testId="NotifIcon">
<IconButton aria-label="share" data-testid="NotifIcon">
<TurnedInNotOutlinedIcon />
</IconButton>
<IconButton aria-label="share" data-testId="MoreIcon">
<IconButton aria-label="share" data-testid="MoreIcon">
<MoreVertOutlinedIcon />
</IconButton>
</CardActions>
Expand Down
22 changes: 11 additions & 11 deletions src/components/Card/CardWithoutPicture.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default function CardWithoutPicture({ tutorial }) {
};

return (
<Card className={classes.root} data-testId="codelabz">
<Card className={classes.root} data-testid="codelabz">
<CardHeader
avatar={
<Avatar className={classes.avatar}>
Expand All @@ -119,7 +119,7 @@ export default function CardWithoutPicture({ tutorial }) {
variant="h7"
className={classes.inline}
color="textPrimary"
data-testId="UserName"
data-testid="UserName"
>
{user?.displayName}
</Typography>
Expand All @@ -131,7 +131,7 @@ export default function CardWithoutPicture({ tutorial }) {
variant="h7"
className={classes.inline}
color="textPrimary"
data-testId="UserOrgName"
data-testid="UserOrgName"
>
{tutorial?.owner}
</Typography>
Expand All @@ -144,17 +144,17 @@ export default function CardWithoutPicture({ tutorial }) {
<Link to={`/tutorial/${tutorial?.tutorial_id}`}>
<CardContent
className={classes.contentPadding}
data-testId="codelabzDetails"
data-testid="codelabzDetails"
>
<Typography variant="h5" color="text.primary" data-testId="Title">
<Typography variant="h5" color="text.primary" data-testid="Title">
{tutorial?.title}
</Typography>
<Typography
variant="body2"
color="textSecondary"
component="p"
paragraph
data-testId="Description"
data-testid="Description"
>
{tutorial?.summary}
</Typography>
Expand All @@ -173,7 +173,7 @@ export default function CardWithoutPicture({ tutorial }) {
variant="overline"
display="block"
className={classes.time}
data-testId="Time"
data-testid="Time"
>
{"10 min"}
</Typography>
Expand Down Expand Up @@ -204,16 +204,16 @@ export default function CardWithoutPicture({ tutorial }) {
<KeyboardArrowDownIcon />
</ToggleButton>
</ToggleButtonGroup>
<IconButton aria-label="share" data-testId="CommentIcon">
<IconButton aria-label="share" data-testid="CommentIcon">
<ChatOutlinedIcon />
</IconButton>
<IconButton aria-label="add to favorites" data-testId="ShareIcon">
<IconButton aria-label="add to favorites" data-testid="ShareIcon">
<ShareOutlinedIcon />
</IconButton>
<IconButton aria-label="share" data-testId="NotifIcon">
<IconButton aria-label="share" data-testid="NotifIcon">
<TurnedInNotOutlinedIcon />
</IconButton>
<IconButton aria-label="share" data-testId="MoreIcon">
<IconButton aria-label="share" data-testid="MoreIcon">
<MoreVertOutlinedIcon />
</IconButton>
</CardActions>
Expand Down
12 changes: 6 additions & 6 deletions src/components/CardTabs/Events/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ const EventsCard = props => {
<div className={classes.root}>
<Card
className={(classes.card, classes.root)}
data-testId="upcomingEventCard"
data-testid="upcomingEventCard"
>
<CardContent
style={{
width: "100%"
}}
>
<Typography variant="h5" component="div" gutterBottom>
<Typography variant="h5" component="div" gutterbottom="true">
{props.title}
</Typography>
{props.events.map(function (event, index) {
Expand All @@ -54,23 +54,23 @@ const EventsCard = props => {
container
direction="row"
spacing={2}
data-testId={index == 0 ? "upEventBox" : ""}
data-testid={index == 0 ? "upEventBox" : ""}
>
<Grid item xs={3}>
<img
src={event.img[0]}
className={classes.logo}
data-testId={index == 0 ? "upEventImg" : ""}
data-testid={index == 0 ? "upEventImg" : ""}
/>
</Grid>

<Grid item xs={9}>
<Box data-testId={index == 0 ? "upEventName" : ""}>
<Box data-testid={index == 0 ? "upEventName" : ""}>
<Typography>{event.name}</Typography>
</Box>
<Box
sx={{ fontWeight: 400, fontSize: "0.8rem" }}
data-testId={index == 0 ? "upEventDate" : ""}
data-testid={index == 0 ? "upEventDate" : ""}
>
<Typography>{event.date}</Typography>
</Box>
Expand Down
Loading
Loading