From 6368c9ef7cb6a86e6bcfc0d97d6ee21f573a2003 Mon Sep 17 00:00:00 2001 From: YoniKiriaty Date: Wed, 18 Feb 2026 20:05:34 +0200 Subject: [PATCH 1/2] Yoni - combined auto and shift tab --- .../frontend/src/scouter/pages/ScoutMatch.tsx | 6 +- .../src/scouter/pages/tabs/AutoTab.tsx | 68 ------------------- .../src/scouter/pages/tabs/ShiftTab.tsx | 21 ++++-- 3 files changed, 18 insertions(+), 77 deletions(-) delete mode 100644 apps/scouting/frontend/src/scouter/pages/tabs/AutoTab.tsx diff --git a/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx b/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx index 29a2202..ee08743 100644 --- a/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx +++ b/apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx @@ -17,7 +17,6 @@ import { ShiftTab } from "./tabs/ShiftTab"; import { useLocalStorage } from "@repo/local_storage_hook"; 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 { @@ -35,7 +34,10 @@ const TABS: Tab[] = [ name: "Pre", Component: PreMatchTab, }, - { name: "Auto", Component: AutoTab }, + { + name: "Auto", + Component: (props) => , + }, { name: "Climb", Component: (props) => , diff --git a/apps/scouting/frontend/src/scouter/pages/tabs/AutoTab.tsx b/apps/scouting/frontend/src/scouter/pages/tabs/AutoTab.tsx deleted file mode 100644 index ab16059..0000000 --- a/apps/scouting/frontend/src/scouter/pages/tabs/AutoTab.tsx +++ /dev/null @@ -1,68 +0,0 @@ -// בס"ד -import { useState, type FC } from "react"; -import { ScoreMap } from "../../components/ScoreMap"; -import type { Alliance, Point } from "@repo/scouting_types"; -import Stopwatch from "../../components/stopwatch"; -import { MovementForm } from "../../components/MovementForm"; -import type { TabProps } from "../ScoutMatch"; -import { defaultPoint } from "../../components/ScoreMap"; - -export const AutoTab: FC = ({ - setForm, - alliance, - originTime, - currentForm, -}) => { - const [mapPosition, setMapPosition] = useState(); - const [mapZone, setMapZone] = useState(alliance); - - return ( -
-
- -
-
- { - setForm((prevForm) => { - const prevEvents = prevForm.auto.shootEvents; - prevEvents.push({ - interval: cycle, - startPosition: mapPosition ?? { ...defaultPoint }, - }); - return prevForm; - }); - }} - originTime={originTime} - disabled={mapPosition === undefined} - size="compact" - /> - { - setForm((prevForm) => ({ - ...prevForm, - auto: { - ...prevForm.auto, - movement: { ...prevForm.auto.movement, ...value }, - }, - })); - }} - currentMovement={currentForm.auto.movement} - /> - -
-
- ); -}; diff --git a/apps/scouting/frontend/src/scouter/pages/tabs/ShiftTab.tsx b/apps/scouting/frontend/src/scouter/pages/tabs/ShiftTab.tsx index db58c79..b1acbea 100644 --- a/apps/scouting/frontend/src/scouter/pages/tabs/ShiftTab.tsx +++ b/apps/scouting/frontend/src/scouter/pages/tabs/ShiftTab.tsx @@ -26,11 +26,13 @@ export const ShiftTab: FC = ({ const handleSetForm = (cycle: { start: number; end: number }) => { setForm((prevForm) => { const prevEvents = - shiftType === "teleop" - ? prevForm.tele.shifts[tabIndex].shootEvents - : shiftType === "transition" - ? prevForm.tele.transitionShift.shootEvents - : prevForm.tele.endgameShift.shootEvents; + shiftType === "auto" + ? prevForm.auto.shootEvents + : shiftType === "teleop" + ? prevForm.tele.shifts[tabIndex].shootEvents + : shiftType === "transition" + ? prevForm.tele.transitionShift.shootEvents + : prevForm.tele.endgameShift.shootEvents; prevEvents.push({ interval: cycle, startPosition: mapPosition ?? { ...defaultPoint }, @@ -39,6 +41,8 @@ export const ShiftTab: FC = ({ }); }; + const gamePhase = shiftType === "auto" ? "auto" : "tele"; + return (
@@ -62,10 +66,13 @@ export const ShiftTab: FC = ({ setMovement={(value) => { setForm((prevForm) => ({ ...prevForm, - tele: { ...prevForm.tele, movement: value }, + [gamePhase]: { + ...prevForm[gamePhase], + movement: value, + }, })); }} - currentMovement={currentForm.tele.movement} + currentMovement={currentForm[gamePhase].movement} />