Date: Thu, 5 Dec 2024 00:28:26 +0900
Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=EA=B2=8C=EC=9E=84=20=EC=8B=9C?=
=?UTF-8?q?=EC=9E=91=20=EB=B2=84=ED=8A=BC=20=EC=97=AC=EB=9F=AC=EB=B2=88=20?=
=?UTF-8?q?=EB=88=8C=EB=9F=AC=EB=8F=84=20=ED=95=9C=EB=B2=88=EB=A7=8C=20?=
=?UTF-8?q?=EA=B2=8C=EC=9E=84=20=EC=8B=9C=EC=9E=91=20=EC=9A=94=EC=B2=AD=20?=
=?UTF-8?q?=EA=B0=80=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FE/src/features/game/components/GameHeader.tsx | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/FE/src/features/game/components/GameHeader.tsx b/FE/src/features/game/components/GameHeader.tsx
index f21261d..ab0aa07 100644
--- a/FE/src/features/game/components/GameHeader.tsx
+++ b/FE/src/features/game/components/GameHeader.tsx
@@ -3,7 +3,7 @@ import { useNavigate, useParams } from 'react-router-dom';
import { useRoomStore } from '@/features/game/data/store/useRoomStore';
import React, { useState } from 'react';
import { QuizSettingModal } from './QuizSettingModal';
-import { socketService } from '@/api/socket';
+import { socketService, useSocketEvent, useSocketException } from '@/api/socket';
import { usePlayerStore } from '@/features/game/data/store/usePlayerStore';
import { useQuizStore } from '@/features/game/data/store/useQuizStore';
import CustomButton from '@/components/CustomButton';
@@ -17,14 +17,20 @@ export const GameHeader = React.memo(
const gameTitle = useRoomStore((state) => state.title);
const [isQuizModalOpen, setIsQuizModalOpen] = useState(false);
const { quizSetTitle, quizSetCategory } = useQuizStore();
+ const [gameLoading, setGameLoading] = useState(false);
const pinNum = String(gameId);
const linkURL = window.location.hostname + `/game/${gameId}`;
const gameMode = useRoomStore((state) => state.gameMode);
+ const navigate = useNavigate();
const handleStartGame = () => {
+ if (gameLoading) return;
+ setGameLoading(true);
if (gameId) socketService.emit('startGame', { gameId });
};
- const navigate = useNavigate();
+
+ useSocketEvent('startGame', () => setGameLoading(false));
+ useSocketException('startGame', () => setGameLoading(false));
return (
From fa5bb2f9e10a00911025b8b056ad039a1448b5e2 Mon Sep 17 00:00:00 2001
From: ijun17
Date: Thu, 5 Dec 2024 17:18:06 +0900
Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=EC=86=8C=EC=BC=93=20=EB=A1=9C?=
=?UTF-8?q?=EA=B7=B8=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FE/src/api/socket/mocks/SocketMock.ts | 1 -
FE/src/api/socket/socket.ts | 10 +++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/FE/src/api/socket/mocks/SocketMock.ts b/FE/src/api/socket/mocks/SocketMock.ts
index 3f2a80c..e553d57 100644
--- a/FE/src/api/socket/mocks/SocketMock.ts
+++ b/FE/src/api/socket/mocks/SocketMock.ts
@@ -48,7 +48,6 @@ export class SocketMock {
this.onAnyListenerList.push(listener);
}
emit(event: T, data: SocketDataMap[T]['request']) {
- console.log(`%c SERVER_SOCKET[${event}]`, 'background:blue; color:white', data);
switch (event) {
case SocketEvents.CHAT_MESSAGE:
return this.handleChat(data as SocketDataMap[typeof SocketEvents.CHAT_MESSAGE]['request']);
diff --git a/FE/src/api/socket/socket.ts b/FE/src/api/socket/socket.ts
index 9911527..69773ac 100644
--- a/FE/src/api/socket/socket.ts
+++ b/FE/src/api/socket/socket.ts
@@ -34,6 +34,7 @@ class SocketService {
private handlerMap: Partial<
Record void)[]>
> = {};
+ private log = true;
constructor(url: string) {
this.socket = null;
@@ -65,7 +66,13 @@ class SocketService {
handlers.forEach((h) => socket.on(event, h))
);
this.socket.onAny((eventName, ...args) => {
- console.log(`SOCKET[${eventName}]`, ...args);
+ if (this.log) {
+ if (eventName === 'exception')
+ console.log(`%cSOCKET[${eventName}]`, 'color:red', Date.now(), ...args);
+ else if (eventName !== 'updatePosition' && eventName !== 'chatMessage')
+ console.log(`%cSOCKET[${eventName}]`, 'color:green', Date.now(), ...args);
+ else console.log(`SOCKET[${eventName}]`, ...args);
+ }
});
}
@@ -92,6 +99,7 @@ class SocketService {
emit(event: T, data: SocketDataMap[T]['request']) {
if (!this.socket) return;
this.socket.emit(event, data);
+ if (this.log) console.log(`%cSOCKET[${event}]`, 'background-color:blue', Date.now(), data);
}
async createRoom(option: {
From f72d99cf70749ebf7b9455b182d1372e37dda909 Mon Sep 17 00:00:00 2001
From: ijun17
Date: Thu, 5 Dec 2024 17:43:29 +0900
Subject: [PATCH 6/6] =?UTF-8?q?design:=20=ED=80=B4=EC=A6=88=20=EB=B3=B4?=
=?UTF-8?q?=EB=93=9C=20=EC=82=B4=EC=A7=9D=20=EB=8D=94=20=ED=88=AC=EB=AA=85?=
=?UTF-8?q?=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
FE/tailwind.config.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/FE/tailwind.config.js b/FE/tailwind.config.js
index a81a3a9..a4ea23d 100644
--- a/FE/tailwind.config.js
+++ b/FE/tailwind.config.js
@@ -85,11 +85,11 @@ export default {
borderWidth: '1px',
borderColor: theme('borderColor.default'),
borderRadius: theme('borderRadius.m'),
- backgroundColor: '#FFFD'
+ backgroundColor: '#FFFC'
},
'.component-popup': {
borderRadius: theme('borderRadius.m'),
- backgroundColor: '#FFFD',
+ backgroundColor: '#FFFC',
boxShadow: theme('boxShadow.default')
},
'.center': {