From ad42f43d1c3c8f0da0ac31b8016e2f20f1765720 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 18 Aug 2024 00:38:07 +0900 Subject: refactor(frontend): extract components for gaming page --- .../GolfWatchApps/GolfWatchAppGaming.tsx | 120 +++------------------ 1 file changed, 15 insertions(+), 105 deletions(-) (limited to 'frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx') diff --git a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx index 63c232b..d17c2dc 100644 --- a/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx +++ b/frontend/app/components/GolfWatchApps/GolfWatchAppGaming.tsx @@ -1,9 +1,7 @@ -import { faArrowDown } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { PlayerInfo } from "../../models/PlayerInfo"; -import BorderedContainer from "../BorderedContainer"; -import ExecStatusIndicatorIcon from "../ExecStatusIndicatorIcon"; -import SubmitStatusLabel from "../SubmitStatusLabel"; +import CodeBlock from "../Gaming/CodeBlock"; +import ScoreBar from "../Gaming/ScoreBar"; +import SubmitResult from "../Gaming/SubmitResult"; type Props = { gameDisplayName: string; @@ -29,20 +27,6 @@ export default function GolfWatchAppGaming({ return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`; })(); - const scoreRatio = (() => { - const scoreA = playerInfoA.score; - const scoreB = playerInfoB.score; - if (scoreA === null && scoreB === null) { - return 50; - } else if (scoreA === null) { - return 0; - } else if (scoreB === null) { - return 100; - } else { - return (scoreB / (scoreA + scoreB)) * 100; - } - })(); - return (
@@ -91,98 +75,24 @@ export default function GolfWatchAppGaming({
-
-
-
+
-
-						{playerInfoA.code}
-					
+
-
-
-
- -
-
-
    - {playerInfoA.submitResult.execResults.map((r, idx) => ( -
  • -
    -
    - -
    - {idx !== playerInfoA.submitResult.execResults.length - 1 && ( -
    - -
    - )} -
    -
    - -
    {r.label}
    -
    - - {r.stdout} - {r.stderr} - -
    -
    -
    -
  • - ))} -
+
+
-
-
-
- -
-
-
    - {playerInfoB.submitResult.execResults.map((r, idx) => ( -
  • -
    -
    - -
    - {idx !== playerInfoB.submitResult.execResults.length - 1 && ( -
    - -
    - )} -
    -
    - -
    {r.label}
    -
    - - {r.stdout} - {r.stderr} - -
    -
    -
    -
  • - ))} -
+
+
-
-						{playerInfoB.code}
-					
+
-- cgit v1.2.3-70-g09d2