Skip to content

Commit

Permalink
Merge branch 'feat/2023offseason' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonTheBusyBeaver117 committed Sep 28, 2023
2 parents 17beeb4 + bbfde9a commit f06429d
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scout",
"version": "2.0.0",
"csvApi": 3,
"csvApi": 4,
"homepage": "/",
"private": false,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
& .Tabs > .Tab {
min-height: 0px;
margin: 0px;
font-size: 1rem;
font-size: 1.6rem;
}
& .version {
display: flex;
Expand Down
17 changes: 16 additions & 1 deletion src/components/Scout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Undo from "./inputs/Undo"
import Info from "./inputs/Info"
import Bool from "./inputs/Bool"
import Numbers from "./inputs/Numbers"
import Dropdown from "./inputs/Dropdown"

import Count from "./inputs/Count"

Expand Down Expand Up @@ -80,8 +81,22 @@ const Scout = () => {
</div>
{phaseTabContent}

<Undo wide = {!showNext}></Undo>
<Undo wide = {false}></Undo>
{!showNext && (
<Dropdown
phase = {true}
wide = {false}
center = {true}
prop="chargeStation"
options={[
{label: "None", value: "None"},
{label: "Docked", value: "Docked"},
{label: "Engaged", value: "Engaged"}
]}
></Dropdown>
)}
{showNext && <Next width ="halfWide"></Next>}

</>
)
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/inputs/Dropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React, { useContext, useMemo } from "react"
import { Context } from "../../state"
import PropTypes from "prop-types"
import "./inputs.scss"

const Dropdown = ({prop, phase, wide, options}) => {

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

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

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

export default Dropdown
2 changes: 1 addition & 1 deletion src/components/inputs/Grid.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Grid = ({width}) => (
)

Grid.propTypes = {
width: PropTypes.oneOf(["default", "halfWide", "wide"])
width: PropTypes.oneOf(["default", "halfWide", "twoThirds", "wide"])
}

export default Grid
2 changes: 1 addition & 1 deletion src/components/inputs/Next.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Next = ({ width, tall, qualitative, isDisabled = false, disabledText = ""
dispatch({ type: qualitative ? "next_qualitative_mode" : "next_mode" })
}}
>
<p>{isDisabled ? disabledText : ""}</p>
{isDisabled && <p>{disabledText}</p>}
NEXT
</button>
)
Expand Down
5 changes: 5 additions & 0 deletions src/components/inputs/inputs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ input[type="number"],
input[type="text"],
textarea {
padding: 2px 2vw;
font-size: max(16px, 1.6rem);
}

p,
Expand Down Expand Up @@ -215,4 +216,8 @@ div.TripleTeamSelector {
// scss thinks we want pre-compile min so we need to bypass it
flex-basis: unquote("min(25vw, 100px)");
}
}

.center {
text-align: center;
}
4 changes: 1 addition & 3 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export const initialState = {
matchNum: undefined,
phase: "auto", //auto, teleop, endgame
auto: {
mobility: false,
docked: false,
engaged: false,
chargeStation: "None",
...grid,
},
teleop: {
Expand Down

0 comments on commit f06429d

Please sign in to comment.