Skip to content

Commit

Permalink
adding mobility
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonTheBusyBeaver117 committed Oct 3, 2023
1 parent 5727ce2 commit 8009dcc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
19 changes: 16 additions & 3 deletions src/components/Scout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ const Scout = () => {
</div>
{phaseTabContent}

<Undo wide = {false}></Undo>
{!showNext && (
<Undo width = {state.phase === "auto"? "default": "halfWide"}></Undo>
{state.phase === "auto" && (
<Dropdown
phase = {true}
wide = {false}
width = "default"
center = {true}
prop="chargeStation"
options={[
Expand All @@ -95,6 +95,19 @@ const Scout = () => {
]}
></Dropdown>
)}

{state.phase === "auto" && (
<Bool
phase = {true}
prop="mobility"
label="Mobility"
trueLabel="Mobility Success"
color="green"
tall={false}
></Bool>
)}


{showNext && <Next width ="halfWide"></Next>}

</>
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputs/Bool.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Bool = ({ label, trueLabel, prop, onFlip, phase, color, wide, tall}) => {

return (
<button
className={`${color ?? ""} ${wide ? " wide" : ""} ${tall ? "tall" : ""}`}
className={`${color ?? ""} ${wide ? " wide " : " default "} ${tall ? "tall" : ""}`}
disabled={current}
onClick={() => {
dispatch({
Expand Down
8 changes: 4 additions & 4 deletions src/components/inputs/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from "prop-types"
import "./inputs.scss"


const Dropdown = ({prop, phase, wide, center, options}) => {
const Dropdown = ({prop, phase, width, center, options}) => {
const [state, dispatch] = useContext(Context)
const optionsElems = useMemo(
() =>
Expand All @@ -17,10 +17,10 @@ const Dropdown = ({prop, phase, wide, center, options}) => {
)
return (
<select
className={(wide ? " wide " : " halfWide ") + (center ? " center-text " : "")}
className={(width ? width : " wide ") + (center ? " center-text " : "")}
onChange={(event) => {

console.log("phase:" + phase + " prop:" + prop + " val:" + event.target.value)
//console.log("phase:" + phase + " prop:" + prop + " val:" + event.target.value)

dispatch({
type: `set${phase ? "InPhase" : ""}`,
Expand All @@ -43,7 +43,7 @@ Dropdown.propTypes = {
})).isRequired,
prop: PropTypes.string.isRequired,
phase: PropTypes.bool,
wide: PropTypes.bool,
width: PropTypes.string,
center: PropTypes.bool
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/inputs/Undo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import PropTypes from "prop-types"

import "./buttons.scss"

const Undo = ({ wide }) => {
const Undo = ({ width }) => {
const [state, dispatch] = useContext(Context)

return (
<button
className={`${wide ? "wide" : "halfWide"} blue`}
className={`${width ? width : "halfWide"} blue`}
disabled={state.undoStack[state.phase].length === 0}
onClick={() => {
dispatch({ type: "undo" })
Expand All @@ -21,7 +21,7 @@ const Undo = ({ wide }) => {
}

Undo.propTypes = {
wide: PropTypes.bool,
width: PropTypes.string,
}

export default Undo
1 change: 1 addition & 0 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const initialState = {
phase: "auto", //auto, teleop, endgame
auto: {
chargeStation: "None",
mobility: false,
...grid,
},
teleop: {
Expand Down

0 comments on commit 8009dcc

Please sign in to comment.