Skip to content

Commit 44c3951

Browse files
wcho21dohun31juyeong-sse030
authored
Deploy: 회의록 UI & 소켓 서버 & 백엔드 api 수정 (#113)
3주차 중간 과정까지 main에 머지 및 배포합니다. - 회의록 UI - 소켓 서버 - 백엔드 api 수정 Co-authored-by: dohun <[email protected]> Co-authored-by: juyeong-chungbuk <[email protected]> Co-authored-by: hodun <[email protected]> Co-authored-by: Seyoung Kim <[email protected]> Co-authored-by: se030 <[email protected]>
1 parent 2f47025 commit 44c3951

Some content is hidden

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

43 files changed

+2612
-131
lines changed

client/.stylelintrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": [
3+
"stylelint-config-recommended-scss",
4+
"stylelint-config-prettier-scss",
5+
"stylelint-config-property-sort-order-smacss"
6+
],
7+
"plugins": ["stylelint-scss"],
8+
"rules": {
9+
"at-rule-no-unknown": null,
10+
"max-nesting-depth": 3,
11+
"no-descending-specificity": null,
12+
"string-quotes": "single",
13+
"scss/at-rule-conditional-no-parentheses": null,
14+
"selector-pseudo-class-no-unknown": null,
15+
"property-no-unknown": null
16+
}
17+
}

client/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
"@vitejs/plugin-react": "^2.2.0",
2626
"eslint-plugin-react": "latest",
2727
"sass": "^1.56.1",
28+
"stylelint": "^14.15.0",
29+
"stylelint-config-prettier-scss": "^0.0.1",
30+
"stylelint-config-property-sort-order-smacss": "^9.0.0",
31+
"stylelint-config-recommended-scss": "^8.0.0",
2832
"vite": "^3.2.3",
2933
"vite-tsconfig-paths": "^3.5.2"
3034
}

client/src/App.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
import { useState, useEffect } from 'react';
2-
import { Routes, Route, useNavigate, useLocation } from 'react-router-dom';
1+
import { useEffect, useState } from 'react';
2+
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
33
import { getAuth } from 'src/apis/auth';
44
import UserContext from 'src/contexts/user';
55
import { LoadingPage, LoginPage, OAuthPage, WorkspacePage } from 'src/pages';
6-
import { User } from 'src/types/user';
6+
import { UserInfo } from 'src/types/user';
7+
78
import 'styles/reset.scss';
89

910
function App() {
1011
const [isLoaded, setIsLoaded] = useState<boolean>(false);
11-
const [user, setUser] = useState<User | null>(null);
12+
const [userInfo, setUserInfo] = useState<UserInfo | null>(null);
1213

1314
const navigate = useNavigate();
1415
const location = useLocation();
1516

1617
const autoLogin = async () => {
17-
const currentUser = await getAuth();
18+
const { user, workspaces } = await getAuth();
1819

1920
setIsLoaded(true);
2021

21-
if (!currentUser) {
22-
if (location.pathname === '/workspace') navigate('/');
22+
if (!user) {
23+
if (location.pathname.match('/workspace')) navigate('/');
2324
return;
2425
}
2526

26-
setUser(currentUser);
27-
navigate('/workspace');
27+
setUserInfo({ user, workspaces });
28+
29+
const { id } = workspaces[0];
30+
navigate(`/workspace/${id}`);
2831
};
2932

3033
useEffect(() => {
3134
autoLogin();
3235
}, []);
3336

3437
return isLoaded ? (
35-
<UserContext.Provider value={{ user, setUser }}>
38+
<UserContext.Provider value={{ userInfo, setUserInfo }}>
3639
<Routes>
3740
<Route path="/" element={<LoginPage />} />
3841
<Route path="/oauth" element={<OAuthPage />} />
39-
<Route path="/workspace" element={<WorkspacePage />} />
42+
<Route path="/workspace/:id" element={<WorkspacePage />} />
4043
</Routes>
4144
</UserContext.Provider>
4245
) : (

client/src/apis/auth.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
import { PostLoginParams } from 'params/auth';
2+
import { GetUserInfo } from 'src/types/workspace';
23

34
import { http } from './http';
4-
import { OK, CREATED } from './http-status';
5+
import { CREATED, OK } from './http-status';
56

6-
export const getAuth = async () => {
7-
try {
8-
const res = await http.get(`/auth`);
7+
export const getAuth = async (): Promise<GetUserInfo> => {
8+
const res = await http.get(`/auth`);
99

10-
if (res.status !== OK) return null;
10+
if (res.status !== OK) throw new Error();
1111

12-
return res.data;
13-
} catch (e) {
14-
return null;
15-
}
12+
return res.data;
1613
};
1714

18-
export const postAuthLogin = async ({ code }: PostLoginParams) => {
15+
export const postAuthLogin = async ({
16+
code,
17+
}: PostLoginParams): Promise<GetUserInfo> => {
1918
const res = await http.post(`/auth/login`, { code });
2019

2120
if (res.status !== CREATED) throw new Error();

client/src/apis/workspace.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { PostJoinParams, PostParams } from 'params/workspace';
2-
import { Workspace } from 'src/types/workspace';
1+
import { GetInfoParams, PostJoinParams, PostParams } from 'params/workspace';
2+
import { Workspace, WorkspaceInfo } from 'src/types/workspace';
33

44
import { http } from './http';
5-
import { CREATED } from './http-status';
5+
import { CREATED, OK } from './http-status';
66

77
export const postWorkspace = async ({
88
name,
@@ -23,3 +23,13 @@ export const postWorkspaceJoin = async ({
2323

2424
return res.data;
2525
};
26+
27+
export const getWorkspaceInfo = async ({
28+
id,
29+
}: GetInfoParams): Promise<WorkspaceInfo> => {
30+
const res = await http.get(`/workspace/${id}`);
31+
32+
if (res.status !== OK) throw new Error();
33+
34+
return res.data;
35+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function Confbar() {
2+
return <div></div>;
3+
}
4+
5+
export default Confbar;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import style from './style.module.scss';
2+
3+
function Mom() {
4+
// context나 props로 가져오기
5+
const selectedMom = {
6+
id: 1,
7+
name: '회의록 1',
8+
createdAt: new Date(),
9+
};
10+
11+
/*
12+
contentEditable 내용을 컨트롤하고 싶다면 ref 활용해볼 수 있음
13+
const titleRef = useRef<HTMLHeadingElement>(null);
14+
*/
15+
16+
const onTitleChange: React.FormEventHandler<HTMLHeadingElement> = (e) => {
17+
/*
18+
제목 변경하는 요청
19+
const title = e.target as HTMLHeadingElement;
20+
title.innerText
21+
OR
22+
titleRef.current.innerText
23+
*/
24+
};
25+
26+
return (
27+
<div className={style['mom-container']}>
28+
<div className={style['mom']}>
29+
<div className={style['mom-header']}>
30+
<h1
31+
contentEditable={true}
32+
suppressContentEditableWarning={true}
33+
onInput={onTitleChange}
34+
>
35+
{selectedMom.name}
36+
</h1>
37+
<span>{selectedMom.createdAt.toLocaleString()}</span>
38+
</div>
39+
<div className={style['editor-container']}>회의록 내용</div>
40+
</div>
41+
</div>
42+
);
43+
}
44+
45+
export default Mom;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@import 'styles/color.module.scss';
2+
3+
.mom-container {
4+
display: flex;
5+
flex-direction: column;
6+
align-items: center;
7+
justify-content: flex-end;
8+
width: 100%;
9+
height: 100vh;
10+
background-color: $off-white;
11+
}
12+
13+
.mom {
14+
position: relative;
15+
width: 90%;
16+
height: calc(100% - 30px);
17+
}
18+
19+
.mom-header {
20+
display: flex;
21+
flex-direction: row;
22+
align-items: baseline;
23+
justify-content: space-between;
24+
height: 70px;
25+
padding: 0px 15px 20px 15px;
26+
box-sizing: border-box;
27+
color: $gray-100;
28+
29+
& > h1 {
30+
font-size: 32px;
31+
font-weight: 500;
32+
33+
&:focus {
34+
outline: none;
35+
}
36+
}
37+
}
38+
39+
.editor-container {
40+
height: calc(100% - 70px);
41+
padding: 20px;
42+
box-sizing: border-box;
43+
background-color: white;
44+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import style from './style.module.scss';
2+
3+
function ConfButton() {
4+
return <button className={style['conf-button']}>회의시작</button>;
5+
}
6+
7+
export default ConfButton;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import style from './style.module.scss';
2+
3+
function MemberList() {
4+
const members = [
5+
{
6+
id: 1,
7+
name: '백도훈',
8+
avatarUrl: 'https://avatars.githubusercontent.com/u/65100540?s=60&v=4',
9+
},
10+
{
11+
id: 2,
12+
name: '백도훈',
13+
avatarUrl: 'https://avatars.githubusercontent.com/u/65100540?s=60&v=4',
14+
},
15+
];
16+
17+
return (
18+
<ul className={style['member-list']}>
19+
{members.map((item) => (
20+
<li key={item.id} className={style['member-item']}>
21+
<img src={item.avatarUrl} />
22+
<span>{item.name}</span>
23+
</li>
24+
))}
25+
</ul>
26+
);
27+
}
28+
29+
export default MemberList;

0 commit comments

Comments
 (0)