From 7a4171d021a709e0af1e0e13830514c67ec97702 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sat, 3 Aug 2024 22:18:31 +0900
Subject: feat: partially implement submit action

---
 frontend/app/components/GolfPlayApp.client.tsx | 9 +++++++++
 1 file changed, 9 insertions(+)

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

diff --git a/frontend/app/components/GolfPlayApp.client.tsx b/frontend/app/components/GolfPlayApp.client.tsx
index ace0710..80e7182 100644
--- a/frontend/app/components/GolfPlayApp.client.tsx
+++ b/frontend/app/components/GolfPlayApp.client.tsx
@@ -81,6 +81,14 @@ export default function GolfPlayApp({
 		});
 	}, 1000);
 
+	const onCodeSubmit = useDebouncedCallback((code: string) => {
+		console.log("player:c2s:submit");
+		sendJsonMessage({
+			type: "player:c2s:submit",
+			data: { code },
+		});
+	}, 1000);
+
 	if (readyState === ReadyState.UNINSTANTIATED) {
 		throw new Error("WebSocket is not connected");
 	}
@@ -140,6 +148,7 @@ export default function GolfPlayApp({
 			<GolfPlayAppGaming
 				problem={problem!.description}
 				onCodeChange={onCodeChange}
+				onCodeSubmit={onCodeSubmit}
 				currentScore={currentScore}
 			/>
 		);
-- 
cgit v1.3.1

