diff --git a/apps/scouting/frontend/src/PreMatchTab.tsx b/apps/scouting/frontend/src/PreMatchTab.tsx new file mode 100644 index 0000000..474b677 --- /dev/null +++ b/apps/scouting/frontend/src/PreMatchTab.tsx @@ -0,0 +1,93 @@ +//בס"ד +import React, { type FC, type Dispatch, type SetStateAction } from "react"; +import type { TabProps } from "./scouter/pages/ScoutMatch"; +const MATCH_NUMBER_MAX = 127; +const TEAM_NUMBER_MAX = 16383; +const PreMatchTab: FC = ({ currentForm: form, setForm }) => { + return ( +
+
+
+
Scouter Name:
+ + {setForm((prev) => ({ + ...prev, + scouterName: event.target.value, + }))} + } + /> +
+
+
+
+
Match Number:
+ + {setForm((prev) => ({ + ...prev, + match: { + ...prev.match, + number: Number(event.target.value), + }, + }))} + } + /> +
+
+
+
+
Team Number:
+ + {setForm((prev) => ({ + ...prev, + teamNumber: Number(event.target.value), + })) + }} + /> +
+
+
+
+
Match Type:
+ +
+
+
+ ); +}; + +export { PreMatchTab }; diff --git a/apps/scouting/frontend/src/index.css b/apps/scouting/frontend/src/index.css index 7ea372b..806eb2f 100644 --- a/apps/scouting/frontend/src/index.css +++ b/apps/scouting/frontend/src/index.css @@ -112,7 +112,7 @@ button:focus-visible { portrait:rotate-90 portrait:origin-top-left; } .highlighted-tab { - @apply bg-linear-to-r from-emerald-500 to-emerald-600 + @apply bg-linear-to-r from-green-500 to-green-600 text-black shadow-[0_0_20px_rgba(34,197,94,0.6)]; } .unhighlighted-tab { diff --git a/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx b/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx index aeb9bc6..adfbc52 100644 --- a/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx +++ b/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx @@ -19,13 +19,13 @@ import { PostMatchTab } from "./tabs/PostMatchTab"; import { useNavigate } from "react-router-dom"; import { AutoTab } from "./tabs/AutoTab"; import { ClimbTab } from "./tabs/ClimbTab"; +import { PreMatchTab } from "../../PreMatchTab"; export interface TabProps { setForm: Dispatch>; currentForm: ScoutingForm; alliance: Alliance; originTime: number; } - interface Tab { name: string; Component: FC; @@ -33,7 +33,7 @@ interface Tab { const TABS: Tab[] = [ { name: "Pre", - Component: () =>
Pre Match
, + Component: PreMatchTab, }, { name: "Auto", Component: AutoTab }, { @@ -81,27 +81,22 @@ const TABS: Tab[] = [ Component: PostMatchTab, }, ]; - interface SideBarProps { setActiveTab: Dispatch>; activeTabIndex: number; } - const ONE_ARRAY_ELEMENT = 1; const MOVEMENT_AMOUNT = 1; const STARTING_TAB_INDEX = 0; - const SideBar: FC = ({ setActiveTab, activeTabIndex }) => { const activeTabRef = useRef(null); const navigate = useNavigate(); - const goToPrev = () => { setActiveTab((prev) => prev - MOVEMENT_AMOUNT); }; const goToNext = () => { setActiveTab((prev) => prev + MOVEMENT_AMOUNT); }; - useEffect(() => { if (activeTabRef.current) { activeTabRef.current.scrollIntoView({ @@ -110,7 +105,6 @@ const SideBar: FC = ({ setActiveTab, activeTabIndex }) => { }); } }, [activeTabIndex]); - return (
@@ -122,7 +116,6 @@ const SideBar: FC = ({ setActiveTab, activeTabIndex }) => { > Back -
); }; - export const createNewScoutingForm = (): ScoutingForm => JSON.parse(JSON.stringify(defaultScoutForm)); - export const ScoutMatch: FC = () => { const [scoutingForm, setScoutingForm] = useLocalStorage( "form", createNewScoutingForm(), ); const [activeTabIndex, setActiveTab] = useState(STARTING_TAB_INDEX); - const originTime = useMemo(() => Date.now(), []); const CurrentTab = useMemo( () => TABS[activeTabIndex].Component, [activeTabIndex], ); - return (
-
- +
diff --git a/apps/template/frontend/src/App.tsx b/apps/template/frontend/src/App.tsx index ca41c37..0cc1c2a 100644 --- a/apps/template/frontend/src/App.tsx +++ b/apps/template/frontend/src/App.tsx @@ -33,4 +33,4 @@ const App: FC = () => { ); }; -export default App; +export default App; \ No newline at end of file diff --git a/package.json b/package.json index d47b46b..8034f63 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "dependencies": { "@radix-ui/react-slider": "^1.3.6", "@tailwindcss/vite": "^4.1.17", + "@zxing/browser": "^0.1.5", "axios": "^1.13.2", "dotenv": "^17.2.3", "dotenv-cli": "^11.0.0", @@ -48,6 +49,7 @@ "eslint-plugin-react": "^7.37.5", "express": "^5.1.0", "fp-ts": "^2.16.11", + "html5-qrcode": "^2.3.8", "http-status-codes": "^2.3.0", "io-ts": "^2.2.22", "is-odd": "^3.0.1",