From dfd33e58a5e6f830d60e978afad7348f7a16068d Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Thu, 22 Aug 2024 13:27:44 +0900
Subject: feat(frontend): add minimal style to watch with audio play request

---
 .../GolfWatchAppWithAudioPlayRequest.client.tsx    | 38 ++++++++++------------
 1 file changed, 18 insertions(+), 20 deletions(-)

(limited to 'frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx')

diff --git a/frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx b/frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx
index e299f4b..ce5a59c 100644
--- a/frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx
+++ b/frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx
@@ -1,35 +1,33 @@
-import { useState } from "react";
+import { useAtom } from "jotai";
 import { AudioController } from "../.client/audio/AudioController";
+import { audioControllerAtom } from "../states/watch";
 import GolfWatchApp, { type Props } from "./GolfWatchApp.client";
+import SubmitButton from "./SubmitButton";
 
 export default function GolfWatchAppWithAudioPlayRequest({
 	game,
 	sockToken,
 }: Omit<Props, "audioController">) {
-	const [audioController, setAudioController] =
-		useState<AudioController | null>(null);
+	const [audioController, setAudioController] = useAtom(audioControllerAtom);
 	const audioPlayPermitted = audioController !== null;
 
 	if (audioPlayPermitted) {
-		return (
-			<GolfWatchApp
-				game={game}
-				sockToken={sockToken}
-				audioController={audioController}
-			/>
-		);
+		return <GolfWatchApp game={game} sockToken={sockToken} />;
 	} else {
 		return (
-			<div>
-				<button
-					onClick={async () => {
-						const audioController = new AudioController();
-						await audioController.loadAll();
-						setAudioController(audioController);
-					}}
-				>
-					Enable Audio Play
-				</button>
+			<div className="min-h-screen bg-gray-100 flex items-center justify-center">
+				<div className="text-center">
+					<SubmitButton
+						onClick={async () => {
+							const audioController = new AudioController();
+							await audioController.loadAll();
+							await audioController.playDummySoundEffect();
+							setAudioController(audioController);
+						}}
+					>
+						開始
+					</SubmitButton>
+				</div>
 			</div>
 		);
 	}
-- 
cgit v1.2.3-70-g09d2

