import { PlayerInfo } from "../../models/PlayerInfo"; import { submitResultStatusToLabel } from "../../models/SubmitResult"; import ExecStatusIndicatorIcon from "../ExecStatusIndicatorIcon"; type Props = { problem: string; playerInfoA: PlayerInfo; playerInfoB: PlayerInfo; leftTimeSeconds: number; }; export default function GolfWatchAppGaming({ problem, playerInfoA, playerInfoB, leftTimeSeconds, }: Props) { const leftTime = (() => { const m = Math.floor(leftTimeSeconds / 60); const s = leftTimeSeconds % 60; return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`; })(); const scoreRatio = (() => { const scoreA = playerInfoA.score ?? 0; const scoreB = playerInfoB.score ?? 0; const totalScore = scoreA + scoreB; return totalScore === 0 ? 50 : (scoreB / totalScore) * 100; })(); return (
{playerInfoA.displayName}
{leftTime}
{playerInfoB.displayName}
{playerInfoA.score}
{playerInfoB.score}
						{playerInfoA.code}
					
{submitResultStatusToLabel( playerInfoA.submitResult?.status ?? null, )}
    {playerInfoA.submitResult?.execResults.map((result) => (
  1. {" "} {result.label}
    {result.stdout} {result.stderr}
  2. ))}
						{playerInfoB.code}
					
{submitResultStatusToLabel( playerInfoB.submitResult?.status ?? null, )}
    {playerInfoB.submitResult?.execResults.map((result, idx) => (
  1. {" "} {result.label}
    {result.stdout} {result.stderr}
  2. ))}
{problem}
); }