diff --git a/fission/src/ui/modals/MatchResultsModal.tsx b/fission/src/ui/modals/MatchResultsModal.tsx index db5b34535c..002b5b400d 100644 --- a/fission/src/ui/modals/MatchResultsModal.tsx +++ b/fission/src/ui/modals/MatchResultsModal.tsx @@ -1,9 +1,7 @@ -import { Stack, styled, Typography } from "@mui/material" import type React from "react" import { useEffect } from "react" import MatchMode from "@/systems/match_mode/MatchMode" import SimulationSystem from "@/systems/simulation/SimulationSystem" -import Label from "../components/Label" import type { ModalImplProps } from "../components/Modal" import { Button } from "../components/StyledComponents" import { CloseType, useUIContext } from "../helpers/UIProviderHelpers" @@ -23,95 +21,125 @@ const getMatchWinner = (): { message: string; color: string } => { } } -const getPerRobotScores = (): { redRobotScores: Entry[]; blueRobotScores: Entry[] } => { +const getPerRobotScores = (): { + redRobotScores: Entry[] + blueRobotScores: Entry[] +} => { const redRobotScores: Entry[] = [] const blueRobotScores: Entry[] = [] SimulationSystem.perRobotScore.forEach((score, robot) => { if (robot.alliance === "red") { - redRobotScores.push({ name: `${robot.nameTag?.text()} (${robot.assemblyName})`, value: score }) + redRobotScores.push({ + name: `${robot.nameTag?.text()} (${robot.assemblyName})`, + value: score, + }) } else { - blueRobotScores.push({ name: `${robot.nameTag?.text()} (${robot.assemblyName})`, value: score }) + blueRobotScores.push({ + name: `${robot.nameTag?.text()} (${robot.assemblyName})`, + value: score, + }) } }) return { redRobotScores, blueRobotScores } } -const LabelStyled = styled(Typography)<{ winnerColor: string; fontSize: string }>(({ winnerColor, fontSize }) => ({ - fontWeight: 700, - fontSize: fontSize, - margin: "0pt", - marginTop: "0.5rem", - color: winnerColor, -})) - const MatchResultsModal: React.FC> = ({ modal }) => { const { configureScreen, closeModal } = useUIContext() - const { message, color } = getMatchWinner() - - const entries: Entry[] = [ - { name: "Red Score", value: SimulationSystem.redScore }, - { name: "Blue Score", value: SimulationSystem.blueScore }, - ] + const { message } = getMatchWinner() const { redRobotScores, blueRobotScores } = getPerRobotScores() useEffect(() => { - configureScreen( - modal!, - { title: "Match Results", hideCancel: true, hideAccept: true, allowClickAway: false }, - {} - ) + configureScreen(modal!, { hideCancel: true, hideAccept: true, allowClickAway: false }, {}) }, []) + // TODO + // const breakdown: Array<{ label: string; red: number; blue: number }> = [ + // { label: "LEAVE", red: 0, blue: 0 }, + // { label: "CORAL", red: 0, blue: 0 }, + // { label: "ALGAE", red: 0, blue: 0 }, + // { label: "BARGE", red: 0, blue: 0 }, + // { label: "PENALTY", red: 0, blue: 0 }, + // ] + return ( - <> - - {message} - - - {entries.map(e => ( - - - - - ))} - - - Robot Score Contributions - - - Red Alliance - -
- {redRobotScores.map(e => ( - - - - - ))} +
+
+ Match Results
- - Blue Alliance - -
- {blueRobotScores.map(e => ( - - - - - ))} +
+
+
Red Alliance
+
+ {redRobotScores.length === 0 &&
No robots
} + {redRobotScores.map(e => ( +
+ {e.name} + {e.value} +
+ ))} +
+
+ +
+
+
+ {message.toUpperCase()} +
+
+ +
+
+ + {SimulationSystem.redScore} + +
+
+ {/* Breakdown coming soon */} +
+ Breakdown coming soon +
+
+
+ + {SimulationSystem.blueScore} + +
+
+ +
+ +
+
+ +
+
Blue Alliance
+
+ {blueRobotScores.length === 0 &&
No robots
} + {blueRobotScores.map(e => ( +
+ {e.name} + {e.value} +
+ ))} +
+
- - +
) }