diff --git a/src/components/layout/gameRoomHeader/GameRoomHeader.tsx b/src/components/layout/gameRoomHeader/GameRoomHeader.tsx index f69d897..3209248 100644 --- a/src/components/layout/gameRoomHeader/GameRoomHeader.tsx +++ b/src/components/layout/gameRoomHeader/GameRoomHeader.tsx @@ -1,7 +1,6 @@ import iconExit from "@assets/images/icon_close.svg"; -import { NavLink, useNavigate, useParams } from "react-router-dom"; +import { useNavigate, useParams } from "react-router-dom"; import { Flex, StyledHeader, TextButton } from "./GameRoomHeaderStyle"; - import { useSocketStore } from "../../../store/useSocketStore"; export default function GameRoomHeader() { @@ -20,12 +19,10 @@ export default function GameRoomHeader() { return ( <> - - onClickOut(roomId)}> - 게임방 나가기 - 나가기 - - + onClickOut(roomId)}> + 게임방 나가기 + 나가기 + ); diff --git a/src/components/ui/card/chatting/Chatting.tsx b/src/components/ui/card/chatting/Chatting.tsx index 91f00a7..7a3f0fd 100644 --- a/src/components/ui/card/chatting/Chatting.tsx +++ b/src/components/ui/card/chatting/Chatting.tsx @@ -1,10 +1,5 @@ -import ChatInputBox from "../../chatInput/ChatInputBox"; import * as S from "./ChattingStyle"; -// import { Socket } from "socket.io-client"; - -// export interface IChattingProps { -// socket: Socket | null; -// } +import ChatInputBox from "../../chatInput/ChatInputBox"; export default function ChattingBox() { return ( diff --git a/src/components/ui/card/chatting/ChattingStyle.ts b/src/components/ui/card/chatting/ChattingStyle.ts index e1d04ee..7f6a6ff 100644 --- a/src/components/ui/card/chatting/ChattingStyle.ts +++ b/src/components/ui/card/chatting/ChattingStyle.ts @@ -4,6 +4,7 @@ export const chat = styled.div` position: relative; width: 390px; height: 390px; + padding: 20px; border-radius: 12px; border: 1px solid var(--color-gray-999); box-shadow: 1px 1px 3px 0px #00000080; @@ -15,8 +16,7 @@ export const chat = styled.div` `; export const chatInputBoxContainer = styled.div` - position: absolute; - bottom: 20px; - padding: 0 10px; - width: 100%; + display: flex; + flex-direction: column; + gap: 10px; `; diff --git a/src/components/ui/chatInput/ChatInputBox.tsx b/src/components/ui/chatInput/ChatInputBox.tsx index 4fdbd2d..62377bc 100644 --- a/src/components/ui/chatInput/ChatInputBox.tsx +++ b/src/components/ui/chatInput/ChatInputBox.tsx @@ -1,10 +1,21 @@ import Button from "../button/Button"; import * as S from "./chatInputStyle"; -// import { IChattingProps } from "../card/chatting/Chatting"; -// import { useEffect, useState } from "react"; +import { useSocketStore } from "@store/useSocketStore"; +import { useEffect } from "react"; // import { useParams } from "react-router-dom"; export default function ChatInputBox() { + const { socket } = useSocketStore(); + + useEffect(() => { + if (!socket) { + console.error("Socket is not connected."); + return; + } + }, []); + + console.log("🚀 Socket:", socket); + // const [message, setMessage] = useState(""); // const params = useParams(); // const roomId = Number(params.id); @@ -26,23 +37,26 @@ export default function ChatInputBox() { // }; return ( - - - - - - + <> + + + + + + + + ); } diff --git a/src/components/ui/chatInput/chatInputStyle.ts b/src/components/ui/chatInput/chatInputStyle.ts index 4290bc2..ca77810 100644 --- a/src/components/ui/chatInput/chatInputStyle.ts +++ b/src/components/ui/chatInput/chatInputStyle.ts @@ -1,5 +1,12 @@ import styled from "styled-components"; +export const chatLog = styled.div` + flex-grow: 1; + font-size: 14px; + max-height: 290px; + overflow-y: scroll; +`; + export const chatInput = styled.input` width: 100%; flex-grow: 1; @@ -24,4 +31,5 @@ export const chatInputBox = styled.div` width: 100%; display: flex; gap: 10px; + height: 100%; `; diff --git a/src/components/ui/circleBackground/circleBackgroundStyle.ts b/src/components/ui/circleBackground/circleBackgroundStyle.ts index 65fe959..5c5e054 100644 --- a/src/components/ui/circleBackground/circleBackgroundStyle.ts +++ b/src/components/ui/circleBackground/circleBackgroundStyle.ts @@ -47,7 +47,10 @@ const MovingYellow = keyframes` transform: translate(260%, 320%); } `; -export const Wrapper = styled.div``; +export const Wrapper = styled.div` + max-height: 600px; + overflow: hidden; +`; export const CircleGreen = styled.div` position: absolute; diff --git a/src/components/ui/modal/Modal.tsx b/src/components/ui/modal/Modal.tsx index f2e4e6d..caf7341 100644 --- a/src/components/ui/modal/Modal.tsx +++ b/src/components/ui/modal/Modal.tsx @@ -1,26 +1,9 @@ import ModalPortal from "./ModalPortal"; -import FirstSelect from "../modalContents/FirstSelect"; -import MakeRoom from "../modalContents/MakeRoom"; -import BigDeck from "../bigDeck/BigDeck"; import { useModalStore } from "../../../store/useModalStore"; import { Inside, ModalFrame, Overlay } from "./modalStyle"; -import GuessNumber from "../selectionNumber/GuessNumber"; import { useEffect } from "react"; import { useModal } from "@hooks/useModal"; -import TurnWaiting from "../modalContents/TurnWaiting"; -import GameWaiting from "../modalContents/GameWaiting"; -import SelectTurn from "../modalContents/SelectTurn"; - -const modalComponents: Record = { - firstSelect: , - makeRoom: , - myTurn: , - guessNumber: , - selectWhiteBlack: , - turnWaiting: , - gameWaiting: , - selectTurn: , -}; +import { modalComponents } from "./modalComponent"; export default function Modal() { const { showModal, currentModal, modalColor } = useModalStore(); diff --git a/src/components/ui/modal/modalComponent.tsx b/src/components/ui/modal/modalComponent.tsx new file mode 100644 index 0000000..36684b3 --- /dev/null +++ b/src/components/ui/modal/modalComponent.tsx @@ -0,0 +1,17 @@ +import FirstSelect from "../modalContents/FirstSelect"; +import MakeRoom from "../modalContents/MakeRoom"; +import BigDeck from "../bigDeck/BigDeck"; +import TurnWaiting from "../modalContents/TurnWaiting"; +import GameWaiting from "../modalContents/GameWaiting"; +import Alert from "../modalContents/Alert"; + +export const modalComponents: Record = { + firstSelect: , + makeRoom: , + selectWhiteBlack: , + turnWaiting: , + gameWaiting: , + GamrRoomJoinConfirm: ( + + ), +}; diff --git a/src/components/ui/modalContents/Alert.tsx b/src/components/ui/modalContents/Alert.tsx new file mode 100644 index 0000000..72e03ac --- /dev/null +++ b/src/components/ui/modalContents/Alert.tsx @@ -0,0 +1,31 @@ +import Button from "../button/Button"; +import { useModal } from "@hooks/useModal"; +import { Container, Message } from "./alertStyle"; + +interface IAlertConfirmProps { + message: string; +} + +export default function Alert({ message }: IAlertConfirmProps) { + const { closeModal } = useModal(); + + const onClickCancel = () => { + closeModal(); + }; + + return ( + + {message} + + + ); +} diff --git a/src/components/ui/modalContents/alertStyle.ts b/src/components/ui/modalContents/alertStyle.ts new file mode 100644 index 0000000..3f50083 --- /dev/null +++ b/src/components/ui/modalContents/alertStyle.ts @@ -0,0 +1,18 @@ +import styled from "styled-components"; + +export const Container = styled.div` + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + height: 100%; + gap: 50px; +`; + +export const Message = styled.p` + font-size: 20px; + word-wrap: break-word; + max-width: 400px; + line-height: 1.7rem; + text-align: center; +`; diff --git a/src/components/ui/profile/Profile.tsx b/src/components/ui/profile/Profile.tsx index 9f5c800..ce279f7 100644 --- a/src/components/ui/profile/Profile.tsx +++ b/src/components/ui/profile/Profile.tsx @@ -1,9 +1,10 @@ import * as S from "./profileStyle"; +import myProfileImage from "@assets/images/image_profile_01.svg"; export default function Profile({ nickname }: IprofileProps) { return ( - + {nickname} diff --git a/src/pages/game/GameRoom.tsx b/src/pages/game/GameRoom.tsx index fd29eca..7471085 100644 --- a/src/pages/game/GameRoom.tsx +++ b/src/pages/game/GameRoom.tsx @@ -351,7 +351,7 @@ export default function GameRoom() { - + {opponentColor?.map((deck, index) => ( { - openModal("makeRoom", "white"); + if (!accessToken || accessToken === null) { + openModal("GamrRoomJoinConfirm", "white"); + } else { + openModal("makeRoom", "white"); + } }; return ( diff --git a/src/pages/game/gameRoomStyle.ts b/src/pages/game/gameRoomStyle.ts index cb3c103..4eaf4a0 100644 --- a/src/pages/game/gameRoomStyle.ts +++ b/src/pages/game/gameRoomStyle.ts @@ -14,26 +14,22 @@ export const leftContainer = styled.div` display: flex; flex-direction: column; justify-content: space-between; - background-color: yellow; + gap: 30px; `; export const centerContainer = styled.div` height: 100%; width: 100%; - background-color: green; + flex-grow: 1; position: relative; `; export const rightContainer = styled.div` - margin-right: 77px; - padding-bottom: 44px; width: 390px; - height: 100%; display: flex; gap: 40px; flex-direction: column; - justify-content: end; - background-color: blue; + justify-content: space-between; `; export const myDeckBox = styled.div` @@ -41,16 +37,8 @@ export const myDeckBox = styled.div` justify-content: end; width: 100%; height: 90px; + flex-grow: 1; gap: 11px; - background-color: purple; -`; - -export const guideBox = styled.div` - width: 100%; - height: 60px; - display: flex; - flex-direction: center; - background-color: red; `; export const otherPlayerDeck = styled.div` @@ -59,12 +47,10 @@ export const otherPlayerDeck = styled.div` height: 90px; display: flex; gap: 12px; - background-color: aqua; `; export const selectNumberBox = styled.div` margin-top: 40px; width: 100%; height: 229px; - background-color: black; `; diff --git a/src/pages/home/homeStyle.ts b/src/pages/home/homeStyle.ts index c5da5de..1401712 100644 --- a/src/pages/home/homeStyle.ts +++ b/src/pages/home/homeStyle.ts @@ -10,12 +10,14 @@ const basicStyle = css` export const HomeContainer = styled.div` width: 100%; + min-width: 600px; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 30px; + flex-shrink: 0; `; export const NavWrapper = styled.nav`