Skip to content

Commit 511c2c5

Browse files
committed
feat:1차 기능
1 parent a27b5ff commit 511c2c5

20 files changed

+995
-232
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# production
1212
/build
1313

14+
.env
1415
# misc
1516
.DS_Store
1617
.env.local

package-lock.json

+921-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@
1010
"@types/node": "^16.18.78",
1111
"@types/react": "^18.2.51",
1212
"@types/react-dom": "^18.2.18",
13+
"firebase": "^10.8.0",
14+
"firestore": "^1.1.6",
1315
"react": "^18.2.0",
1416
"react-dom": "^18.2.0",
1517
"react-router-dom": "^6.22.1",
1618
"react-scripts": "5.0.1",
19+
"sass": "^1.71.1",
20+
"sass-loader": "^14.1.1",
21+
"styled-components": "^6.1.8",
22+
"three": "^0.161.0",
1723
"typescript": "^4.9.5",
1824
"web-vitals": "^2.1.4"
1925
},

src/App.css

-38
Original file line numberDiff line numberDiff line change
@@ -1,38 +0,0 @@
1-
.App {
2-
text-align: center;
3-
}
4-
5-
.App-logo {
6-
height: 40vmin;
7-
pointer-events: none;
8-
}
9-
10-
@media (prefers-reduced-motion: no-preference) {
11-
.App-logo {
12-
animation: App-logo-spin infinite 20s linear;
13-
}
14-
}
15-
16-
.App-header {
17-
background-color: #282c34;
18-
min-height: 100vh;
19-
display: flex;
20-
flex-direction: column;
21-
align-items: center;
22-
justify-content: center;
23-
font-size: calc(10px + 2vmin);
24-
color: white;
25-
}
26-
27-
.App-link {
28-
color: #61dafb;
29-
}
30-
31-
@keyframes App-logo-spin {
32-
from {
33-
transform: rotate(0deg);
34-
}
35-
to {
36-
transform: rotate(360deg);
37-
}
38-
}

src/App.test.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import { render, screen } from '@testing-library/react';
32
import App from './App';
43

src/App.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { BrowserRouter, Route, Router, Routes } from 'react-router-dom';
22
import './App.css';
3-
import LoginPage from './pages/LoginPage';
4-
import SignUpPage from './pages/SignUpPage';
3+
import NicknameInput from './pages/StartPage';
4+
import WaitingPage from './pages/WaitingPage';
5+
import Background from './components/common/background/Background';
6+
import MainPage from './pages/MainPage';
57

68
function App() {
79
return (
810
<BrowserRouter>
11+
<Background />
912
<Routes>
10-
<Route path="/" element={<LoginPage />} />
11-
<Route path="/signUp" element={<SignUpPage />} />
13+
<Route path="/" element={<NicknameInput />} />
14+
<Route path="/waiting" element={<WaitingPage />} />
15+
<Route path="/room/:roomId/:roomTitle" element={<MainPage />} />
1216
</Routes>
1317
</BrowserRouter>
1418
);

src/components/common/Modal.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const Modal = ({ setIsModal, roomList, setRoomList }: ModalProps) => {
1414
const [pwd, setPwd] = useState('');
1515
const [title, setTitle] = useState('');
1616
const addRoom = async () => {
17+
if (title.trim() === '') return alert('공백은 입력하실 수 없습니다.');
1718
const roomId = new Date().getTime();
1819
const roomInfo = {
1920
roomTitle: title,

src/components/login/LoginForm.tsx

-46
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { useEffect, useState } from 'react';
21
import styled from 'styled-components';
32
const UserProfile = ({ onClickReady, nickname, state, start }: any) => {
43
const nick = localStorage.getItem('nickname');
54
return (
65
<Container>
76
<div className="nickname">{nickname}</div>
8-
<Ready state={state}>{state ? 'GO' : 'READY'}</Ready>
97
<ReadyBtn
108
onClick={onClickReady}
11-
state={state}
9+
state={state.toString()}
1210
disabled={nick !== nickname || start ? true : false}
1311
>
1412
{state ? 'GO' : 'READY'}
@@ -25,20 +23,20 @@ const Container = styled.div`
2523
align-items: center;
2624
justify-content: space-around;
2725
`;
28-
const Ready = styled.div<{ state: boolean }>`
29-
color: ${({ state }) => (state ? 'black' : 'white')};
30-
`;
31-
const ReadyBtn = styled.button<{ state: boolean }>`
26+
27+
const ReadyBtn = styled.button<{ state: string }>`
3228
width: 100px;
3329
cursor: pointer;
3430
font-weight: bold;
3531
font-size: 20px;
3632
color: #fff;
37-
background-color: ${({ state }) => (state ? '#00aaaa' : '#696969')};
33+
background-color: ${({ state }) =>
34+
state === 'true' ? '#00aaaa' : '#696969'};
3835
height: 50px;
3936
border-radius: 10px;
4037
&:hover {
41-
background-color: ${({ state }) => (state ? '#019696' : '#8b8b8b')};
38+
background-color: ${({ state }) =>
39+
state === 'true' ? '#019696' : '#8b8b8b'};
4240
}
4341
`;
4442
export default UserProfile;

src/components/signup/SingUpForm.tsx

-84
This file was deleted.

src/components/start/NicknameInput.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const NicknameInput = () => {
77
const nav = useNavigate();
88
const [nickname, setNickname] = useState<string>('');
99
const enterHandler = async () => {
10+
if (nickname.trim() === '') return alert('공백은 입력하실 수 없습니다.');
1011
const user = await signInAnonymously(auth);
1112
localStorage.setItem('nickname', nickname);
1213
localStorage.setItem('uid', user.user.uid);

src/components/waiting/Greeting.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from 'styled-components';
22

33
const Greeting = () => {
4-
const nickname = sessionStorage.getItem('nickname');
4+
const nickname = localStorage.getItem('nickname');
55
return (
66
<Container>
77
<h1>환영합니다 {nickname}님!!</h1>

src/components/waiting/room/Room.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Room = ({ room }: RoomProps) => {
1414
const nav = useNavigate();
1515
const enterRoomHandler = () => {
1616
if (room.users < 2) {
17-
nav(`/room/${room.roomId}`);
17+
nav(`/room/${room.roomId}/${room.title}`);
1818
} else {
1919
alert('방에 입장할 수 없습니다.');
2020
}

src/components/waiting/room/RoomList.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const Container = styled.div`
1717
height: 600px;
1818
display: flex;
1919
overflow: scroll;
20+
&::-webkit-scrollbar {
21+
display: none;
22+
}
2023
flex-direction: column;
2124
align-items: center;
2225
padding-top: 50px;

src/config/firebaseConfig.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { initializeApp } from 'firebase/app';
22
import { getAuth } from 'firebase/auth';
3-
// import { getFirestore } from 'firebase/firestore';
3+
import { getFirestore } from 'firebase/firestore';
44
const firebaseConfig = {
55
apiKey: process.env.REACT_APP_FIREBASE_KEY,
66
authDomain: process.env.REACT_APP_AUTH_DOMAIN,
@@ -10,6 +10,6 @@ const firebaseConfig = {
1010
appId: process.env.REACT_APP_ID,
1111
};
1212
const app = initializeApp(firebaseConfig);
13-
// const fireStore = getFirestore(app);
13+
const fireStore = getFirestore(app);
1414
const auth = getAuth(app);
15-
export { auth };
15+
export { auth, fireStore };

src/custom.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare module 'firebase';
2+
declare module 'three';

src/global.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.module.scss' {
2+
const classes: { [key: string]: string };
3+
export default classes;
4+
}

src/index.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import React from 'react';
21
import ReactDOM from 'react-dom/client';
32
import './index.css';
3+
import './styled/Styled.scss';
44
import App from './App';
55
import reportWebVitals from './reportWebVitals';
66

77
const root = ReactDOM.createRoot(
88
document.getElementById('root') as HTMLElement
99
);
10-
root.render(
11-
<React.StrictMode>
12-
<App />
13-
</React.StrictMode>
14-
);
10+
root.render(<App />);
1511

1612
// If you want to start measuring performance in your app, pass a function
1713
// to log results (for example: reportWebVitals(console.log))

0 commit comments

Comments
 (0)