diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-12 05:54:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-12 05:54:37 +0900 |
| commit | b37d6f213c2f3b19631e5067f39a7106859faaed (patch) | |
| tree | 3c45267ee25aa78be1ad4c31e0c09894e656b506 /frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx | |
| parent | 545d86085f927bded852dd5a8ee8341f60f24d84 (diff) | |
| download | phperkaigi-2025-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.tar.gz phperkaigi-2025-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.tar.zst phperkaigi-2025-albatross-b37d6f213c2f3b19631e5067f39a7106859faaed.zip | |
feat: show left time in play page
Diffstat (limited to 'frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx')
| -rw-r--r-- | frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx | 19 |
1 files changed, 15 insertions, 4 deletions
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<PlayerInfo, "code">; 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 ( <div className="min-h-screen bg-gray-100 flex flex-col"> <div className="text-white bg-iosdc-japan flex flex-row justify-between px-4 py-2"> <div className="font-bold"> <div className="text-gray-100">{gameDisplayName}</div> - <div className="text-2xl">03:21</div> + <div className="text-2xl">{leftTime}</div> </div> <div className="font-bold text-end"> <Link to={"/dashboard"} className="text-gray-100"> |
