Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/components/layout/gameRoomHeader/GameRoomHeader.tsx
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -20,12 +19,10 @@ export default function GameRoomHeader() {
return (
<>
<StyledHeader>
<NavLink to="/">
<Flex onClick={() => onClickOut(roomId)}>
<img src={iconExit} alt="κ²Œμž„λ°© λ‚˜κ°€κΈ°" />
<TextButton>λ‚˜κ°€κΈ°</TextButton>
</Flex>
</NavLink>
<Flex onClick={() => onClickOut(roomId)}>
<img src={iconExit} alt="κ²Œμž„λ°© λ‚˜κ°€κΈ°" />
<TextButton>λ‚˜κ°€κΈ°</TextButton>
</Flex>
</StyledHeader>
</>
);
Expand Down
7 changes: 1 addition & 6 deletions src/components/ui/card/chatting/Chatting.tsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
8 changes: 4 additions & 4 deletions src/components/ui/card/chatting/ChattingStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
`;
54 changes: 34 additions & 20 deletions src/components/ui/chatInput/ChatInputBox.tsx
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -26,23 +37,26 @@ export default function ChatInputBox() {
// };

return (
<S.chatInputBox>
<S.chatInput
type="text"
placeholder="μƒλŒ€λ°©κ³Ό μ±„νŒ…μ„ λ‚˜λˆŒ 수 μžˆμŠ΅λ‹ˆλ‹€."
// value={message}
></S.chatInput>
<S.buttonBox>
<Button
size="xs"
bgcolor="green"
textcolor="black"
type="button"
// onClick={onClickSendMessage}
>
전솑
</Button>
</S.buttonBox>
</S.chatInputBox>
<>
<S.chatLog></S.chatLog>
<S.chatInputBox>
<S.chatInput
type="text"
placeholder="μƒλŒ€λ°©κ³Ό μ±„νŒ…μ„ λ‚˜λˆŒ 수 μžˆμŠ΅λ‹ˆλ‹€."
// value={message}
></S.chatInput>
<S.buttonBox>
<Button
size="xs"
bgcolor="green"
textcolor="black"
type="button"
// onClick={onClickSendMessage}
>
전솑
</Button>
</S.buttonBox>
</S.chatInputBox>
</>
);
}
8 changes: 8 additions & 0 deletions src/components/ui/chatInput/chatInputStyle.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,4 +31,5 @@ export const chatInputBox = styled.div`
width: 100%;
display: flex;
gap: 10px;
height: 100%;
`;
5 changes: 4 additions & 1 deletion src/components/ui/circleBackground/circleBackgroundStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
19 changes: 1 addition & 18 deletions src/components/ui/modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -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<string, React.ReactNode> = {
firstSelect: <FirstSelect />,
makeRoom: <MakeRoom />,
myTurn: <BigDeck />,
guessNumber: <GuessNumber />,
selectWhiteBlack: <BigDeck />,
turnWaiting: <TurnWaiting />,
gameWaiting: <GameWaiting />,
selectTurn: <SelectTurn />,
};
import { modalComponents } from "./modalComponent";

export default function Modal() {
const { showModal, currentModal, modalColor } = useModalStore();
Expand Down
17 changes: 17 additions & 0 deletions src/components/ui/modal/modalComponent.tsx
Original file line number Diff line number Diff line change
@@ -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<string, React.ReactNode> = {
firstSelect: <FirstSelect />,
makeRoom: <MakeRoom />,
selectWhiteBlack: <BigDeck />,
turnWaiting: <TurnWaiting />,
gameWaiting: <GameWaiting />,
GamrRoomJoinConfirm: (
<Alert message="κ°œμž„ λ°© λ§Œλ“€κΈ°λŠ” 둜그인 ν›„ κ°€λŠ₯ν•©λ‹ˆλ‹€." />
),
};
31 changes: 31 additions & 0 deletions src/components/ui/modalContents/Alert.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Container>
<Message>{message}</Message>
<Button
type="button"
size="md"
textcolor="black"
bgcolor="green"
width="200px"
onClick={onClickCancel}
>
확인
</Button>
</Container>
);
}
18 changes: 18 additions & 0 deletions src/components/ui/modalContents/alertStyle.ts
Original file line number Diff line number Diff line change
@@ -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;
`;
3 changes: 2 additions & 1 deletion src/components/ui/profile/Profile.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<S.container>
<S.avatar></S.avatar>
<S.avatar src={myProfileImage} alt="λ‚΄ ν”„λ‘œν•„ 이미지" />
<S.nameBox>
<S.nickname>{nickname}</S.nickname>
</S.nameBox>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/game/GameRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default function GameRoom() {
<ChattingBox />
</S.leftContainer>
<S.centerContainer>
<S.guideBox></S.guideBox>
<S.otherPlayerDeck></S.otherPlayerDeck>
<S.otherPlayerDeck>
{opponentColor?.map((deck, index) => (
<BackDeck
Expand Down
8 changes: 7 additions & 1 deletion src/pages/game/gameRoomList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ export default function GameRoomList() {
const { openModal } = useModal();
const { data: gameRooms } = useGetGameRoomList();
console.log("gameRoomsβœ…", gameRooms);
const accessToken = localStorage.getItem("accessToken");
console.log(accessToken);

const onClickModalOpen = () => {
openModal("makeRoom", "white");
if (!accessToken || accessToken === null) {
openModal("GamrRoomJoinConfirm", "white");
} else {
openModal("makeRoom", "white");
}
};

return (
Expand Down
22 changes: 4 additions & 18 deletions src/pages/game/gameRoomStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,31 @@ 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`
display: flex;
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`
Expand All @@ -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;
`;
2 changes: 2 additions & 0 deletions src/pages/home/homeStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down