Skip to content

Commit

Permalink
Merge pull request #16 from FRC2713/2024_config_1
Browse files Browse the repository at this point in the history
Add default 2024 config v1, allow resetting to default config via UI.
  • Loading branch information
tytremblay authored Jan 11, 2024
2 parents e92ee8e + a00c205 commit 906ccac
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 68 deletions.
278 changes: 278 additions & 0 deletions config/2024/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
{
"$schema": "../schema.json",
"title": "QRScout",
"page_title": "Crescendo",
"sections": [
{
"name": "Prematch",
"preserveDataOnReset": true,
"fields": [
{
"title": "Scouter Initials",
"type": "text",
"required": true,
"code": "scouter"
},
{
"title": "Match Number",
"type": "number",
"required": true,
"code": "matchNumber"
},
{
"title": "Robot",
"type": "select",
"required": true,
"code": "robot",
"choices": {
"R1": "Red 1",
"R2": "Red 2",
"R3": "Red 3",
"B1": "Blue 1",
"B2": "Blue 2",
"B3": "Blue 3"
},
"defaultValue": "R1"
},
{
"title": "Team Number",
"type": "number",
"required": true,
"code": "teamNumber"
},
{
"title": "Human Player at Amp",
"type": "boolean",
"required": false,
"defaultValue": false,
"code": "humanPlayer"
},
{
"title": "No Show",
"type": "boolean",
"defaultValue": false,
"required": false,
"code": "noShow"
}
]
},
{
"name": "Autonomous",
"fields": [
{
"code": "auamp",
"title": "Amp Scored",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "auampm",
"title": "Amp Missed",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "ausc",
"title": "Speaker Scored",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "auln",
"title": "Loaded More Notes?",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "auf",
"title": "Auto Foul",
"type": "boolean",
"defaultValue": false,
"required": false
}
]
},
{
"name": "Teleop",
"fields": [
{
"code": "tcoop",
"title": "Coopertition",
"type": "boolean",
"defaultValue": false,
"required": false
},
{
"code": "tamps",
"title": "Amp Scored",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "tampm",
"title": "Amp Missed",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "tsc",
"title": "Speaker Scored",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"code": "tsm",
"title": "Speaker Missed",
"type": "counter",
"defaultValue": 0,
"min": 0,
"required": false
},
{
"title": "Note Pickup Location",
"type": "select",
"required": true,
"code": "Npl",
"choices": {
"N": "None",
"G": "Ground",
"MS": "Manually Set",
"B": "Both"
},
"defaultValue": "None"
}
]
},
{
"name": "Endgame",
"fields": [
{
"title": "End Position",
"type": "select",
"required": true,
"code": "epo",
"choices": {
"No": "No Climb",
"P": "Parked",
"Os": "Onstage",
"Sl": "Spotlight"
},
"defaultValue": "No Climb"
},
{
"code": "cn",
"title": "Note in Trap?",
"type": "boolean",
"defaultValue": 0,
"required": false
},
{
"title": "Harmony",
"type": "select",
"required": true,
"code": "harm",
"choices": {
"Not": "Not Completed",
"Fir": "First on Chain",
"Sec": "Second on Chain",
"Thir": "Third on Chain"
},
"defaultValue": "Not Completed"
},
{
"title": "High Note",
"type": "select",
"required": true,
"code": "harm",
"choices": {
"Noo": "None",
"hupl": "Human Player",
"ro": "Robot"
},
"defaultValue": "None"
}
]
},
{
"name": "Postmatch",
"fields": [
{
"code": "or",
"title": "Offense Skill",
"type": "select",
"choices": {
"1": "Not Effective",
"2": "Average",
"3": "Very Effective",
"x": "Not Observed"
},
"required": false
},
{
"code": "dr",
"title": "Defense Skill",
"type": "select",
"choices": {
"1": "Not Effective",
"2": "Average",
"3": "Very Effective",
"x": "Not Observed"
},
"defaultValue": "x",
"required": false
},
{
"code": "Fou/Tech",
"title": "Foul",
"type": "counter",
"defaultValue": 0,
"required": false
},
{
"code": "d",
"title": "Died",
"type": "boolean",
"defaultValue": false,
"required": false
},
{
"code": "to",
"title": "Tipped Over",
"type": "boolean",
"defaultValue": false,
"required": false
},
{
"code": "yc",
"title": "Yellow/Red Card",
"type": "boolean",
"defaultValue": false,
"required": false
},

{
"code": "co",
"title": "Comments",
"type": "text",
"min": 0,
"max": 50,
"required": false
}
]
}
]
}
3 changes: 3 additions & 0 deletions config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"Config": {
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"title": {
"type": "string"
},
Expand Down
58 changes: 31 additions & 27 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Button, { Variant } from './components/core/Button';
import {
getQRCodeData,
resetSections,
resetToDefaultConfig,
uploadConfig,
useQRScoutState,
} from './store/store';
Expand Down Expand Up @@ -102,10 +103,9 @@ export function App() {
Reset
</button>
</div>
<div className="mb-4 flex flex-col justify-center rounded bg-white shadow-md dark:bg-gray-600">
<div className="mb-4 flex flex-col justify-center rounded bg-white shadow-md dark:bg-gray-600 gap-2 p-2">
<Button
variant={Variant.Secondary}
className="m-2"
onClick={() =>
navigator.clipboard.writeText(
formData.sections
Expand All @@ -120,12 +120,11 @@ export function App() {
</Button>
<Button
variant={Variant.Secondary}
className="m-2"
onClick={() => downloadConfig()}
>
Download Config
</Button>
<label className="m-2 flex cursor-pointer flex-row justify-center rounded bg-gray-500 py-2 text-center font-bold text-white shadow-sm hover:bg-gray-600">
<label className="mx-2 flex cursor-pointer flex-row justify-center rounded bg-gray-500 py-2 text-center font-bold text-white shadow-sm hover:bg-gray-600">
<span className="text-base leading-normal">Upload Config</span>
<input
type="file"
Expand All @@ -134,30 +133,35 @@ export function App() {
onChange={e => uploadConfig(e)}
/>
</label>
{
<div className="m-2 flex flex-col justify-start bg-gray-500 p-2">
<div className="rounded-t pb-2 text-left font-bold text-white">
Theme
</div>
<select
className="rounded bg-white px-4 py-2 dark:bg-gray-700 dark:text-white"
name="Theme"
id="theme"
onInput={v => setTheme(v.currentTarget.value)}
value={theme}
>
<option key={'system'} value={'system'}>
System
</option>
<option key={'dark'} value={'dark'}>
Dark
</option>
<option key={'light'} value={'light'}>
Light
</option>
</select>
<div className="mx-2 flex flex-col justify-start bg-gray-500 p-2 rounded">
<div className="rounded-t pb-2 text-left font-bold text-white">
Theme
</div>
}
<select
className="rounded bg-white px-4 py-2 dark:bg-gray-700 dark:text-white"
name="Theme"
id="theme"
onInput={v => setTheme(v.currentTarget.value)}
value={theme}
>
<option key={'system'} value={'system'}>
System
</option>
<option key={'dark'} value={'dark'}>
Dark
</option>
<option key={'light'} value={'light'}>
Light
</option>
</select>
</div>

<Button
variant={Variant.Secondary}
onClick={() => resetToDefaultConfig()}
>
Reset To Default Config
</Button>
</div>
</div>
</form>
Expand Down
Loading

0 comments on commit 906ccac

Please sign in to comment.