Skip to content

Commit

Permalink
fix: sonarqube issues
Browse files Browse the repository at this point in the history
- remove (unused) logic to skip steps
  • Loading branch information
cgawron committed Oct 7, 2024
1 parent 928ad21 commit acc745e
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions client/src/pages/Booking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const Booking = (props: any) => {

const [user, setUser] = useState<UserDocument>();
const [activeStep, setActiveStep] = React.useState(0);
const [skipped, setSkipped] = React.useState(new Set());
const [event, setEvent] = useState<Event>(EMPTY_EVENT);
const [selectedDate, setSelectedDate] = useState<Date>();
const [beginDate] = useState<Date>(new Date());
Expand Down Expand Up @@ -152,28 +151,12 @@ const Booking = (props: any) => {
return false;
};

const isStepSkipped = (step: number) => {
return skipped.has(step);
};


const handleBack = () => {
setActiveStep((prevActiveStep) => prevActiveStep - 1);
};

const handleSkip = () => {
if (!isStepOptional(activeStep)) {
// You probably want to guard against something like this,
// it should never occur unless someone's actively trying to break something.
throw new Error("You can't skip a step that isn't optional.");
}

setActiveStep((prevActiveStep) => prevActiveStep + 1);
setSkipped((prevSkipped) => {
const newSkipped = new Set(prevSkipped.values());
newSkipped.add(activeStep);
return newSkipped;
});
};

const handleReset = () => {
setActiveStep(0);
Expand Down Expand Up @@ -334,9 +317,6 @@ const Booking = (props: any) => {
<Typography variant="caption">Optional</Typography>
);
}
if (isStepSkipped(index)) {
stepProps.completed = false;
}
return (
<Step key={label} {...stepProps}>
<StepLabel {...labelProps}>{label}</StepLabel>
Expand All @@ -360,15 +340,6 @@ const Booking = (props: any) => {
{t("heroic_kind_llama_zip")}
</Button>
<div />
{isStepOptional(activeStep) && (
<Button
color="inherit"
onClick={handleSkip}

>
{t("awake_jolly_gazelle_lock")}
</Button>
)}

{activeStep === steps.length - 1 ? (
<Button variant="contained" type="submit">
Expand Down

0 comments on commit acc745e

Please sign in to comment.