Skip to content

Commit

Permalink
merge with develop
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Feb 7, 2025
2 parents bcb0d12 + 76324b8 commit b78a55e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import PropTypes from "prop-types";
import { createUseStyles } from "react-jss";
import clsx from "clsx";
import debounce from "lodash/debounce";
import ResetButtons from "../WizardPages/ResetButtons";

const useStyles = createUseStyles(theme => ({
parkingProvidedWrapper: {
display: "flex",
flexDirection: "column",
alignItems: "center",
margin: "2em"
margin: "2em",
marginTop: "1em"
},
label: {
...theme.typography.heading2
...theme.typography.heading2,
marginTop: "1em"
},
requiredInputLabel: {
"&:after": {
Expand Down Expand Up @@ -42,7 +45,7 @@ const useStyles = createUseStyles(theme => ({
}
}));

const ParkingProvidedRuleInput = ({ rule, onInputChange }) => {
const ParkingProvidedRuleInput = ({ rule, onInputChange, resetProject }) => {
const { code, name, value, units, maxValue, validationErrors, required } =
rule;
const classes = useStyles();
Expand All @@ -61,12 +64,25 @@ const ParkingProvidedRuleInput = ({ rule, onInputChange }) => {
onDebounceInputChange(e);
};

const handleClear = e => {
setShowValidationErrors(true);
setSpacesProvided("");
onDebounceInputChange(e);
};

const onBlur = () => {
setShowValidationErrors(true);
};

return (
<div className={classes.parkingProvidedWrapper}>
<div className={classes.pkgSelectContainer}>
<ResetButtons
className={classes.alignRight}
uncheckAll={handleClear}
resetProject={resetProject}
/>
</div>
<label htmlFor={code} className={clsx(classes.label, requiredStyle)}>
{name}
</label>
Expand Down Expand Up @@ -103,7 +119,8 @@ ParkingProvidedRuleInput.propTypes = {
validationErrors: PropTypes.array,
required: PropTypes.bool.isRequired
}).isRequired,
onInputChange: PropTypes.func.isRequired
onInputChange: PropTypes.func.isRequired,
resetProject: PropTypes.func.isRequired
};

export default ParkingProvidedRuleInput;
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { createUseStyles, useTheme } from "react-jss";
import RuleCalculationPanels from "../RuleCalculation/RuleCalculationPanels";
import Level0Page from "./Level0Page";
import ParkingProvidedRuleInput from "../RuleInput/ParkingProvidedRuleInput";
import ResetButtons from "./ResetButtons";

const useStyles = createUseStyles(theme => ({
projectBox: {
Expand Down Expand Up @@ -56,7 +55,6 @@ function ProjectTargetPoints(props) {
onInputChange,
isLevel0,
onParkingProvidedChange,
uncheckAll,
resetProject
} = props;
const projectLevel = rules.find(e => e.code === "LEVEL");
Expand All @@ -69,11 +67,7 @@ function ProjectTargetPoints(props) {

return (
<>
<Level0Page
isLevel0={isLevel0}
uncheckAll={uncheckAll}
resetProject={resetProject}
/>
<Level0Page isLevel0={isLevel0} resetProject={resetProject} />

{projectLevel && projectLevel.calcValue > 0 && (
<div>
Expand All @@ -86,20 +80,13 @@ function ProjectTargetPoints(props) {
entered below.
</span>
</div>
<div className={classes.pkgSelectContainer}>
<ResetButtons
className={classes.alignRight}
uncheckAll={uncheckAll}
resetProject={resetProject}
/>
</div>
{parkingProvidedRuleOnly && (
<ParkingProvidedRuleInput
rule={parkingProvidedRuleOnly}
onInputChange={onParkingProvidedChange}
resetProject={resetProject}
/>
)}

<div className={classes.projectBox}>
<h4>
<span className={classes.PLLabel}>Your project level </span>
Expand Down Expand Up @@ -129,7 +116,6 @@ ProjectTargetPoints.propTypes = {
onInputChange: PropTypes.func.isRequired,
onParkingProvidedChange: PropTypes.func.isRequired,
isLevel0: PropTypes.bool.isRequired,
uncheckAll: PropTypes.func.isRequired,
resetProject: PropTypes.func.isRequired
};

Expand Down
10 changes: 6 additions & 4 deletions client/src/components/ProjectWizard/WizardPages/ResetButtons.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ const ResetButtons = props => {
>
Reset Project
</button>
<button className={classes.unSelectButton} onClick={uncheckAll}>
Clear Page
</button>
{uncheckAll && (
<button className={classes.unSelectButton} onClick={uncheckAll}>
Clear Page
</button>
)}
</div>
);
};

ResetButtons.propTypes = {
uncheckAll: PropTypes.func.isRequired,
uncheckAll: PropTypes.func,
resetProject: PropTypes.func.isRequired
};

Expand Down
1 change: 0 additions & 1 deletion client/src/components/ToolTip/AccordionToolTip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const AccordionToolTip = ({
<div className={clsx(classes.triangle)}>
<div className={clsx(classes.triangleInner)}></div>
</div>

{disabledStyle ? (
<div
className={clsx(
Expand Down

0 comments on commit b78a55e

Please sign in to comment.