aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-22 13:27:44 +0900
committernsfisis <nsfisis@gmail.com>2024-08-22 13:27:44 +0900
commitdfd33e58a5e6f830d60e978afad7348f7a16068d (patch)
tree8e5a857769db577b034a9a0404e70cf6c2d2693a /frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx
parent7fda765d654a63945296d813c177aeb9e423f120 (diff)
downloadiosdc-japan-2024-albatross-dfd33e58a5e6f830d60e978afad7348f7a16068d.tar.gz
iosdc-japan-2024-albatross-dfd33e58a5e6f830d60e978afad7348f7a16068d.tar.zst
iosdc-japan-2024-albatross-dfd33e58a5e6f830d60e978afad7348f7a16068d.zip
feat(frontend): add minimal style to watch with audio play request
Diffstat (limited to 'frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx')
-rw-r--r--frontend/app/components/GolfWatchAppWithAudioPlayRequest.client.tsx38
1 files changed, 18 insertions, 20 deletions
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>
);
}