|
| 1 | +import { useState } from "react"; |
| 2 | +import { RobotPosition } from "requests"; |
| 3 | +import CheckBoxMatch from './CheckBoxButton'; |
| 4 | +import CoralSectionButton from "./CoralSectionButton"; |
| 5 | +import bluesidematch from 'path/to/bluesidematch.png'; |
| 6 | +import redsidematch from 'path/to/redsidematch.png'; |
| 7 | + |
| 8 | +const FieldAutoButton = () => { |
| 9 | + const [robotPosition] = useState<RobotPosition>(); |
| 10 | + const [ground1, setGround1] = useState(false); |
| 11 | + const [ground2, setGround2] = useState(false); |
| 12 | + const [ground3, setGround3] = useState(false); |
| 13 | + const [source1, setSource1] = useState(false); |
| 14 | + const [source2, setSource2] = useState(false); |
| 15 | + const [start1, setStart1] = useState(false); |
| 16 | + const [start2, setStart2] = useState(false); |
| 17 | + const [start3, setStart3] = useState(false); |
| 18 | + const [deposit1, setDeposit1] = useState(false); |
| 19 | + const [deposit2, setDeposit2] = useState(false); |
| 20 | + const [deposit3, setDeposit3] = useState(false); |
| 21 | + const [deposit4, setDeposit4] = useState(false); |
| 22 | + const [deposit5, setDeposit5] = useState(false); |
| 23 | + const [deposit6, setDeposit6] = useState(false); |
| 24 | + const blueAlliance = ( |
| 25 | + ['blue_1', 'blue_2', 'blue_3'] as (string | undefined)[] |
| 26 | + ).includes(robotPosition); |
| 27 | + |
| 28 | + return ( |
| 29 | + <> |
| 30 | + <img src={`${blueAlliance ? bluesidematch : redsidematch}`} width={500} height={600} className="justify-self-center my-7" /> |
| 31 | + <CheckBoxMatch |
| 32 | + checked={ground1} |
| 33 | + onChange={setGround1} |
| 34 | + className={`${blueAlliance ? 'top-[660px] left-[285px]' : 'top-[675px] left-[455px]'} absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`}> |
| 35 | + </CheckBoxMatch> |
| 36 | + <CheckBoxMatch |
| 37 | + checked={ground2} |
| 38 | + onChange={setGround2} |
| 39 | + className={`${blueAlliance ? 'top-[740px] left-[285px]' :'top-[760px] left-[455px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 40 | + <CheckBoxMatch |
| 41 | + checked={ground3} |
| 42 | + onChange={setGround3} |
| 43 | + className={`${blueAlliance ? 'top-[820px] left-[285px]' :'top-[840px] left-[455px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 44 | + <CheckBoxMatch |
| 45 | + checked={source1} |
| 46 | + onChange={setSource1} |
| 47 | + className={`${blueAlliance? 'top-[570px] left-[250px]' :'top-[585px] left-[485px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 48 | + <CheckBoxMatch |
| 49 | + checked={source2} |
| 50 | + onChange={setSource2} |
| 51 | + className={`${blueAlliance? 'top-[910px] left-[250px]' :'top-[930px] left-[485px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 52 | + <CheckBoxMatch |
| 53 | + checked={start1} |
| 54 | + onChange={setStart1} |
| 55 | + className={`${blueAlliance? 'top-[645px] left-[565px]' :'top-[660px] left-[160px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 56 | + <CheckBoxMatch |
| 57 | + checked={start2} |
| 58 | + onChange={setStart2} |
| 59 | + className={`${blueAlliance? 'top-[740px] left-[565px]' :'top-[760px] left-[160px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 60 | + <CheckBoxMatch |
| 61 | + checked={start3} |
| 62 | + onChange={setStart3} |
| 63 | + className={`${blueAlliance? 'top-[835px] left-[565px]' :'top-[858px] left-[160px]' } absolute z-20 h-10 w-10 overflow-hidden rounded-full text-left`} /> |
| 64 | + <CoralSectionButton |
| 65 | + onChange={setDeposit1} |
| 66 | + value={deposit1} |
| 67 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[27.45em] top-[44.3em]':'bg-green-300 absolute left-[20.15em] top-[45.3em]'} h-[1em] w-[4.5em] rotate-[6.83rad]`} |
| 68 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[27.45em] top-[44.3em]':'bg-red-300 absolute left-[20.15em] top-[45.3em]'} h-[1em] w-[4.5em] rotate-[6.83rad]`}> |
| 69 | + </CoralSectionButton> |
| 70 | + <CoralSectionButton |
| 71 | + onChange={setDeposit2} |
| 72 | + value={deposit2} |
| 73 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[29.4em] top-[47.1em]':'bg-green-300 absolute left-[22em] top-[48.4em]'} h-[1em] w-[4em] rotate-90`} |
| 74 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[29.4em] top-[47.1em]':'bg-red-300 absolute left-[22em] top-[48.4em]'} h-[1em] w-[4em] rotate-90`}> |
| 75 | + </CoralSectionButton> |
| 76 | + <CoralSectionButton |
| 77 | + onChange={setDeposit3} |
| 78 | + value={deposit3} |
| 79 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[27.6em] top-[49.9em]':'bg-green-300 absolute left-[20.2em] top-[51.1em]'} h-[1em] w-[4em] rotate-[2.6rad]`} |
| 80 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[27.6em] top-[49.9em]':'bg-red-300 absolute left-[20.2em] top-[51.1em]'} h-[1em] w-[4em] rotate-[2.6rad]`}> |
| 81 | + </CoralSectionButton> |
| 82 | + <CoralSectionButton |
| 83 | + onChange={setDeposit4} |
| 84 | + value={deposit4} |
| 85 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[24.35em] top-[49.9em]':'bg-green-300 absolute left-[16.95em] top-[51em]'} h-[1em] w-[4em] rotate-[6.83rad]`} |
| 86 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[24.35em] top-[49.9em]':'bg-red-300 absolute left-[16.95em] top-[51em]'} h-[1em] w-[4em] rotate-[6.83rad]`}> |
| 87 | + </CoralSectionButton> |
| 88 | + <CoralSectionButton |
| 89 | + onChange={setDeposit5} |
| 90 | + value={deposit5} |
| 91 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[22.85em] top-[47.3em]':'bg-green-300 absolute left-[15.4em] top-[48.05em]'} h-[1em] w-[4em] rotate-90`} |
| 92 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[22.85em] top-[47.3em]':'bg-red-300 absolute left-[15.4em] top-[48.05em]'} h-[1em] w-[4em] rotate-90`}> |
| 93 | + </CoralSectionButton> |
| 94 | + <CoralSectionButton |
| 95 | + onChange={setDeposit6} |
| 96 | + value={deposit6} |
| 97 | + selectClassName={`${blueAlliance? 'bg-green-300 absolute left-[24.3em] top-[44.4em]':'bg-green-300 absolute left-[17em] top-[45.3em]'} h-[1em] w-[4em] rotate-[2.6rad]`} |
| 98 | + unselectClassName={`${blueAlliance? 'bg-red-300 absolute left-[24.3em] top-[44.4em]':'bg-red-300 absolute left-[17em] top-[45.3em]'} h-[1em] w-[4em] rotate-[2.6rad]`}> |
| 99 | + </CoralSectionButton> |
| 100 | + </> |
| 101 | + ); |
| 102 | +}; |
| 103 | + |
| 104 | +export default FieldAutoButton; |
0 commit comments