From 4cdaf65958a935dea14be9246c4901ae0aa7b210 Mon Sep 17 00:00:00 2001 From: rbgksqkr Date: Tue, 27 Aug 2024 17:51:14 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20AlertModal=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EB=88=8C?= =?UTF-8?q?=EB=A0=80=EC=9D=84=20=EB=95=8C=20=EC=B6=94=EA=B0=80=20=EB=8F=99?= =?UTF-8?q?=EC=9E=91=EC=9D=B4=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20onConfirm=20props=20=EC=B6=94=EA=B0=80=20#253?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/AlertModal/AlertModal.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/common/AlertModal/AlertModal.tsx b/frontend/src/components/common/AlertModal/AlertModal.tsx index f1eda4363..736a8ed9d 100644 --- a/frontend/src/components/common/AlertModal/AlertModal.tsx +++ b/frontend/src/components/common/AlertModal/AlertModal.tsx @@ -5,12 +5,18 @@ import Modal from '../Modal/Modal'; interface AlertModalProps { isOpen: boolean; - onClose: () => void; message: string; + onClose: () => void; + onConfirm?: () => void; title?: string; } -const AlertModal = ({ isOpen, onClose, message, title }: AlertModalProps) => { +const AlertModal = ({ isOpen, onClose, onConfirm, message, title }: AlertModalProps) => { + const handleClick = () => { + onConfirm && onConfirm(); + onClose(); + }; + return ( @@ -26,7 +32,9 @@ const AlertModal = ({ isOpen, onClose, message, title }: AlertModalProps) => { ))} - 닫기 + + 확인 + ); From efe0426d58fa44b2874642bb7de4a30ea4e0c0a8 Mon Sep 17 00:00:00 2001 From: rbgksqkr Date: Tue, 27 Aug 2024 17:56:07 +0900 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20=EB=B0=A9=20=EB=82=98=EA=B0=80?= =?UTF-8?q?=EA=B8=B0=20=EC=A0=84=EC=97=90=20=ED=95=9C=EB=B2=88=20=EB=8D=94?= =?UTF-8?q?=20=ED=99=95=EC=9D=B8=20=EB=AA=A8=EB=8B=AC=20=EB=9D=84=EC=9A=B0?= =?UTF-8?q?=EA=B8=B0=20#253?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/layout/Header/Header.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/layout/Header/Header.tsx b/frontend/src/components/layout/Header/Header.tsx index 9ee6a26c0..853125ece 100644 --- a/frontend/src/components/layout/Header/Header.tsx +++ b/frontend/src/components/layout/Header/Header.tsx @@ -9,6 +9,7 @@ import useRoutePath from './hooks/useRoutePath'; import ArrowLeft from '@/assets/images/arrowLeft.svg'; import ExitIcon from '@/assets/images/exitIcon.png'; import SettingIcon from '@/assets/images/settingsIcon.svg'; +import AlertModal from '@/components/common/AlertModal/AlertModal'; import RoomSettingModal from '@/components/common/RoomSettingModal/RoomSettingModal'; import { ROUTES } from '@/constants/routes'; import useBalanceContentQuery from '@/hooks/useBalanceContentQuery'; @@ -46,12 +47,13 @@ export const TitleHeader = ({ title }: HeaderProps) => ( // 3. 가운데 제목, 우측 상단 차지하는 헤더 : 게임 대기 화면 export const RoomSettingHeader = ({ title }: HeaderProps) => { const { isOpen, show, close } = useModal(); + const { isOpen: isExitOpen, show: exitShow, close: exitClose } = useModal(); const { handleExit } = useExit(); const memberInfo = useRecoilValue(memberInfoState); return (
-

{title}

@@ -62,6 +64,13 @@ export const RoomSettingHeader = ({ title }: HeaderProps) => { ) : ( )} + {isOpen && }
); From 0cda75cfa6574502004b8e1d61ce7f087a2e3ad0 Mon Sep 17 00:00:00 2001 From: rbgksqkr Date: Mon, 26 Aug 2024 11:18:35 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20=EC=84=9C=EB=B2=84=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EB=8D=B0=EC=9D=B4=ED=84=B0=EB=A1=9C=20master?= =?UTF-8?q?=EB=A5=BC=20=ED=8C=90=EB=8B=A8=ED=95=98=EA=B3=A0,=20=EB=B0=A9?= =?UTF-8?q?=EC=9E=A5=EC=9D=B4=20=EB=90=9C=20=EC=82=AC=EB=9E=8C=EC=97=90?= =?UTF-8?q?=EA=B2=8C=20alert=20#253?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/mocks/data/roomInfo.json | 6 +++++- frontend/src/pages/ReadyPage/ReadyPage.tsx | 12 ++++++------ frontend/src/types/room.ts | 1 + 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/mocks/data/roomInfo.json b/frontend/src/mocks/data/roomInfo.json index 3f04cabc0..a7b9aa888 100644 --- a/frontend/src/mocks/data/roomInfo.json +++ b/frontend/src/mocks/data/roomInfo.json @@ -34,5 +34,9 @@ "nickname": "프콩", "isMaster": false } - ] + ], + "master": { + "masterId": 2, + "nickname": "든콩" + } } diff --git a/frontend/src/pages/ReadyPage/ReadyPage.tsx b/frontend/src/pages/ReadyPage/ReadyPage.tsx index 98757caa0..b6bfd1902 100644 --- a/frontend/src/pages/ReadyPage/ReadyPage.tsx +++ b/frontend/src/pages/ReadyPage/ReadyPage.tsx @@ -10,15 +10,15 @@ import Spinner from '@/components/common/Spinner/Spinner'; import ReadyMembersContainer from '@/components/ReadyMembersContainer/ReadyMembersContainer'; const ReadyPage = () => { - const { members, roomSetting, isLoading, isError } = useGetRoomInfo(); + const { members, roomSetting, master, isLoading, isError } = useGetRoomInfo(); const { memberInfo, handleGameStart, setMemberInfo } = useGameStart(); - const masterId = members?.filter((member) => member.isMaster)[0].memberId; useEffect(() => { - if (!memberInfo.isMaster && masterId === memberInfo.memberId) { + if (!memberInfo.isMaster && master?.memberId === memberInfo.memberId) { setMemberInfo({ ...memberInfo, isMaster: true }); + alert(`${master?.nickname}님이 방장이 되었습니다.`); } - }, [masterId]); + }, [master?.memberId]); if (isLoading) return ; return ( @@ -27,8 +27,8 @@ const ReadyPage = () => { {isError &&
에러 발생
} {members && }