Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
e2e0bb1
test commit
jejukyj Sep 8, 2024
448c95e
Chore : css import 에러처리를 위해 rules 추가
jejukyj Sep 8, 2024
3ab9cd4
Docs : normalize.css 링크 추가 및 파비콘 이미지 링크 추가
jejukyj Sep 8, 2024
628691c
Chore : emotion 의존성 추가
jejukyj Sep 8, 2024
3a1368d
Docs : 컴포넌트 구성
jejukyj Sep 8, 2024
d6c8982
Design : 배경 그라데이션 색 변경, wrapperStyle에 position: relative 추가
jejukyj Sep 9, 2024
0b6d7c3
Design : Global Style 추가 및 Header, InputBox 컴포넌트 CSS 추가
jejukyj Sep 9, 2024
452f172
Docs : JSON 더미 데이터 생성
jejukyj Sep 9, 2024
744dff9
Design : Favicon 추가
jejukyj Sep 9, 2024
68f4357
Design : icon, img 추가
jejukyj Sep 9, 2024
5cbe1b9
Style : width, height, position 단위 변경
jejukyj Sep 10, 2024
319d0d8
Design : 채팅 메시지 CSS 구현
jejukyj Sep 10, 2024
05ae50d
Design : 'box-sizing: border-box' 추가
jejukyj Sep 10, 2024
17a225a
Design : width 수정, position 값 추가
jejukyj Sep 10, 2024
dcbeaa0
Design : width 수정, position 값 추가
jejukyj Sep 10, 2024
cac1998
Refactor : 데이터 값 수정
jejukyj Sep 10, 2024
59c456d
Chore : 유저 데이터 값 추가
jejukyj Sep 10, 2024
c90ef70
Feat : 메시지 추가 기능 구현
jejukyj Sep 10, 2024
8565ea8
Feat : 메시지 입력 시 하단으로 자동스크롤 기능 구현, prop 유효성 검사 코드 추가
jejukyj Sep 10, 2024
178fd0c
Feat : 메시지 입력(제출) 시 새로고침 방지, 입력 창 자동 포커싱 기능 추가, 엔터 시에도 메시지 추가가 되도록 엔터…
jejukyj Sep 10, 2024
b375df4
Refactor : favicon 경로 수정
jejukyj Sep 11, 2024
5c8db53
Fix : GlobalStyle 변경, 에러 해결
jejukyj Sep 11, 2024
7cb3959
Refactor : CSS 에러 사항 수정
jejukyj Sep 11, 2024
e3c5e24
Refactor : img 경로 수정 및 CSS 수정
jejukyj Sep 11, 2024
1a39ab5
Refactor : img 경로 수정
jejukyj Sep 11, 2024
9a6ce24
Refactor : profile key값 제거
jejukyj Sep 11, 2024
af3567b
Refactor : profile img 경로 수정
jejukyj Sep 11, 2024
6dce93d
Refactor : CSS 수정
jejukyj Sep 11, 2024
5de07aa
Refactor : 경로 수정
jejukyj Sep 11, 2024
356bc6e
Refactor : 경로 수정
jejukyj Sep 11, 2024
17fb207
Refactor : img 경로 수정
jejukyj Sep 12, 2024
b2ff6e9
Refactor : Content 경로 수정
jejukyj Sep 12, 2024
4100b71
Refactor : 경로 수정
jejukyj Sep 12, 2024
6fb55d6
Refactor : favicon 경로 수정
jejukyj Sep 12, 2024
aa6b32d
Design : overscroll 방지 코드 추가
jejukyj Sep 12, 2024
2efc4c6
Refactor : img, file 경로 수정
jejukyj Sep 18, 2024
bacafdd
Feat : 타입 지정 및 리팩토링
jejukyj Sep 18, 2024
e45e778
Chore : TypeScript 설정 추가
jejukyj Sep 18, 2024
d037da4
Feat : TypeScript 컴파일 옵션 설정
jejukyj Sep 18, 2024
d50cc5d
Feat : img 경로 지정
jejukyj Sep 18, 2024
99c9d54
Refactor : 폰트 재사용성을 높일 수 있도록 font-face 수정
jejukyj Sep 18, 2024
f8bbc7c
Refactor : jsx를 tsx로 변경
jejukyj Sep 18, 2024
d76ab79
Chore : yarn.lock update
jejukyj Sep 18, 2024
f3d23fe
Docs : 채팅방 목록 페이지 추가
jejukyj Oct 9, 2024
67e6b5c
Design : 채팅방 목록 페이지 UI
jejukyj Oct 9, 2024
16a3ac8
Feat : 라우터 연결
jejukyj Oct 9, 2024
7e4fe42
Feat : Router, Recoil 추가
jejukyj Oct 9, 2024
af3a253
Feat : 채팅방 목록 페이지와 라우터 연결
jejukyj Oct 9, 2024
1dc47c4
Feat : 라우터 추가
jejukyj Oct 9, 2024
57bfa34
Design : 검색 아이콘 추가
jejukyj Oct 9, 2024
030b9b3
Refactor : height 값 변경
jejukyj Oct 9, 2024
d2c21c9
Refactor : 공백 수정
jejukyj Oct 9, 2024
65bf331
Design : 프로필 이미지 추가
jejukyj Oct 9, 2024
35fd4dd
Feat : 상태관리를 위한 recoil atom 생성
jejukyj Oct 9, 2024
d43e0f7
Feat : 각 채팅방 아이디에 따른 라우터 수정
jejukyj Oct 9, 2024
980fc72
Feat : atom 파일 연결
jejukyj Oct 9, 2024
511b8eb
Design : 방해금지모드 아이콘 추가
jejukyj Oct 9, 2024
351fa87
Refactor : 안쓰는 코드 삭제
jejukyj Oct 9, 2024
e5d381c
Fix : state들 타입 지정
jejukyj Oct 9, 2024
31bb9cd
Feat : 방해금지모드 기능 추가 및 타입 지정
jejukyj Oct 9, 2024
9b4390e
Comment : 주석 추가
jejukyj Oct 9, 2024
052fefb
Feat : 마지막 채팅 메시지 표시 기능 추가
jejukyj Oct 10, 2024
6ed0f94
Design : 메시지 박스 width 값 지정
jejukyj Oct 10, 2024
420b7f8
Feat : vercel 라우트 경로 추가
jejukyj Oct 10, 2024
201b6d7
Fix : Strict Mode 제거
jejukyj Oct 10, 2024
43e819f
Feat : 자동 redirect 기능 추가
jejukyj Oct 10, 2024
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
3 changes: 3 additions & 0 deletions @types/global/intex.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module '*.svg';
declare module '*.png';
declare module '*.jpg';
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ export default [
],
},
},
{
rules: {
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
},
];
10 changes: 7 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/assets/phoning.png" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React SNS</title>
<title>Phoning 📱🐰💗</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@types/jest": "^29.5.13",
"@types/node": "^22.5.5",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react-dom": "^18.3.1",
"react-router-dom": "^6.26.2",
"recoil": "^0.7.7"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/react": "^18.3.3",
"@types/react": "^18.3.7",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.9.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"typescript": "^5.6.2",
"vite": "^5.4.1"
}
}
1 change: 1 addition & 0 deletions public/assets/bell-no-ring.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/bell-ring.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/dani.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/hanni.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/hyein.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/hyerin.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/metamong.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/minji.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/phoning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/searchIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/submit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/video-camera.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions src/App.jsx

This file was deleted.

65 changes: 65 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import Header from './components/Header';
import Content from './components/Content';
import InputBox from './components/InputBox';
import GlobalStyle from './components/GlobalStyle';
import { useSetRecoilState } from 'recoil';
import { messageState } from './recoil/atoms';
import { useParams } from 'react-router-dom';

// 메시지 타입
interface messageType {
id: number;
userId: number;
text: string;
time: string;
}

function App() {
const { chatId } = useParams<{ chatId: string }>(); // URL에서 chatId를 가져옴
const setMessages = useSetRecoilState(messageState);

function addMessage(text: string): void {
const newMessage: messageType = {
id: Date.now(),
userId: 0, // 항상 0으로 설정(메시지를 추가하면 '내'가 추가하도록 설정)
text: text,
time: new Date().toLocaleTimeString([], {
hour: '2-digit',
minute: '2-digit',
}),
}; // '오전 12:00' 포맷으로 출력

setMessages((prevMessages) => {
const chatRoomId = parseInt(chatId || '1', 10);
return {
...prevMessages,
[chatRoomId]: [...(prevMessages[chatRoomId] || []), newMessage],
};
}); // 기존 메시지에 새로운 메시지 추가
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

위 코드를 App에서 작성하신 이유가 있을까요 ? InputBox 안에서만 사용하는 코드인 것 같은데, InputBox 컴포넌트 내에서 선언 및 사용하시는게 좋을 것 같습니다. 불필요하게 props를 내려주고 있는 것 같아요 ~


return (
<>
<GlobalStyle />
<div css={wrapperStyle}>
<Header />
<Content chatId={parseInt(chatId || '0', 10)} />
<InputBox addMessage={addMessage} />
</div>
</>
);
}

export default App;

// emotion/css

const wrapperStyle = css`
width: 100%;
max-width: 430px;
background: linear-gradient(#f8ff2e, #ffffff 40%);
border: 1px solid #1d1d1d;
overflow: hidden;
`;
25 changes: 25 additions & 0 deletions src/List.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import GlobalStyle from './components/GlobalStyle';
import ListHeader from './components/ListHeader';
import ListContent from './components/ListContent';

export default function List() {
return (
<>
<GlobalStyle />
<div css={wrapperStyle}>
<ListHeader />
<ListContent />
</div>
</>
);
}

const wrapperStyle = css`
width: 100%;
max-width: 430px;
height: 100%;
background: linear-gradient(#f8ff2e, #ffffff 40%);
border: 1px solid #1d1d1d;
`;
18 changes: 18 additions & 0 deletions src/RouterList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';

import List from './List';
import App from './App';

export default function RouterList() {
return (
<div>
<Routes>
<Route path="/" element={<Navigate to="/list" />} />
<Route path="/list" element={<List />} />
<Route path="/chatroom/:chatId" element={<App />} />
<Route path="*" element={<Navigate to="/list" />} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*로 path를 한번 더 설정한 이유가 있을까요?

</Routes>
</div>
);
}
Loading