From 7c45cce17117845d432cf4eea3d73456e50d368a Mon Sep 17 00:00:00 2001 From: Kostya Bats Date: Thu, 30 Nov 2023 14:42:32 +0300 Subject: [PATCH] small overlay ui fixes for ioi contests --- .../overlay/src/components/atoms/ContestLabels.jsx | 11 ++++++----- .../organisms/holder/ContestantViewHolder.jsx | 14 ++++++-------- .../components/organisms/widgets/Scoreboard.jsx | 7 +++---- src/frontend/overlay/src/services/displayUtils.js | 8 ++++---- src/frontend/overlay/src/utils/statusInfo.jsx | 2 +- 5 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/frontend/overlay/src/components/atoms/ContestLabels.jsx b/src/frontend/overlay/src/components/atoms/ContestLabels.jsx index c7ecd6321..e7514ce37 100644 --- a/src/frontend/overlay/src/components/atoms/ContestLabels.jsx +++ b/src/frontend/overlay/src/components/atoms/ContestLabels.jsx @@ -1,4 +1,4 @@ -import React, {memo} from "react"; +import React, { memo } from "react"; import styled from "styled-components"; import c from "../../config"; import { isShouldUseDarkColor } from "../../utils/colors"; @@ -10,7 +10,7 @@ import { getStatus, getTeamTaskColor, } from "../../utils/statusInfo"; -import {formatScore} from "../../services/displayUtils"; +import { formatScore } from "../../services/displayUtils"; const VerdictLabel = styled(ShrinkingBox)` background-color: ${({ color }) => color}; @@ -36,11 +36,11 @@ const getIOIScoreText = (difference) => { return ["=", c.VERDICT_UNKNOWN]; }; -const IOIVerdictLabel = ({ runResult: { wrongVerdict, difference }}) => { +const IOIVerdictLabel = ({ runResult: { wrongVerdict, difference }, ...props }) => { const [diffText, diffColor] = getIOIScoreText(difference); return <> - {wrongVerdict !== undefined && } - {wrongVerdict === undefined && } + {wrongVerdict !== undefined && } + {wrongVerdict === undefined && } ; }; @@ -48,6 +48,7 @@ const VerdictLabel2 = ({ runResult, ...props }) => { return <> {runResult.type === "ICPC" && } {runResult.type === "IOI" && } + {/*{runResult.type === "IOI" && }*/} ; }; diff --git a/src/frontend/overlay/src/components/organisms/holder/ContestantViewHolder.jsx b/src/frontend/overlay/src/components/organisms/holder/ContestantViewHolder.jsx index dd72d92e6..0742ab8d3 100644 --- a/src/frontend/overlay/src/components/organisms/holder/ContestantViewHolder.jsx +++ b/src/frontend/overlay/src/components/organisms/holder/ContestantViewHolder.jsx @@ -1,9 +1,9 @@ -import React, {useEffect, useLayoutEffect, useRef} from "react"; +import React, { useEffect, useLayoutEffect, useRef } from "react"; import { ContestantViewCorner } from "../../molecules/info/ContestantViewCorner"; import styled from "styled-components"; -import {useDispatch} from "react-redux"; -import {pushLog} from "../../../redux/debug"; -import {GrabberPlayerClient} from "../../../utils/grabber/grabber_player"; +import { useDispatch } from "react-redux"; +import { pushLog } from "../../../redux/debug"; +import { GrabberPlayerClient } from "../../../utils/grabber/grabber_player"; export const TeamImageWrapper = styled.img` border-radius: ${({ borderRadius }) => borderRadius}; @@ -132,7 +132,6 @@ const teamViewComponentRender = { TaskStatus: ({ onLoadStatus, hasPInP, ...props }) => { useLayoutEffect(() => onLoadStatus(true), []); - console.log(props.teamId); return ; }, Photo: ({ onLoadStatus, url, className }) => { @@ -180,8 +179,7 @@ export const AchievementWrapper = styled.div` height: 100%; `; -export const Achievement = ({src, onLoadStatus, className}) => { - console.log(src) +export const Achievement = ({ src, onLoadStatus, className }) => { return onLoadStatus(true)}/> ; @@ -195,7 +193,7 @@ export const ContestantViewHolder = ({ onLoadStatus, media, isSmall, hasPInP, cl return null; } if (!media.isMedia && media.type === "Photo") { - return + return ; } return ; }; diff --git a/src/frontend/overlay/src/components/organisms/widgets/Scoreboard.jsx b/src/frontend/overlay/src/components/organisms/widgets/Scoreboard.jsx index 3e61b6dd9..4406cf88d 100644 --- a/src/frontend/overlay/src/components/organisms/widgets/Scoreboard.jsx +++ b/src/frontend/overlay/src/components/organisms/widgets/Scoreboard.jsx @@ -5,7 +5,6 @@ import { useSelector } from "react-redux"; import styled from "styled-components"; import c from "../../../config"; import { ProblemLabel } from "../../atoms/ProblemLabel"; -// import { extractScoreboardRows, useScroller } from "./Scoreboard"; import { TaskResultLabel, RankLabel } from "../../atoms/ContestLabels"; import { ShrinkingBox } from "../../atoms/ShrinkingBox"; @@ -67,7 +66,7 @@ const ScoreboardTableRowWrap = styled.div` ${c.SCOREBOARD_CELL_PLACE_SIZE} ${c.SCOREBOARD_CELL_TEAMNAME_SIZE} ${c.SCOREBOARD_CELL_POINTS_SIZE} - ${c.SCOREBOARD_CELL_PENALTY_SIZE} + ${({ needPenalty }) => needPenalty ? c.SCOREBOARD_CELL_PENALTY_SIZE : ""} repeat(${props => props.nProblems}, 1fr); `; @@ -111,7 +110,7 @@ export const ScoreboardRow = ({ teamId, hideTasks, optimismLevel }) => { const teamData = useSelector((state) => state.contestInfo.info?.teamsId[teamId]); const needPenalty = useNeedPenalty(); const formatPenalty = useFormatPenalty(); - return + return { const problems = useSelector((state) => state.contestInfo.info?.problems); const needPenalty = useNeedPenalty(); - return + return # Name Σ diff --git a/src/frontend/overlay/src/services/displayUtils.js b/src/frontend/overlay/src/services/displayUtils.js index 604296f80..1976c4942 100644 --- a/src/frontend/overlay/src/services/displayUtils.js +++ b/src/frontend/overlay/src/services/displayUtils.js @@ -1,6 +1,6 @@ import c from "../config"; -import {useSelector} from "react-redux"; -import {useCallback} from "react"; +import { useSelector } from "react-redux"; +import { useCallback } from "react"; export const formatScore = (score, digits = 2) => { if (score === undefined) { @@ -23,7 +23,7 @@ export const useFormatPenalty = () => { return Math.floor(penalty / 60); } }, [mode]); -} +}; export const useNeedPenalty = () => { return usePenaltyRoundingMode() !== "zero"; -}; \ No newline at end of file +}; diff --git a/src/frontend/overlay/src/utils/statusInfo.jsx b/src/frontend/overlay/src/utils/statusInfo.jsx index 161837637..be8003ca0 100644 --- a/src/frontend/overlay/src/utils/statusInfo.jsx +++ b/src/frontend/overlay/src/utils/statusInfo.jsx @@ -40,7 +40,7 @@ export const TeamTaskColor = Object.freeze({ export const getTeamTaskColor = (score, minScore, maxScore) => { if (score === undefined) { - return c.CELL_BG_COLOR; + return undefined; } if (minScore !== undefined && maxScore !== undefined) { const [minRed, minGreen, minBlue] = [203, 46, 40];