diff --git a/frontend/src/pages/ttt/socket.ts b/frontend/src/pages/ttt/socket.ts
index a354195..a1fcbad 100644
--- a/frontend/src/pages/ttt/socket.ts
+++ b/frontend/src/pages/ttt/socket.ts
@@ -28,8 +28,8 @@ export interface ClientToServer {
gameMove: (up: GameMove) => void;
keepalive: () => void;
connectedToGame: (gameId: string) => void;
- // TODO
- requestNewGame: () => void;
+ // TODO:
+ joinQueueButton: () => void;
};
export interface ServerToClient {
diff --git a/frontend/src/pages/ttt/ttt.html b/frontend/src/pages/ttt/ttt.html
index 933bcf1..93d0484 100644
--- a/frontend/src/pages/ttt/ttt.html
+++ b/frontend/src/pages/ttt/ttt.html
@@ -1,6 +1,6 @@
-
+
Tic-tac-toe Box
diff --git a/frontend/src/pages/ttt/ttt.ts b/frontend/src/pages/ttt/ttt.ts
index 8abf1b4..f4546a0 100644
--- a/frontend/src/pages/ttt/ttt.ts
+++ b/frontend/src/pages/ttt/ttt.ts
@@ -45,20 +45,20 @@ async function handleTTT(): Promise {
if (user === null)
return;
- const newGameBtn = document.querySelector("#NewGameBtn");
+ const joinQueueBtn = document.querySelector("#JoinQueueBtn");
- if (!newGameBtn) {
+ if (!joinQueueBtn) {
return showError('fatal error');
}
- // TODO
+ // TODO: Join queue button
// When clicking on this button, two scenarios:
// not in a game -> Join queue
// In a game -> user clicking on the button loses the game and joins the queue, board is cleaned
// Should I differentiate the scenarios here or inside the requestNewGame function ?
- newGameBtn.addEventListener("click", () => {
- console.log('===== NEW GAME REQUESTED =====');
- socket.emit("requestNewGame");
+ joinQueueBtn.addEventListener("click", () => {
+ console.log('===== JOIN QUEUE BUTTON PRESSED =====');
+ socket.emit("joinQueueButton");
});
let curGame: CurrentGameInfo | null = null;
diff --git a/src/tic-tac-toe/src/socket.ts b/src/tic-tac-toe/src/socket.ts
index 7b290f7..9ca00ef 100644
--- a/src/tic-tac-toe/src/socket.ts
+++ b/src/tic-tac-toe/src/socket.ts
@@ -28,7 +28,8 @@ export interface ClientToServer {
gameMove: (up: GameMove) => void;
keepalive: () => void;
connectedToGame: (gameId: string) => void;
- requestNewGame: () => void;
+ // TODO:
+ joinQueueButton: () => void;
};
export interface ServerToClient {
diff --git a/src/tic-tac-toe/src/state.ts b/src/tic-tac-toe/src/state.ts
index 2e083ed..e7d03b1 100644
--- a/src/tic-tac-toe/src/state.ts
+++ b/src/tic-tac-toe/src/state.ts
@@ -48,8 +48,8 @@ export class StateI {
socket.on('enqueue', () => this.enqueueUser(socket));
socket.on('dequeue', () => this.dequeueUser(socket));
socket.on('debugInfo', () => this.debugSocket(socket));
- // TODO
- socket.on('requestNewGame', () => this.requestNewGame(socket));
+ // TODO:
+ socket.on('joinQueueButton', () => this.joinQueueButton(socket));
socket.on('gameMove', (e) => this.gameMove(socket, e));
socket.on('keepalive', () => this.keepAlive(socket));
@@ -205,11 +205,11 @@ export class StateI {
game?.makeMove(socket.authUser.id, update.index);
}
- // TODO
- private requestNewGame(socket: SSocket) {
+ // TODO:
+ private joinQueueButton(socket: SSocket) {
void socket;
- // TODO
- this.fastify.log.info('===== NEW GAME REQUESTED =====');
+ // TODO:
+ this.fastify.log.info('===== JOIN QUEUE BUTTON PRESSED =====');
}
}