diff --git a/scoutingapp/public/coneSprite.png b/scoutingapp/public/coneSprite.png new file mode 100644 index 0000000..85eb1bb Binary files /dev/null and b/scoutingapp/public/coneSprite.png differ diff --git a/scoutingapp/public/coneSprite.svg b/scoutingapp/public/coneSprite.svg new file mode 100644 index 0000000..b0c98ec --- /dev/null +++ b/scoutingapp/public/coneSprite.svg @@ -0,0 +1,25 @@ + + + + +Created by potrace 1.15, written by Peter Selinger 2001-2017 + + + + + diff --git a/scoutingapp/public/cubeSprite.png b/scoutingapp/public/cubeSprite.png new file mode 100644 index 0000000..8cd4e3b Binary files /dev/null and b/scoutingapp/public/cubeSprite.png differ diff --git a/scoutingapp/public/cubeSprite.svg b/scoutingapp/public/cubeSprite.svg new file mode 100644 index 0000000..27f8af4 --- /dev/null +++ b/scoutingapp/public/cubeSprite.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/scoutingapp/public/fieldMapBlue.png b/scoutingapp/public/fieldMapBlue.png new file mode 100644 index 0000000..bd1371b Binary files /dev/null and b/scoutingapp/public/fieldMapBlue.png differ diff --git a/scoutingapp/src/App.tsx b/scoutingapp/src/App.tsx index 3764018..e98e494 100644 --- a/scoutingapp/src/App.tsx +++ b/scoutingapp/src/App.tsx @@ -1,11 +1,15 @@ import './App.css' import { Routes, Route } from 'react-router-dom'; -import { Page, ParentPage } from "./components/pages" +import { Page, ParentPage, StoragePage } from "./components/pages" import structure from "./config/structure.json" import React from 'react'; function App() { + if ([null, ""].includes(localStorage.getItem("codes"))){ + localStorage.setItem("codes", "{}") + } + return ( }> @@ -16,6 +20,7 @@ function App() { ) }) } + }> diff --git a/scoutingapp/src/components/inputs/ConeCubeIncrementInput.tsx b/scoutingapp/src/components/inputs/ConeCubeIncrementInput.tsx new file mode 100644 index 0000000..d24e975 --- /dev/null +++ b/scoutingapp/src/components/inputs/ConeCubeIncrementInput.tsx @@ -0,0 +1,69 @@ +import React from "react" +import { useState } from "react"; +import { ComponentSetup } from "../interface"; + +function ConeCubeIncrementInput(props: ComponentSetup) { + + const [coneCounter, setConeCounter] = useState(0) + const [cubeCounter, setCubeCounter] = useState(0) + + const color = props?.options?.[0] + + const updateStateText = (values: any) => { + var state = props.getValue + + + state[props.id] = values + props.setValue(state) + } + + return ( +
+ +
+
+ +
+

{coneCounter}

+
+ +
+
+ +
+

{cubeCounter}

+
+ +
+
+
+ ) +} + +export default ConeCubeIncrementInput \ No newline at end of file diff --git a/scoutingapp/src/components/inputs/DropdownTextInput.tsx b/scoutingapp/src/components/inputs/DropdownTextInput.tsx index af3d0f6..3048f39 100644 --- a/scoutingapp/src/components/inputs/DropdownTextInput.tsx +++ b/scoutingapp/src/components/inputs/DropdownTextInput.tsx @@ -21,10 +21,15 @@ function DropdownTextInput(props: ComponentSetup) {
{ //console.log(props.getValue) var state = props.getValue @@ -26,8 +28,8 @@ function IncrementNumberInput(props: ComponentSetup) { > - -
-

{counter}

+
+

{counter}

{gridValues["1L"] == false && ( @@ -185,6 +235,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

1L

)} + {gridValues["1L"] == "supercharge" && ( +
{toggle("1L")}}> +

1L

+
+ )} {gridValues["2L"] == false && (
{toggle("2L")}}>

2L

@@ -200,6 +255,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

2L

)} + {gridValues["2L"] == "supercharge" && ( +
{toggle("2L")}}> +

2L

+
+ )} {gridValues["3L"] == false && (
{toggle("3L")}}>

3L

@@ -215,6 +275,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

3L

)} + {gridValues["3L"] == "supercharge" && ( +
{toggle("3L")}}> +

3L

+
+ )}
)} @@ -226,31 +291,46 @@ export function ChargedUpGridSelect(props: ComponentSetup){

4H

)} - {gridValues["4H"] == true && ( + {gridValues["4H"] == "cone" && (
{toggle("4H")}}>

4H

)} + {gridValues["4H"] == "supercharge" && ( +
{toggle("4H")}}> +

4H

+
+ )} {gridValues["5H"] == false && (
{toggle("5H")}}>

5H

)} - {gridValues["5H"] == true && ( + {gridValues["5H"] == "cube" && (
{toggle("5H")}}>

5H

)} + {gridValues["5H"] == "supercharge" && ( +
{toggle("5H")}}> +

5H

+
+ )} {gridValues["6H"] == false && (
{toggle("6H")}}>

6H

)} - {gridValues["6H"] == true && ( + {gridValues["6H"] == "cone" && (
{toggle("6H")}}>

6H

)} + {gridValues["6H"] == "supercharge" && ( +
{toggle("6H")}}> +

6H

+
+ )}
{gridValues["4M"] == false && ( @@ -258,31 +338,46 @@ export function ChargedUpGridSelect(props: ComponentSetup){

4M

)} - {gridValues["4M"] == true && ( + {gridValues["4M"] == "cone" && (
{toggle("4M")}}>

4M

)} + {gridValues["4M"] == "supercharge" && ( +
{toggle("4M")}}> +

4M

+
+ )} {gridValues["5M"] == false && (
{toggle("5M")}}>

5M

)} - {gridValues["5M"] == true && ( + {gridValues["5M"] == "cube" && (
{toggle("5M")}}>

5M

)} + {gridValues["5M"] == "supercharge" && ( +
{toggle("5M")}}> +

5M

+
+ )} {gridValues["6M"] == false && (
{toggle("6M")}}>

6M

)} - {gridValues["6M"] == true && ( + {gridValues["6M"] == "cone" && (
{toggle("6M")}}>

6M

)} + {gridValues["6M"] == "supercharge" && ( +
{toggle("6M")}}> +

6M

+
+ )}
{gridValues["4L"] == false && ( @@ -300,6 +395,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

4L

)} + {gridValues["4L"] == "supercharge" && ( +
{toggle("4L")}}> +

4L

+
+ )} {gridValues["5L"] == false && (
{toggle("5L")}}>

5L

@@ -315,6 +415,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

5L

)} + {gridValues["5L"] == "supercharge" && ( +
{toggle("5L")}}> +

5L

+
+ )} {gridValues["6L"] == false && (
{toggle("6L")}}>

6L

@@ -330,6 +435,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

6L

)} + {gridValues["6L"] == "supercharge" && ( +
{toggle("6L")}}> +

6L

+
+ )} )} @@ -341,31 +451,46 @@ export function ChargedUpGridSelect(props: ComponentSetup){

7H

)} - {gridValues["7H"] == true && ( + {gridValues["7H"] == "cone" && (
{toggle("7H")}}>

7H

)} + {gridValues["7H"] == "supercharge" && ( +
{toggle("7H")}}> +

7H

+
+ )} {gridValues["8H"] == false && (
{toggle("8H")}}>

8H

)} - {gridValues["8H"] == true && ( + {gridValues["8H"] == "cube" && (
{toggle("8H")}}>

8H

)} + {gridValues["8H"] == "supercharge" && ( +
{toggle("8H")}}> +

8H

+
+ )} {gridValues["9H"] == false && (
{toggle("9H")}}>

9H

)} - {gridValues["9H"] == true && ( + {gridValues["9H"] == "cone" && (
{toggle("9H")}}>

9H

)} + {gridValues["9H"] == "supercharge" && ( +
{toggle("9H")}}> +

9H

+
+ )}
{gridValues["7M"] == false && ( @@ -373,31 +498,46 @@ export function ChargedUpGridSelect(props: ComponentSetup){

7M

)} - {gridValues["7M"] == true && ( + {gridValues["7M"] == "cone" && (
{toggle("7M")}}>

7M

)} + {gridValues["7M"] == "supercharge" && ( +
{toggle("7M")}}> +

7M

+
+ )} {gridValues["8M"] == false && (
{toggle("8M")}}>

8M

)} - {gridValues["8M"] == true && ( + {gridValues["8M"] == "cube" && (
{toggle("8M")}}>

8M

)} + {gridValues["8M"] == "supercharge" && ( +
{toggle("8M")}}> +

8M

+
+ )} {gridValues["9M"] == false && (
{toggle("9M")}}>

9M

)} - {gridValues["9M"] == true && ( + {gridValues["9M"] == "cone" && (
{toggle("9M")}}>

9M

)} + {gridValues["9M"] == true && ( +
{toggle("9M")}}> +

9M

+
+ )}
{gridValues["7L"] == false && ( @@ -415,6 +555,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

7L

)} + {gridValues["7L"] == "supercharge" && ( +
{toggle("7L")}}> +

7L

+
+ )} {gridValues["8L"] == false && (
{toggle("8L")}}>

8L

@@ -430,6 +575,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

8L

)} + {gridValues["8L"] == "supercharge" && ( +
{toggle("8L")}}> +

8L

+
+ )} {gridValues["9L"] == false && (
{toggle("9L")}}>

9L

@@ -445,6 +595,11 @@ export function ChargedUpGridSelect(props: ComponentSetup){

9L

)} + {gridValues["9L"] == "supercharge" && ( +
{toggle("9L")}}> +

9L

+
+ )} )} diff --git a/scoutingapp/src/components/selects/ChargedUpStartingPosition.tsx b/scoutingapp/src/components/selects/ChargedUpStartingPosition.tsx new file mode 100644 index 0000000..5c5123b --- /dev/null +++ b/scoutingapp/src/components/selects/ChargedUpStartingPosition.tsx @@ -0,0 +1,50 @@ +import { useState } from "react" +import { ComponentSetup } from "../interface" +import "./index.css" + +function ChargedUpStartingPosition(props: ComponentSetup) { + + const [toggleValue, setToggleValue] = useState("") + + function toggle(switchValue: any) { + if (toggleValue == switchValue) { + setToggleValue("") + updateStateSelections("") + } else { + setToggleValue(switchValue) + updateStateSelections(switchValue) + } + } + + const updateStateSelections = (newValue: any) => { + var state = props.getValue + state[props.id] = newValue + props.setValue(state) + } + + return ( +
+ +
+
toggle("Loading Zone")}> + Loading Zone +
+
toggle("Charge Station")}> + Charge Station +
+
toggle("Cable Cover")}> + Cable Cover +
+
+
+ +
+
+ ) +} + +export default ChargedUpStartingPosition \ No newline at end of file diff --git a/scoutingapp/src/components/selects/GenericDropdown.tsx b/scoutingapp/src/components/selects/GenericDropdown.tsx index f9c2e84..86f1012 100644 --- a/scoutingapp/src/components/selects/GenericDropdown.tsx +++ b/scoutingapp/src/components/selects/GenericDropdown.tsx @@ -20,9 +20,15 @@ function GenericDropdown(props: ComponentSetup) {
diff --git a/scoutingapp/src/components/selects/GenericRadioSelect.tsx b/scoutingapp/src/components/selects/GenericRadioSelect.tsx index 869448f..d071d55 100644 --- a/scoutingapp/src/components/selects/GenericRadioSelect.tsx +++ b/scoutingapp/src/components/selects/GenericRadioSelect.tsx @@ -24,44 +24,49 @@ function GenericRadioSelect(props: ComponentSetup) {
- {props.options?.length == 2 && props.options?.[0] == "red" && props.options?.[1] == "blue" && -
-
-
- -

red

-
-
-
-
- -

blue

+ {props.options?.length == 2 && props.options?.[0] == "red" && props.options?.[1] == "blue" && +
+
+
+ +

red

+
-
-
- } - {!(props.options?.length == 2 && props.options?.[0] == "red" && props.options?.[1] == "blue") && -
-
- { props.options?.slice(0, Math.ceil(props.options?.length / 2)).map (option => ( -
- -

{option}

+
+
+ +

blue

- ))} +
-
- { props.options?.slice(Math.ceil(props.options?.length / 2)).map (option => ( -
- -

{option}

-
- ))} + } + {!(props.options?.length == 2 && props.options?.[0] == "red" && props.options?.[1] == "blue") && +
+
+ { props.options?.slice(0, Math.ceil(props.options?.length / 2)).map (option => ( +
+ +

{option}

+
+ ))} +
+
+ { props.options?.slice(Math.ceil(props.options?.length / 2)).map (option => ( +
+ +

{option}

+
+ ))} +
-
- } + }
) diff --git a/scoutingapp/src/components/texts/QRCodeModal.tsx b/scoutingapp/src/components/texts/QRCodeModal.tsx index 6c26810..002394d 100644 --- a/scoutingapp/src/components/texts/QRCodeModal.tsx +++ b/scoutingapp/src/components/texts/QRCodeModal.tsx @@ -4,23 +4,63 @@ import QRCode from 'react-qr-code' export function QRCodeModal(props: ComponentSetup){ const [componentInside, setComponentInside] = useState(<>) + /* + + */ + + const addToLocalStorage = function () { + console.log(localStorage.getItem("codes") as string) + var currentData = JSON.parse(localStorage.getItem("codes") as string) + currentData[props.getValue["MatchKey"].join("")] = props.getValue["export"].text + localStorage.setItem("codes", JSON.stringify(currentData)) + } useEffect(() => { const interval = setInterval(() => { + var requiredFinished = true + + console.log(props.required) + for (const id of props.required){ + console.log(props.getValue[id]) + if (["", [], ","].includes(props.getValue[id]) || + (props.getValue[id][0].length == 2 && + (props.getValue[id][0] == "" || props.getValue[id][1] == "") + ) + ){ + requiredFinished = false + break + } + } + if (props.getValue.result == true){ - setComponentInside( -
-

QR Code

- -

{props.getValue["export"].text}

-
- ) + if (requiredFinished){ + addToLocalStorage() + setComponentInside( +
+
+

QR Code

+ +
+ +
+ ) + } + else { + setComponentInside( +
+
+ Required Fields not finished +
+
+ ) + } + } else { setComponentInside( diff --git a/scoutingapp/src/config/structure.json b/scoutingapp/src/config/structure.json index 7174052..faba235 100644 --- a/scoutingapp/src/config/structure.json +++ b/scoutingapp/src/config/structure.json @@ -17,7 +17,8 @@ "placeholder": [ "Pranav" ], - "id": "ScoutId" + "id": "ScoutId", + "required": true }, { "type": "DropdownTextInput", @@ -31,7 +32,8 @@ "placeholder": [ "number" ], - "id": "MatchKey" + "id": "MatchKey", + "required": true }, { "type": "GenericRadioSelect", @@ -40,8 +42,8 @@ "red", "blue" ], - "required": true, - "id": "Alliance" + "id": "Alliance", + "required": true }, { "type": "GenericDropdown", @@ -51,7 +53,8 @@ "2", "3" ], - "id": "DriverStation" + "id": "DriverStation", + "required": true }, { "type": "GenericTextInput", @@ -59,54 +62,74 @@ "placeholder": [ "9999" ], - "id": "TeamNumber" + "id": "TeamNumber", + "required": true }, { "type": "Spacing" }, { "type": "GenericHeaderTwo", - "text": "Auto" + "text": "Auto Starting Position" }, { - "type": "GenericToggle", - "text": "Preloaded", - "id": "Preloaded" + "type": "ChargedUpStartingPosition", + "text": "", + "id": "StartingPosition" }, { - "type": "ChargedUpGridSelect", - "text": "Auto Grid", - "id": "AutoGrid" + "type": "Spacing" }, + { + "type": "GenericHeaderTwo", + "text": "Auto Game Pieces" + }, + + + { + "type": "IncrementNumberInput", + "text": "Auto High", + "placeholder": ["0"], + "options": ["green"], + "id": "AutoHigh" + }, + + { + "type": "IncrementNumberInput", + "text": "Auto Mid", + "placeholder": ["0"], + "options": ["yellow"], + "id": "AutoMid" + }, + + { + "type": "IncrementNumberInput", + "text": "Auto Low", + "placeholder": ["0"], + "options": ["red"], + "id": "AutoLow" + }, + { "type": "IncrementNumberInput", "text": "Auto Missed", "placeholder": ["0"], + "options": [], "id": "AutoMissed" }, { - "type": "GenericToggle", - "text": "Mobile", - "id": "Mobile" + "type": "GenericHeaderTwo", + "text": "Auto Engage" }, { - "type": "GenericCheckboxSelect", - "text": "Auto Attempted Charge", - "options": [ - "Dock", - "Engage" - ], + "type": "GenericToggle", + "text": "Auto Engage Attempted", "id": "AutoAttemptedCharge" }, { - "type": "GenericRadioSelect", - "text": "Robot Charging Pad State", - "options": [ - "None", - "Docked", - "Engaged" - ], - "id": "AutoChargingState" + "type": "GenericToggle", + "text": "Auto Engage Succeeded", + "id": "AutoAttemptedCharge" }, { "type": "GenericTextArea", @@ -121,22 +144,29 @@ }, { "type": "GenericHeaderTwo", - "text": "Teleop" + "text": "Teleop Game Pieces" }, { - "type": "ChargedUpGridSelect", - "text": "Teleop Grid", - "id": "TeleopGrid" + "type": "ConeCubeIncrementInput", + "text": "Teleop High", + "options":["green"], + "id": "TeleopHigh" }, { - "type": "IncrementNumberInput", - "text": "Teleop Missed", - "placeholder": ["0"], - "id": "TeleopMissed" + "type": "ConeCubeIncrementInput", + "text": "Teleop Mid", + "options":["yellow"], + "id": "TeleopMid" + }, + { + "type": "ConeCubeIncrementInput", + "text": "Teleop Low", + "options":["red"], + "id": "TeleopLow" }, { "type": "GenericTextArea", - "text": "Teleop Notes", + "text": "Teleop or Endgame Notes", "id": "TeleopNotes" }, { @@ -145,46 +175,6 @@ { "type": "Spacing" }, - { - "type": "GenericHeaderTwo", - "text": "Endgame" - }, - { - "type": "Timer" - }, - { - "type": "GenericCheckboxSelect", - "text": "Endgame Attempted Charge", - "options": [ - "Dock", - "Engage" - ], - "id": "EndgameAttemptedCharge" - }, - { - "type": "GenericRadioSelect", - "text": "Final Charge", - "options": [ - "None", - "Dock", - "Engage", - "Parked" - ], - "id": "EndgameFinalCharge" - }, - { - "type": "GenericTextInput", - "text": "Final Charge Time", - "options": [ - "" - ], - "id": "EndgameChargeTime" - }, - { - "type": "GenericTextArea", - "text": "Endgame Notes", - "id": "EndgameNotes" - }, { "type": "Spacing" }, @@ -202,56 +192,14 @@ "text": "Were they tippy", "id": "Tippy" }, - { - "type": "SliderInput", - "text": "How much do they play defense (0-100%)", - "options": [ - "0", - "100", - "20" - ], - "placeholder":[0], - "id": "DefenseTime" - }, - { - "type": "SliderInput", - "text": "Defense rating (0 is no defense)", - "options": [ - "0", - "5" - ], - "placeholder":[0], - "id": "DefenseRating" - }, - { - "type": "SliderInput", - "text": "How much were they defended (0-100%)", - "options": [ - "0", - "100", - "20" - ], - "placeholder":[0], - "id": "DefendedTime" - }, - { - "type": "SliderInput", - "text": "Counter defense rating (0 is no counter defense)", - "options": [ - "0", - "5" - ], - "placeholder":[0], - "id": "CounterDefenseRating" - }, { "type": "SliderInput", "text": "How well do they drive", "options": [ - "0", + "1", "5" ], - "placeholder":[0], + "placeholder":[3], "id": "DriverRating" }, { @@ -274,14 +222,17 @@ "Alliance", "DriverStation", "TeamNumber", - "Preloaded", - "AutoGrid", + "StartingPosition", + "AutoHigh", + "AutoMid", + "AutoLow", "AutoMissed", - "Mobile", - "AutoAttemptedCharge", - "AutoChargingState", + "AutoEngageAttempted", + "AutoEngageSuccessful", "AutoNotes", - "TeleopGrid", + "TeleopHigh", + "TeleopMid", + "TeleopLow", "TeleopMissed", "TeleopNotes", "EndgameAttemptedCharge", @@ -292,8 +243,6 @@ "Tippy", "DefenseTime", "DefenseRating", - "DefendedTime", - "CounterDefenseRating", "DriverRating", "RatingNotes" ]