From b37d6f213c2f3b19631e5067f39a7106859faaed Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 12 Aug 2024 05:54:37 +0900 Subject: feat: show left time in play page --- .../app/components/GolfPlayApps/GolfPlayAppGaming.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'frontend/app/components/GolfPlayApps') diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx index 667ada2..4730583 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx @@ -1,15 +1,17 @@ +import { faArrowDown } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Link } from "@remix-run/react"; import React, { useRef } from "react"; import SubmitButton from "../../components/SubmitButton"; import type { PlayerInfo } from "../../models/PlayerInfo"; import BorderedContainer from "../BorderedContainer"; -import SubmitStatusLabel from "../SubmitStatusLabel"; import ExecStatusIndicatorIcon from "../ExecStatusIndicatorIcon"; -import { faArrowDown } from "@fortawesome/free-solid-svg-icons"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import SubmitStatusLabel from "../SubmitStatusLabel"; type Props = { gameDisplayName: string; + gameDurationSeconds: number; + leftTimeSeconds: number; playerInfo: Omit; problemTitle: string; problemDescription: string; @@ -19,6 +21,8 @@ type Props = { export default function GolfPlayAppGaming({ gameDisplayName, + gameDurationSeconds, + leftTimeSeconds, playerInfo, problemTitle, problemDescription, @@ -37,12 +41,19 @@ export default function GolfPlayAppGaming({ } }; + const leftTime = (() => { + const k = gameDurationSeconds + leftTimeSeconds; + const m = Math.floor(k / 60); + const s = k % 60; + return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`; + })(); + return (
{gameDisplayName}
-
03:21
+
{leftTime}
-- cgit v1.2.3-70-g09d2