Skip to content

Commit b0af68a

Browse files
authored
🔀 Merge pull request #18 from GleamingStar/dev
1.0.0 배포
2 parents f492de3 + ee99b61 commit b0af68a

55 files changed

Lines changed: 2566 additions & 53 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
3-
package-lock.json
3+
package-lock.json
4+
.env

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
# web-catchmind
2-
#### 캐치마인드 클론 프로젝트
2+
#### 캐치마인드 웹 게임 프로젝트
33

4+
## 👉 [AWS 배포 링크](http://52.79.242.136/)
45

5-
### 🛠 기술스택
6-
<img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=TypeScript&logoColor=white"/> <img src="https://img.shields.io/badge/React-61DAFB?style=flat-square&logo=React&logoColor=white"/> <img src="https://img.shields.io/badge/styled--components-DB7093?style=flat-square&logo=styled-components&logoColor=white"/> <img src="https://img.shields.io/badge/express-000000?style=flat-square&logo=express&logoColor=white" /> <img src="https://img.shields.io/badge/Socket.IO-010101?style=flat-square&logo=Socket.io&logoColor=white" />
7-
<img src="https://img.shields.io/badge/Webpack-8DD6F9?style=flat-square&logo=Webpack&logoColor=white" /> <img src="https://img.shields.io/badge/Babel-F9DC3E?style=flat-square&logo=Babel&logoColor=white" />
86

97
### 🎨 Preview
10-
### 🚀 To Do
8+
![GIF 2022-03-10 오후 4-11-13](https://user-images.githubusercontent.com/70461368/157608424-98bd63ae-835d-43ac-8759-6850d27ee27b.gif)
9+
10+
### 👀 How To Play
11+
- 닉네임을 정한 후 입장해주세요
12+
- 방을 선택해 입장해주세요
13+
- 만약 방이 없다면, 새로운 방을 만들어주세요
14+
- 2명 이상이 방에 있다면, 게임 시작 버튼을 눌러 게임을 시작해주세요
15+
- 출제자는 제시어를 보고 그림을 그려주시고, 나머지는 주어진 그림으로 제시어를 맞춰주세요
16+
17+
18+
### 🛠 Tech Stack
19+
<img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat-square&logo=TypeScript&logoColor=white"/> <img src="https://img.shields.io/badge/React-61DAFB?style=flat-square&logo=React&logoColor=white"/> <img src="https://img.shields.io/badge/styled--components-DB7093?style=flat-square&logo=styled-components&logoColor=white"/> <img src="https://img.shields.io/badge/express-000000?style=flat-square&logo=express&logoColor=white" /> <img src="https://img.shields.io/badge/Socket.IO-010101?style=flat-square&logo=Socket.io&logoColor=white" />
20+
<img src="https://img.shields.io/badge/Webpack-8DD6F9?style=flat-square&logo=Webpack&logoColor=white" /> <img src="https://img.shields.io/badge/Babel-F9DC3E?style=flat-square&logo=Babel&logoColor=white" />
21+
### 🚀 To Do
22+
- [ ] 문제 목록 추가
23+
- [ ] 모바일 반응형 디자인 및 터치 지원
24+
- [ ] [`<Entrance />`](https://github.com/GleamingStar/web-catchmind/issues/13) 기능 및 디자인 개선
25+
- [ ] [`<Lobby />`](https://github.com/GleamingStar/web-catchmind/issues/11) 디자인 개선
26+
- [ ] [`<Game />`](https://github.com/GleamingStar/web-catchmind/issues/17) 기능 및 디자인 개선
27+
- [ ] [최적화](https://github.com/GleamingStar/web-catchmind/issues/15)
28+
- [ ] [리팩토링](https://github.com/GleamingStar/web-catchmind/issues/16)
29+
- [ ] README 개선

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "catch-mind",
3-
"version": "0.0.1",
4-
"description": "web catchmind",
3+
"version": "1.0.0",
4+
"description": "drawing and guessing game web application",
55
"scripts": {
66
"start": "webpack --mode development --config ./webpack.server.js && node dist/server.js",
77
"build": "webpack --mode production --config ./webpack.server.js && webpack --config ./webpack.client.prod.js && node dist/server.js",
@@ -13,9 +13,9 @@
1313
"axios": "^0.25.0",
1414
"dotenv": "^16.0.0",
1515
"express": "^4.17.2",
16-
"express-session": "^1.17.2",
1716
"react": "^17.0.2",
1817
"react-dom": "^17.0.2",
18+
"react-icons": "^4.3.1",
1919
"recoil": "^0.6.1",
2020
"socket.io": "^4.4.1",
2121
"socket.io-client": "^4.4.1",

src/client/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import { lazy, Suspense } from 'react';
12
import { RecoilRoot } from 'recoil';
23
import GlobalStyle from './config/GlobalStyle';
4+
const Main = lazy(() => import('./components/Main'));
35

46
const App = () => (
57
<RecoilRoot>
68
<GlobalStyle />
9+
<Suspense fallback={<></>}>
10+
<Main />
11+
</Suspense>
712
</RecoilRoot>
813
);
914

src/client/atom/accountAtom.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { atom } from 'recoil';
2+
import { TUser } from 'shared/types';
3+
4+
export const accountAtom = atom<TUser>({
5+
key: 'account',
6+
default: null,
7+
});

src/client/atom/alertAtom.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { atom } from 'recoil';
2+
import { LOGIN_ALERT_MESSAGE, ROOM_ALERT_MESSAGE } from 'shared/constant';
3+
4+
export const loginAlertAtom = atom({
5+
key: 'loginAlert',
6+
default: LOGIN_ALERT_MESSAGE.NONE,
7+
});
8+
9+
export const roomAlertAtom = atom({
10+
key: 'roomAlert',
11+
default: ROOM_ALERT_MESSAGE.NONE,
12+
});

src/client/atom/canvasAtom.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { atom, selector } from 'recoil';
2+
import { TColor } from 'shared/types';
3+
4+
export const contextAtom = atom<CanvasRenderingContext2D>({
5+
key: 'canvas',
6+
default: null,
7+
});
8+
9+
export const toolAtom = atom<'pencil' | 'eraser'>({
10+
key: 'tool',
11+
default: 'pencil',
12+
});
13+
14+
export const thicknessAtom = atom<number>({
15+
key: 'thickness',
16+
default: 2,
17+
});
18+
19+
export const colorAtom = atom<TColor>({
20+
key: 'color',
21+
default: 'black',
22+
});
23+
24+
const pencilInlineSVG = (currentColor: string) =>
25+
`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='${currentColor}' class='bi bi-pencil' viewBox='0 0 16 16'%3E%3Cpath d='M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z'/%3E%3C/svg%3E`;
26+
const eraserInlineSVG =
27+
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' class='bi bi-eraser' viewBox='0 0 16 16'%3E%3Cpath d='M8.086 2.207a2 2 0 0 1 2.828 0l3.879 3.879a2 2 0 0 1 0 2.828l-5.5 5.5A2 2 0 0 1 7.879 15H5.12a2 2 0 0 1-1.414-.586l-2.5-2.5a2 2 0 0 1 0-2.828l6.879-6.879zm2.121.707a1 1 0 0 0-1.414 0L4.16 7.547l5.293 5.293 4.633-4.633a1 1 0 0 0 0-1.414l-3.879-3.879zM8.746 13.547 3.453 8.254 1.914 9.793a1 1 0 0 0 0 1.414l2.5 2.5a1 1 0 0 0 .707.293H7.88a1 1 0 0 0 .707-.293l.16-.16z'/%3E%3C/svg%3E";
28+
29+
export const cursorSelector = selector({
30+
key: 'cursor',
31+
get: ({ get }) => (get(toolAtom) === 'pencil' ? pencilInlineSVG(get(colorAtom)) : eraserInlineSVG),
32+
});
33+
34+
export const toggleCanvasModalAtom = atom<number>({
35+
key: 'toggleCanvasModal',
36+
default: 1,
37+
});
38+
39+
export const isThicknessOnSelector = selector<boolean>({
40+
key: 'isThicknessOn',
41+
get: ({ get }) => get(toggleCanvasModalAtom) === 0,
42+
});
43+
44+
export const isPaletteOnSelector = selector<boolean>({
45+
key: 'isPaletteOn',
46+
get: ({ get }) => get(toggleCanvasModalAtom) === 1,
47+
});

src/client/atom/chatAtom.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { atom } from 'recoil';
2+
import { TChat } from 'shared/types';
3+
4+
export const chatLogAtom = atom<Array<TChat>>({
5+
key: 'chatLog',
6+
default: [],
7+
});

src/client/atom/gameAtom.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { atom, selector } from 'recoil';
2+
import { MAX_SET_TIMER } from 'shared/constant';
3+
import { TGame } from 'shared/types';
4+
import { accountAtom } from './accountAtom';
5+
6+
export const gameAtom = atom<TGame>({
7+
key: 'game',
8+
default: null,
9+
});
10+
11+
export const answerSelector = selector<string>({
12+
key: 'answer',
13+
get: ({ get }) => get(gameAtom)?.answer,
14+
});
15+
16+
export const scoreSelector = selector({
17+
key: 'score',
18+
get: ({ get }) => (get(gameAtom) === null ? [] : [...get(gameAtom).score].sort((a, b) => b.value - a.value)),
19+
});
20+
21+
export const timerAtom = atom<number>({
22+
key: 'timer',
23+
default: MAX_SET_TIMER,
24+
});
25+
26+
export const isPainterSelector = selector({
27+
key: 'isPainter',
28+
get: ({ get }) => (get(accountAtom)?.id === get(gameAtom)?.painter.id) === (get(gameAtom) !== null),
29+
});

src/client/atom/headerAtom.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { atom, selector } from 'recoil';
2+
3+
export const toggleHeaderModalAtom = atom<number>({
4+
key: 'toggleHeaderModal',
5+
default: 0,
6+
});
7+
8+
export const isUserListOnSelector = selector<boolean>({
9+
key: 'isUserListOn',
10+
get: ({ get }) => get(toggleHeaderModalAtom) === 1,
11+
});
12+
13+
export const isScoreBoardOnSelector = selector<boolean>({
14+
key: 'isScoreBoardOn',
15+
get: ({ get }) => get(toggleHeaderModalAtom) === 2,
16+
});

0 commit comments

Comments
 (0)