From cec838aa0a61ef62ee908078aada47f0ba2cc9bb Mon Sep 17 00:00:00 2001 From: Brandon Ball <74022057+bhball22@users.noreply.github.com> Date: Fri, 22 Apr 2022 14:20:32 -0500 Subject: [PATCH 1/6] Reset button on Hydraulic System --- src/Componets/HydrolicSystem.jsx | 7 +++++++ src/Componets/Styles/HydrolicSystem.css | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/Componets/HydrolicSystem.jsx b/src/Componets/HydrolicSystem.jsx index 225536b..45dde1b 100644 --- a/src/Componets/HydrolicSystem.jsx +++ b/src/Componets/HydrolicSystem.jsx @@ -11,6 +11,7 @@ class HydrolicSystem extends Component { super(props); //Simulation Variables / Default values this.state = {psi: 1500 , PsiColor: 'green',LHV: "Open", RHV: "Open", LHF: false, RHF: false, HYD: false, HydPress:"Norm", PRV:"Working", LeftEngine:"Functioning", RightEngine:"Functioning", LeftFilter:"Flowing", RightFilter:"Flowing", TopFilter:"Flowing"}; + this.initialState = this.state; this.handleChange = this.handleChange.bind(this); this.updateSimVariables = this.updateSimVariables.bind(this); } @@ -21,6 +22,9 @@ class HydrolicSystem extends Component { event.preventDefault(); + if(event.target.id === 'RESET'){ + await this.setState(this.initialState); + } if(event.target.id === 'LV'){ //ID: LV and LVENG both open and close the left valve. await this.setState({ LHV: this.state.LHV === "Open" ? "Closed" : "Open"}); } @@ -329,6 +333,9 @@ class HydrolicSystem extends Component { +