diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/app/components/GolfPlayApp.tsx | 16 | ||||
| -rw-r--r-- | frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx | 4 |
2 files changed, 19 insertions, 1 deletions
diff --git a/frontend/app/components/GolfPlayApp.tsx b/frontend/app/components/GolfPlayApp.tsx index 6c77f8c..1c1e7ae 100644 --- a/frontend/app/components/GolfPlayApp.tsx +++ b/frontend/app/components/GolfPlayApp.tsx @@ -121,6 +121,22 @@ export default function GolfPlayApp({ game, player, initialGameState }: Props) { if (gameStateKind === "loading") { return <GolfPlayAppLoading />; } else if (gameStateKind === "waiting") { + if (player.is_admin) { + return ( + <GolfPlayAppGaming + gameDisplayName={game.display_name} + playerProfile={playerProfile} + problemTitle={game.problem.title} + problemDescription={game.problem.description} + problemLanguage={game.problem.language} + sampleCode={game.problem.sample_code} + initialCode={initialGameState.code} + onCodeChange={onCodeChange} + onCodeSubmit={onCodeSubmit} + isFinished={false} + /> + ); + } return ( <GolfPlayAppWaiting gameDisplayName={game.display_name} diff --git a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx index 7d81c82..fa9a2b4 100644 --- a/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx +++ b/frontend/app/components/GolfPlayApps/GolfPlayAppGaming.tsx @@ -43,7 +43,7 @@ export default function GolfPlayAppGaming({ onCodeSubmit, isFinished, }: Props) { - const leftTimeSeconds = useAtomValue(gamingLeftTimeSecondsAtom)!; + const leftTimeSeconds = useAtomValue(gamingLeftTimeSecondsAtom); const score = useAtomValue(scoreAtom); const status = useAtomValue(statusAtom); @@ -72,6 +72,8 @@ export default function GolfPlayAppGaming({ <div className="text-gray-100">{gameDisplayName}</div> {isFinished ? ( <div className="text-2xl md:text-3xl">終了</div> + ) : leftTimeSeconds === null ? ( + <div className="text-2xl md:text-3xl">未開始</div> ) : ( <LeftTime sec={leftTimeSeconds} /> )} |
