Skip to content

Commit

Permalink
fix(sonar): fix code smells low
Browse files Browse the repository at this point in the history
  • Loading branch information
lailabjil committed Dec 14, 2023
1 parent 2b1957d commit 7193f42
Show file tree
Hide file tree
Showing 24 changed files with 169 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ const LoopSurveyPageHeader = (props: LoopSurveyPageHeaderProps) => {
<Box>
<Typography className={classes.infoText}>{label}</Typography>
</Box>
<Box>
<Box onClick={onClose} onKeyUp={onClose}>
<img
src={close}
alt={t("accessibility.asset.mui-icon.close")}
className={classes.actionIcon}
onClick={onClose}
onKeyUp={onClose}
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ const LoopSurveyPageSimpleHeader = (props: LoopSurveyPageSimpleHeaderProps) => {
return (
<Box className={cx(classes.headerBox)}>
<Box>{simpleHeaderLabel}</Box>
<Box>
<Box onClick={onNavigateBack} onKeyUp={onNavigateBack}>
<img
src={close}
alt={t("accessibility.asset.mui-icon.close")}
className={classes.actionIcon}
onClick={onNavigateBack}
onKeyUp={onNavigateBack}
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,11 @@ const SurveyPageEditHeader = (props: SurveyPageEditHeaderProps) => {
></Button>
<Typography className={classes.infoText}>{firstNamePrefix + firstName}</Typography>
</Box>
<Box>
<Box onClick={onEditSurvey} onKeyUp={onEditSurvey}>
<img
src={moreHorizontal}
alt={t("accessibility.asset.mui-icon.more-horizontal")}
className={classes.actionIcon}
onClick={onEditSurvey}
onKeyUp={onEditSurvey}
/>
<Popover
id={id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ const SurveyPageHeader = (props: SurveyPageHeaderProps) => {
<Box>
<Typography className={classes.infoText}>{surveyDate + " - " + firstName}</Typography>
</Box>
<Box>
<Box onClick={onNavigateBack} onKeyUp={onNavigateBack}>
<img
src={close}
alt={t("accessibility.asset.mui-icon.close")}
className={classes.actionIcon}
onClick={onNavigateBack}
onKeyUp={onNavigateBack}
/>
</Box>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ const SurveyPageSimpleHeader = (props: SurveyPageSimpleHeaderProps) => {
return (
<Box className={cx(classes.headerBox, backgroundWhite ? classes.headerWhiteBox : "")}>
<Box>{simpleHeaderLabel}</Box>
<Box>
<Box onClick={onNavigateBack} onKeyUp={onNavigateBack}>
<img
src={close}
alt={t("accessibility.asset.mui-icon.close")}
className={classes.actionIcon}
onClick={onNavigateBack}
onKeyUp={onNavigateBack}
id="close-button"
/>
</Box>
Expand Down
4 changes: 1 addition & 3 deletions src/components/edt/ActivityCard/ActivityOrRouteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,11 @@ const ActivityOrRouteCard = (props: ActivityOrRouteCardProps) => {
{renderWithScreen(activityOrRoute, classes, renderInsideAlert, t)}
</Box>
{onEdit && onDelete && modifiable && (
<Box className={classes.editBox}>
<Box className={classes.editBox} onClick={onEditCard} onKeyUp={onEditCard}>
<img
src={moreHorizontal}
alt={t("accessibility.asset.mui-icon.more-horizontal")}
className={classes.actionIcon}
onClick={onEditCard}
onKeyUp={onEditCard}
aria-label="editCardToggle"
/>
<Popover
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { makeStylesEdt } from "@inseefrlab/lunatic-edt";
import { Box } from "@mui/material";
import LinearProgress from "@mui/material/LinearProgress";
import React from "react";
import { useTranslation } from "react-i18next";

interface AddActivityOrRouteStepperStepperProps {
Expand All @@ -25,7 +24,7 @@ const AddActivityOrRouteStepper = (props: AddActivityOrRouteStepperStepperProps)
const { t } = useTranslation();
const { classes } = useStyles();
let stepIncrement = 100 / numberOfSteps;
const [progress, setProgress] = React.useState(stepIncrement * lastCompletedStepNumber);
const progress = stepIncrement * lastCompletedStepNumber;

return (
<Box className={classes.stepper}>
Expand Down
6 changes: 2 additions & 4 deletions src/components/edt/DayCharacteristic/DayCharacteristic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DayCharacteristics = (props: DayCharacteristicsProps) => {
const id = openPopOver ? "edit-or-delete-popover" : undefined;

const onEditIn = useCallback((e: React.MouseEvent) => {
onEdit && onEdit();
onEdit?.();
e.stopPropagation();
}, []);

Expand All @@ -51,13 +51,11 @@ const DayCharacteristics = (props: DayCharacteristicsProps) => {
{t("component.day-characteristic.title")}
</h2>
{onEdit && modifiable && (
<Box className={classes.editBox}>
<Box className={classes.editBox} onClick={onEditCard} onKeyUp={onEditCard}>
<img
src={moreHorizontal}
alt={t("accessibility.asset.mui-icon.more-horizontal")}
className={classes.actionIcon}
onClick={onEditCard}
onKeyUp={onEditCard}
aria-label="editCardToggle"
/>
<Popover
Expand Down
3 changes: 1 addition & 2 deletions src/components/edt/EndActivityStepper/EndActivityStepper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { makeStylesEdt } from "@inseefrlab/lunatic-edt";
import { Box, CircularProgress } from "@mui/material";
import Typography from "@mui/material/Typography";
import React from "react";

interface EndActivityStepperProps {
numberOfSteps: number;
Expand All @@ -14,7 +13,7 @@ const EndActivityStepper = (props: EndActivityStepperProps) => {
const { numberOfSteps, lastCompletedStepNumber, currentStepNumber, currentStepLabel } = props;
const { classes } = useStyles();
let stepIncrement = 100 / numberOfSteps;
const [progress] = React.useState(stepIncrement * lastCompletedStepNumber);
const progress = stepIncrement * lastCompletedStepNumber;

return (
<Box className={classes.stepper}>
Expand Down
61 changes: 29 additions & 32 deletions src/components/edt/HelpMenu/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { makeStylesEdt } from "@inseefrlab/lunatic-edt";
import { Box, Modal } from "@mui/material";
import { Default, Mobile } from "components/commons/Responsive/Responsive";
import { LunaticModel } from "interface/lunatic/Lunatic";
import React from "react";
import HelpMenuInner from "./HelpMenuInner";

interface HelpMenuProps {
Expand All @@ -28,37 +27,35 @@ const HelpMenu = (props: HelpMenuProps) => {
className={classes.shadowBackground}
sx={{ display: open ? "visible" : "none" }}
></Box>
<React.Fragment>
<Modal
open={open}
onClose={handleClose}
aria-labelledby={labelledBy}
aria-describedby={describedBy}
>
<>
<Default>
<HelpMenuInner
handleClose={handleClose}
onClickContact={onClickContact}
onClickInstall={onClickInstall}
onClickHelp={onClickHelp}
className={classes.modal}
isMobile={false}
/>
</Default>
<Mobile>
<HelpMenuInner
handleClose={handleClose}
onClickContact={onClickContact}
onClickInstall={onClickInstall}
onClickHelp={onClickHelp}
className={classes.modal}
isMobile={true}
/>
</Mobile>
</>
</Modal>
</React.Fragment>
<Modal
open={open}
onClose={handleClose}
aria-labelledby={labelledBy}
aria-describedby={describedBy}
>
<>
<Default>
<HelpMenuInner
handleClose={handleClose}
onClickContact={onClickContact}
onClickInstall={onClickInstall}
onClickHelp={onClickHelp}
className={classes.modal}
isMobile={false}
/>
</Default>
<Mobile>
<HelpMenuInner
handleClose={handleClose}
onClickContact={onClickContact}
onClickInstall={onClickInstall}
onClickHelp={onClickHelp}
className={classes.modal}
isMobile={true}
/>
</Mobile>
</>
</Modal>
</>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/components/edt/HouseholdCard/HouseholdCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ interface HouseholdCardProps {
closedSurveyLabel: string;
validatedSurveyLabel: string;
dataHousehold: any;
onClick?: () => void;
tabIndex: number;
}

Expand Down
Loading

0 comments on commit 7193f42

Please sign in to comment.