-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4주차] 정희수 미션 제출합니다. #16
Open
heeeesoo
wants to merge
15
commits into
CEOS-Developers:master
Choose a base branch
from
heeeesoo:heeeesoo2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2a67610
git branch 새로 팜
heeeesoo 6ff33a8
feat : 페이지 구분
heeeesoo 4eab43e
feat : Header 추가
heeeesoo 1346d7f
feat : Friend page 수정
heeeesoo 29ae0d6
feat : msg 띄우기
heeeesoo 37ff39a
feat : message 보내는 room 틀 구현
heeeesoo af988cc
feat : 채팅 페이지 만들기
heeeesoo cd654cc
feat: 마지막 메세지 뜨기
heeeesoo ae76f1e
feat: setting에 github 링크 추가
heeeesoo 8550abb
feat: 채팅할때 사진 뜨는 기능 추가
heeeesoo f47fa43
fix: key props 에러 해결
heeeesoo 8a9c3c1
feat: 검색 기능 추가
heeeesoo c6a0e37
chore: console.log삭제
heeeesoo 16d783d
chore: search state 변경
heeeesoo 338d626
chore : type 따로 파일 만들기, 이미지 지우기
heeeesoo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
import { Route, Routes } from 'react-router-dom'; | ||
import Friends from "./pages/Friends/Friends"; | ||
import Chat from "./pages/Chatting/Chat"; | ||
import Setting from "./pages/Setting/Setting"; | ||
import Room from './pages/Room/Room'; | ||
import GlobalStyle from './styles/GlobalStyle'; | ||
|
||
function App() { | ||
return <div>화이팅!!</div>; | ||
|
||
return ( | ||
<> | ||
<GlobalStyle/> | ||
<Routes> | ||
<Route path = '/' element={<Friends/>}/> | ||
<Route path = '/chat' element={<Chat/>}/> | ||
<Route path = '/setting' element={<Setting/>}/> | ||
<Route path = '/room/:id' element={<Room/>}/> | ||
</Routes> | ||
</> | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[ | ||
{ | ||
"id":0, | ||
"from":0, | ||
"to":3, | ||
"content":"짱구짱구", | ||
"date":"02:11" | ||
}, | ||
{ | ||
"id":1, | ||
"from":3, | ||
"to":0, | ||
"content":"스폰지밥", | ||
"date":"02:12" | ||
}, | ||
{ | ||
"id":2, | ||
"from":0, | ||
"to":1, | ||
"content":"난 짱구", | ||
"date":"02:14" | ||
}, | ||
{ | ||
"id":3, | ||
"from":2, | ||
"to":0, | ||
"content":"난 그로밋", | ||
"date":"02:16" | ||
}, | ||
{ | ||
"id":4, | ||
"from":5, | ||
"to":0, | ||
"content":"난 징징이", | ||
"date":"02:17" | ||
}, | ||
{ | ||
"id":5, | ||
"from":3, | ||
"to":0, | ||
"content":"스폰지밥밥", | ||
"date":"02:19" | ||
}, | ||
{ | ||
"id":6, | ||
"from":0, | ||
"to":3, | ||
"content":"짱구", | ||
"date":"02:20" | ||
}, | ||
{ | ||
"id":7, | ||
"from":4, | ||
"to":0, | ||
"content":"난 뚱이", | ||
"date":"02:21" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"id":0, | ||
"name":"짱구", | ||
"src":"img/짱구.png" | ||
}, | ||
{ | ||
"id":1, | ||
"name":"숀", | ||
"src":"img/a.jfif" | ||
}, | ||
{ | ||
"id":2, | ||
"name":"그로밋", | ||
"src":"img/b.jfif" | ||
}, | ||
{ | ||
"id":3, | ||
"name":"스폰지밥", | ||
"src":"img/c.jfif" | ||
}, | ||
{ | ||
"id":4, | ||
"name":"뚱이", | ||
"src":"img/d.jfif" | ||
}, | ||
{ | ||
"id":5, | ||
"name":"징징이", | ||
"src":"img/e.jfif" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import styled from "styled-components" | ||
|
||
const StyledBlock = styled.div` | ||
height: 700px; | ||
width: 80px; | ||
justify-content: center; | ||
align-items: center; | ||
flex-direction: column; | ||
background-color: #EAEAEA; | ||
border-radius:30px 0px 0px 30px; | ||
` | ||
|
||
const StyledList = styled.ul` | ||
display: flex; | ||
font-size: 30px; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
width: 0px; | ||
` | ||
|
||
const StyledLink = styled(Link)` | ||
text-decoration: none; | ||
text-align: center; | ||
width: 80px; | ||
`; | ||
|
||
const Header = () => { | ||
return ( | ||
<StyledBlock> | ||
<StyledList> | ||
<StyledLink to="/">👥</StyledLink> | ||
</StyledList> | ||
<StyledList> | ||
<StyledLink to="/chat">💬</StyledLink> | ||
</StyledList> | ||
<StyledList> | ||
<StyledLink to="/setting">⚙️</StyledLink> | ||
</StyledList> | ||
</StyledBlock> | ||
); | ||
}; | ||
|
||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import { RecoilRoot } from "recoil"; | ||
|
||
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); | ||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
<RecoilRoot> | ||
<BrowserRouter> | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode> | ||
</BrowserRouter> | ||
</RecoilRoot> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import Header from '../../components/Header'; | ||
import { userState } from '../../recoil/atom'; | ||
import {useRecoilState,useRecoilValue,} from 'recoil'; | ||
import styled from "styled-components" | ||
import ChatItem from './ChatItem'; | ||
|
||
const StyledBlock = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
border-radius: 30px; | ||
box-shadow: 5px 5px 10px #000; | ||
height: 700px; | ||
` | ||
const StyledContent = styled.div` | ||
height: 650px; | ||
width: 280px; | ||
justify-content: center; | ||
align-items: center; | ||
background-color: white; | ||
border-radius:0px 30px 30px 0px; | ||
margin: 20px; | ||
` | ||
|
||
const Chat = () => { | ||
|
||
const [user, setUser] = useRecoilState<Object[]>(userState); | ||
|
||
return ( | ||
<StyledBlock> | ||
<Header/> | ||
<StyledContent> | ||
채팅 | ||
{ | ||
user.map((u)=>( | ||
Object.values(u)[0] === 0 ? | ||
null | ||
: | ||
<ChatItem | ||
key={Object.values(u)[0]} | ||
id={Object.values(u)[0]} | ||
name={Object.values(u)[1]} | ||
src={Object.values(u)[2]} | ||
number={Object.values(user).length} | ||
/> | ||
)) | ||
} | ||
</StyledContent> | ||
</StyledBlock> | ||
); | ||
}; | ||
|
||
export default Chat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import styled from 'styled-components'; | ||
import { contentState} from '../../recoil/atom'; | ||
import {useRecoilState,useRecoilValue,} from 'recoil'; | ||
|
||
type ChatItemProps = { | ||
id: number; | ||
name: string; | ||
src: string; | ||
number: number; | ||
}; | ||
|
||
function ChatItem({id,name,src,number}:ChatItemProps){ | ||
const chatLink = '/room/' + id; | ||
|
||
const [content, setContent] = useRecoilState(contentState); | ||
const result = content.filter(c=>(c.to === id || c.from === id)); | ||
const lastContent = result[result.length-1]; | ||
|
||
return ( | ||
<StyledItem to={chatLink}> | ||
<StyledBox> | ||
<StyledImage width={"45px"} height={"45px"} src={src}/> | ||
<StyledFontBox> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 큰 styled component 안에 있는 요소들은 선택자로 관리하시면 굳이 새로운 styled component 만들지 않으셔도 돼요!.! |
||
{name} | ||
<StyledFont> | ||
{lastContent.content} | ||
</StyledFont> | ||
</StyledFontBox> | ||
<StyledDate> | ||
{lastContent.date} | ||
</StyledDate> | ||
</StyledBox> | ||
</StyledItem> | ||
); | ||
}; | ||
|
||
type StyledProps = { | ||
width: string; | ||
height: string; | ||
} | ||
|
||
const StyledDate = styled.div` | ||
float: right; | ||
object-align: top; | ||
color: gray; | ||
font-size: small; | ||
` | ||
|
||
const StyledFontBox = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width:200px; | ||
color: black; | ||
` | ||
const StyledFont = styled.div` | ||
font-size: small; | ||
color: gray; | ||
` | ||
const StyledBox = styled.div` | ||
display: flex; | ||
margin: 2px; | ||
heigth: 16px; | ||
width: 280px; | ||
align-items: center; | ||
&:hover{ | ||
background-color : #EEEEEE; | ||
} | ||
` | ||
|
||
const StyledImage = styled.img<StyledProps>` | ||
margin: 5px; | ||
border-radius: 15px; | ||
height: ${(props) => props.height} | ||
width: ${(props) => props.width} | ||
`; | ||
|
||
const StyledItem = styled(Link)` | ||
text-decoration: none; | ||
height: auto; | ||
width: 280px; | ||
` | ||
|
||
|
||
export default ChatItem; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
희수님이 코드리뷰 남겨주신대로 저랑 이 부분이 조금 다르군요..!
저는 기존 과제에서는 concat을 사용했고, 이번 과제에 roomId를 추가하면서 concat 사용이 힘들었는데, 희수님처럼 구현하면 제가 저번 과제 했던 것 처럼 concat을 쉽게 사용할 수 있었겠네요! 방법하나 알아갑니다 👍