Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/scouting/frontend/src/scouter/pages/ScoutMatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -35,7 +34,10 @@ const TABS: Tab[] = [
name: "Pre",
Component: PreMatchTab,
},
{ name: "Auto", Component: AutoTab },
{
name: "Auto",
Component: (props) => <ShiftTab shiftType="auto" tabIndex={0} {...props} />,
},
{
name: "Climb",
Component: (props) => <ClimbTab isAuto={true} {...props} />,
Expand Down
73 changes: 0 additions & 73 deletions apps/scouting/frontend/src/scouter/pages/tabs/AutoTab.tsx

This file was deleted.

20 changes: 13 additions & 7 deletions apps/scouting/frontend/src/scouter/pages/tabs/ShiftTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ export const ShiftTab: FC<ShiftTabProps> = ({
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;
Comment on lines +29 to +35

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to an object. { auto: ...., teleop: ...., transition: ... and then use the correct key. prevEvents = events[shiftType]

prevEvents.push({
interval: cycle,
startPosition: mapPosition ?? { ...defaultPoint },
Expand All @@ -39,6 +41,7 @@ export const ShiftTab: FC<ShiftTabProps> = ({
});
};

const gamePhase = shiftType === "auto" ? "auto" : "tele";
const scoreMap = (
<div className="flex-1 min-w-0 h-full">
<ScoreMap
Expand Down Expand Up @@ -66,10 +69,13 @@ export const ShiftTab: FC<ShiftTabProps> = ({
setMovement={(value) => {
setForm((prevForm) => ({
...prevForm,
tele: { ...prevForm.tele, movement: value },
[gamePhase]: {
...prevForm[gamePhase],
movement: value,
},
}));
}}
currentMovement={currentForm.tele.movement}
currentMovement={currentForm[gamePhase].movement}
/>

<button
Expand Down
Loading