Skip to content
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주차] 강나연 미션 제출합니다. #15

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
442d3fa
:ribbon: style: Apply GlobalStyle
kongnayeon Sep 27, 2022
a15694b
:ribbon: style: Add Header
kongnayeon Sep 27, 2022
5b9a82c
:bookmark_tabs: docs: Create json files
kongnayeon Sep 27, 2022
c22c791
:ribbon: style: Add MessageInput
kongnayeon Sep 27, 2022
025acf5
:ribbon: style: Style Bubble
kongnayeon Sep 28, 2022
4a646fa
:speech_balloon: feat: Add useInput
kongnayeon Sep 28, 2022
20d5fe3
:speech_balloon: feat: Set recoil(...)
kongnayeon Sep 29, 2022
667fc8c
:speech_balloon: feat: Add toggle
kongnayeon Sep 29, 2022
7fda096
:speech_balloon: feat: Scroll to bottom
kongnayeon Sep 29, 2022
d8ee77c
:pill: fix: Fix toggle
kongnayeon Sep 29, 2022
2cead51
:adhesive_bandage: chore: Delete console.log
kongnayeon Sep 29, 2022
e3c1169
:hammer: refactor: Use Selector
kongnayeon Sep 29, 2022
e833cbd
:ribbon: style: Style Scrollbar
kongnayeon Sep 29, 2022
e78886b
:speech_balloon: feat: Show profile image
kongnayeon Sep 30, 2022
57411d3
:speech_balloon: feat: Show send time
kongnayeon Sep 30, 2022
7852973
:adhesive_bandage: chore: Delete any
kongnayeon Sep 30, 2022
152975f
:speech_balloon: feat: Show user name
kongnayeon Sep 30, 2022
630e352
:ribbon: style: Set favicon
kongnayeon Sep 30, 2022
086103b
:ribbon: style: Change font
kongnayeon Sep 30, 2022
a16cb81
:hammer: refactor: Add HeaderProps interface
kongnayeon Oct 1, 2022
617f488
:pill: fix: Add word-break
kongnayeon Oct 1, 2022
1e29bc6
:pill: fix: Prevent re-rendering by using React.memo
kongnayeon Oct 1, 2022
5efa867
:speech_balloon: feat: Set router
kongnayeon Oct 6, 2022
4efa71e
:speech_balloon: feat: Add Navigation
kongnayeon Oct 6, 2022
917cbb3
:speech_balloon: feat: Add data
kongnayeon Oct 12, 2022
ff894a1
:speech_balloon: feat: Set FriendsPage
kongnayeon Oct 28, 2022
fd1ad06
:speech_balloon: feat: Set ChatListPage
kongnayeon Oct 29, 2022
c086320
:speech_balloon: feat: Set SettingPage
kongnayeon Oct 29, 2022
0d69c58
:speech_balloon: feat: Add My Profile
kongnayeon Oct 30, 2022
80542b2
:hammer: refactor:separate UserList
kongnayeon Oct 31, 2022
36d555a
:ribbon: style: Style FriendsPage and ChatListPage
kongnayeon Oct 31, 2022
f6d0376
:ribbon: style: Style scrollbar
kongnayeon Oct 31, 2022
3b7802c
:adhesive_bandage: chore: Edit ChatMessage
kongnayeon Nov 1, 2022
cae7c7d
:speech_balloon: feat: Add SearchList
kongnayeon Nov 2, 2022
0f382c0
:pill: fix: Fix SearchInput
kongnayeon Nov 2, 2022
033cacd
:speech_balloon: feat: Add ToggleSwitch
kongnayeon Nov 2, 2022
e77c472
:adhesive_bandage: chore: Set accountState when entering chat room
kongnayeon Nov 2, 2022
4934a82
:bookmark_tabs: docs: Change ChatMessage.json
kongnayeon Nov 3, 2022
f0a7fb7
:pill: fix: Fix ChatList sorting
kongnayeon Nov 3, 2022
9c55ab7
:pill: fix: Fix roomId initialization when refreshing
kongnayeon Nov 3, 2022
130d574
:speech_balloon: feat: Set MainPage
kongnayeon Nov 3, 2022
dc80158
:speech_balloon: feat: Add clicked icon
kongnayeon Nov 3, 2022
8cda05d
:speech_balloon: feat: Add modal
kongnayeon Nov 3, 2022
daa2002
:bookmark_tabs: docs: Clean up directory
kongnayeon Nov 3, 2022
7a6107d
:adhesive_bandage: chore: Remove console.log
kongnayeon Nov 3, 2022
71f2c4e
:adhesive_bandage: chore: Set config core.ignorecase false
kongnayeon Nov 3, 2022
f0555d0
Fix vercel deployment error
kongnayeon Nov 3, 2022
5133d49
Fix vercel error 2
kongnayeon Nov 3, 2022
0dbc446
Delete src/components directory
kongnayeon Nov 3, 2022
519f342
Add files via upload
kongnayeon Nov 3, 2022
a9539cf
Add files via upload
kongnayeon Nov 3, 2022
3f145bf
:pill: fix: Refresh when clicking on the main page
kongnayeon Nov 3, 2022
f3a3728
:ribbon: style: Remove text decoration
kongnayeon Nov 3, 2022
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: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
.env.development.local
.env.test.local
.env.production.local
.env

npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn-error.log*
585 changes: 585 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,21 @@
"@types/node": "^16.11.60",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@types/react-redux": "^7.1.24",
"@types/react-router-dom": "^5.3.3",
"@types/styled-components": "^5.1.26",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-kakao-login": "^2.1.1",
"react-redux": "^8.0.4",
"react-router-dom": "^6.4.3",
"react-scripts": "5.0.1",
"recoil": "^0.7.5",
"redux": "^4.2.0",
"styled-components": "^5.3.5",
"styled-normalize": "^8.0.7",
"typesafe-actions": "^5.1.0",
"typescript": "^4.8.3",
"web-vitals": "^2.1.4"
},
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/images/0.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/images/1.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/images/2.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/images/3.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/images/4.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/images/5.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/images/6.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/images/Messages-clicked.png
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/images/calls-clicked.png
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/images/calls.png
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/images/mainPage.png
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/images/messages-clicked.png
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/images/messages.png
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/images/pc-phone.png
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/images/settings-clicked.png
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/images/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 5 additions & 30 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,14 @@
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>NewJeans</title>
<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>
<script>
Kakao.init("6055d144e11ddb690f9aae8aaff34bfc");
</script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file removed public/logo192.png
Binary file not shown.
Binary file removed public/logo512.png
Binary file not shown.
46 changes: 45 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
import styled from "styled-components";
import ChatRoom from "./pages/ChatRoom";
import ChatListPage from "./pages/ChatListPage";
import GlobalStyle from "./styles/GlobalStyle";
import { RecoilRoot } from "recoil";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import FriendsPage from "./pages/FriendsPage";
import SettingPage from "./pages/SettingPage";
import MainPage from "./pages/MainPage";

function App() {
return <div>화이팅!!</div>;
return (
<BrowserRouter>
<RecoilRoot>
<GlobalStyle />
<Container>
<Routes>
<Route path="/" element={<MainPage />} />
<Route path="/friends" element={<FriendsPage />} />
<Route path="/chats" element={<ChatListPage />} />
<Route path="/room/:roomid" element={<ChatRoom />} />
<Route path="/settings" element={<SettingPage />} />
</Routes>
</Container>
</RecoilRoot>
</BrowserRouter>
);
}

// ㄱ-
// const PhoneImage = styled.img`
// width: 26rem;
// z-index: 1;
// position: absolute;
// top: 7%;
// left: 37%;
// `;

const Container = styled.div`
width: 23rem;
height: 45rem;
background: rgba(255, 255, 255, 0.8);
border-radius: 20px;
box-shadow: 0px 0px 20px rgb(125, 123, 125);
display: flex;
flex-direction: column;
`;

export default App;
131 changes: 131 additions & 0 deletions src/assets/chatMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"chatrooms": [
{
"roomid": 0,
"user": 1,
Comment on lines +4 to +5
Copy link

Choose a reason for hiding this comment

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

아 이런 식으로 하면 단체톡방을 만든다든지 할 때 편할 것 같아요!! 배워갑니다

Copy link
Member Author

Choose a reason for hiding this comment

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

사실 단체 톡방도 만들어 보고 싶어서 이렇게 만든 건데 시간 나면 추가로 구현해 봐야겠어욥 ㅎ.ㅎ...!!

"chats": [
{
"userid": 1,
"chatid": 1664469417344,
"myAccount": false,
"chat": "내가 만든 쿠키 🍪",
"time": "10월 3일"
},
{
"userid": 0,
"chatid": 1664469417345,
"myAccount": true,
"chat": "너를 위해 구웠지 😽",
"time": "10월 3일"
}
]
},
{
"roomid": 1,
"user": 2,
"chats": [
{
"userid": 2,
"chatid": 1664469417346,
"myAccount": false,
"chat": "느린 한마디보다 조용함이 더 좋아",
"time": "10월 4일"
},
{
"userid": 0,
"chatid": 1664469417347,
"myAccount": true,
"chat": "기다리고 있지만 매일 이런 건 아냐",
"time": "10월 4일"
}
]
},
{
"roomid": 2,
"user": 3,
"chats": [
{
"userid": 0,
"chatid": 1664469417349,
"myAccount": true,
"chat": "에이 티 티 이 엔 티 아이 온~",
"time": "10월 28일"
},
{
"userid": 3,
"chatid": 1664469417348,
"myAccount": false,
"chat": "Attention is what I want~",
"time": "10월 28일"
}
]
},
{
"roomid": 3,
"user": 4,
"chats": [
{
"userid": 4,
"chatid": 1664469417350,
"myAccount": false,
"chat": "내 지난 날들은 눈 뜨면 잊는 꿈",
"time": "10월 29일"
},
{
"userid": 0,
"chatid": 1664469417351,
"myAccount": true,
"chat": "Hype boy 너만 원해~",
"time": "10월 29일"
},
{
"userid": 4,
"chatid": 1664469417352,
"myAccount": false,
"chat": "Hype boy 내가 전해~",
"time": "10월 29일"
}
]
},
{
"roomid": 4,
"user": 5,
"chats": [
{
"userid": 0,
"chatid": 1664469417360,
"myAccount": true,
"chat": "아니 얘네 왜 노래가 4곡밖에 없냐 ㄱ-",
"time": "11월 1일"
},
{
"userid": 5,
"chatid": 1664469417354,
"myAccount": false,
"chat": "ㅜ.ㅜ",
"time": "11월 1일"
}
]
},
{
"roomid": 5,
"user": 6,
"chats": [
{
"userid": 6,
"chatid": 1664469417370,
"myAccount": false,
"chat": "뉴진스 컴백",
"time": "11월 2일"
},
{
"userid": 0,
"chatid": 1664469417371,
"myAccount": true,
"chat": "언제야~~?",
"time": "11월 2일"
}
]
}
]
}
39 changes: 39 additions & 0 deletions src/assets/userInformation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"users": [
{
"userid": 0,
"name": "NaYeon 💭",
"statusMessage": "\"Hell\"O World!..."
},
{
"userid": 1,
"name": "NewJeans 👖",
"statusMessage": "🍉🥭🥥🥑🍓"
},
{
"userid": 2,
"name": "HaeRin 😽",
"statusMessage": "😎👖"
},
{
"userid": 3,
"name": "HANNI 🐰",
"statusMessage": "🦭 hi hi~~~~"
},
{
"userid": 4,
"name": "Danielle 🍀",
"statusMessage": "Hi 🌻 Hi!🌻"
},
{
"userid": 5,
"name": "MINJI 🍒",
"statusMessage": "🧡"
},
{
"userid": 6,
"name": "HYEIN 🍼",
"statusMessage": "let..s be friennnnnnnd👽👽👽👽"
}
]
}
72 changes: 72 additions & 0 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { useRecoilState, useRecoilValue } from "recoil";
import styled from "styled-components";
import { HeaderProps } from "../interfaces/interface";
import { accountState, SearchState, userSelector } from "../store/atom";
import { useNavigate } from "react-router-dom";

const Header = ({
leftChild,
rightChild,
textChild,
isFriendsPage,
}: HeaderProps) => {
const navigate = useNavigate();
const [userAccount, setUserAccount] = useRecoilState(accountState);
const filteredUser = useRecoilValue(userSelector);
const [isSearching, setIsSearching] = useRecoilState(SearchState);

const headText = textChild
? textChild
: userAccount
? filteredUser!.name
: "NaYeon 💭";

const handleHeadTextClick = () => {
setUserAccount(!userAccount);
};

const handleRightChildClick = () => {
const toggledSearch = !isSearching;
isFriendsPage ? setIsSearching(toggledSearch) : setIsSearching(false);
};

return (
<HeaderWrapper>
<HeaderButton onClick={() => navigate(-1)}>{leftChild}</HeaderButton>
<HeadText onClick={handleHeadTextClick}>{headText}</HeadText>
<HeaderButton onClick={handleRightChildClick}>{rightChild}</HeaderButton>
</HeaderWrapper>
);
};

const HeaderWrapper = styled.header`
display: flex;
align-items: center;
`;

const HeaderButton = styled.button`
width: 40px;
height: 40px;
background: #fff;
border-radius: 100%;
border: 1px solid #000000;
text-decoration: none;
color: #000;
font-size: 1.5rem;
padding: 0.5rem;
line-height: 15px;
text-align: center;
cursor: pointer;
transition: 0.5s;
`;

const HeadText = styled.span`
width: 80%;
font-size: 1.3rem;
font-weight: bold;
padding-left: 1rem;
cursor: pointer;
transition: 0.5s;
`;

export default Header;
Loading