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

Add interestPage #150

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
0d0d04f
test
100dongwoo Aug 31, 2020
88238f8
Update Defaultpage
100dongwoo Aug 31, 2020
3536986
test
100dongwoo Aug 31, 2020
d749500
Update_Defaulpage
100dongwoo Aug 31, 2020
457040d
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Aug 31, 2020
cf6df98
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Aug 31, 2020
20f1995
test
100dongwoo Aug 31, 2020
473b1fb
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Aug 31, 2020
db8306d
Add_MYpage"
100dongwoo Aug 31, 2020
ca0365e
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 1, 2020
698ed75
Add Mypage
100dongwoo Sep 1, 2020
d0b8363
Add introduction mypage
100dongwoo Sep 1, 2020
b053b27
AddSubscribe
100dongwoo Sep 3, 2020
c0376e8
Update Mypage
100dongwoo Sep 3, 2020
b42c6e6
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 3, 2020
89ffdb2
Add count Follower
100dongwoo Sep 3, 2020
26ac924
Add follower count:
100dongwoo Sep 3, 2020
6c14d7f
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 4, 2020
242d484
Update Avatar
100dongwoo Sep 4, 2020
79c8756
Update FollowBtn
100dongwoo Sep 4, 2020
2f6e955
ReUpdate
100dongwoo Sep 4, 2020
b01bf04
Add like_inter
100dongwoo Sep 4, 2020
3e2023a
Update
100dongwoo Sep 4, 2020
365a7f5
Add Comment Avartar
100dongwoo Sep 4, 2020
2a948a5
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 6, 2020
9307e3d
Update Mypage
100dongwoo Sep 7, 2020
893ec6c
Add Pictrue UPLOAD
100dongwoo Sep 7, 2020
4fb52a6
Add FollowePAGE
100dongwoo Sep 7, 2020
e0a9adc
update
100dongwoo Sep 7, 2020
2f81adf
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 7, 2020
3e59420
Add friendpage
100dongwoo Sep 7, 2020
2f5d016
Add fried Follwer
100dongwoo Sep 7, 2020
01cab2a
Update
100dongwoo Sep 7, 2020
b1c2f6a
test
100dongwoo Sep 7, 2020
dc509ed
Reupdate
100dongwoo Sep 7, 2020
bfa63f7
Update_mypage_followpage
100dongwoo Sep 8, 2020
055732d
test
100dongwoo Sep 8, 2020
8971fd8
Update FriendPage
100dongwoo Sep 8, 2020
1c54dd0
test
100dongwoo Sep 8, 2020
a7b479c
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 8, 2020
d057ed3
Update
100dongwoo Sep 8, 2020
fe2531f
test
100dongwoo Sep 9, 2020
729c009
Remove Error
100dongwoo Sep 9, 2020
283d073
Remove Error
100dongwoo Sep 9, 2020
0efb46a
Remove Error
100dongwoo Sep 10, 2020
52f3ab6
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 10, 2020
a5293ef
Add interest page
100dongwoo Sep 10, 2020
9ce37cd
Merge branch 'develop' of https://github.com/dnd-mentee-3rd/dnd-mente…
100dongwoo Sep 10, 2020
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 src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Mypage from '../routes/Mypage';
import FollowPage from '../routes/FollowPage';
import { useStateValue } from '../StateProvider';
import FriendsPage from '../routes/FrinedsPage';
import InterestPick from './PickBox/InterestPick';

const GlobalStyle = createGlobalStyle`
body {
Expand All @@ -33,12 +34,12 @@ function App() {
<Route exact path="/" component={Home} />
<Route exact path="/area" component={Area} />
<Route exact path="/follow" component={FollowPage} />
<Route exact path="/interest" component={InterestPick} />
<Route
exact
path="/FriendsPage/:friendid"
component={FriendsPage}
/>

{user && user.uid && (
<Route
exact
Expand Down
123 changes: 123 additions & 0 deletions src/components/PickBox/InterestPick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import React, { useEffect, useState } from 'react';
import db from '../../firebase';
import { useStateValue } from '../../StateProvider';
import InfiniteScroll from 'react-infinite-scroll-component';
import Loader from '../MainArea/Loader';
import Picture from '../Mypage/Picture';
import styled from 'styled-components';
const MarginContainer = styled.div`
max-width: 1440px;
margin: auto;
margin-top: 40px;
`;
const TitleText = styled.div`
margin: auto 0;
font-family: Noto Sans KR;
font-style: normal;
font-weight: 500;
font-size: 60px;
line-height: 87px;
align-items: center;
color: #ffffff;
text-align: center;
margin-bottom: 20px;
`;

const Container = styled.div`
width: 1440px;
margin: 36px 0;
columns: 3;
column-gap: 40px;
`;
function InterestPick(props) {
const [hasMore, setHasMore] = useState(true);
const [interstCount, setInterstCount] = useState(0); //신기해요 수
const [interested, setInterested] = useState(false); //신기해요 상태
const [posts, setPosts] = useState([]);
useEffect(() => {
//포스트 별좋아요 수를 나타낸다
let newPostList = [];
db.collection('posts').onSnapshot((snapshot) => {
snapshot.docs.map((postInfo) => {
db.collection('Like_Inter')
.where('postId', '==', postInfo.id)
.where('type', '==', 'Interest')
.get()
.then((doc) => {
if (doc.empty) {
newPostList.push({
id: postInfo.id,
post: postInfo.data(),
interestCount: 0,
});
setInterstCount(0);
} else {
newPostList.push({
id: postInfo.id,
post: postInfo.data(),
interestCount: doc.size,
});
}
newPostList.sort(function (a, b) {
if (a.interestCount > b.interestCount) {
return -1;
}
if (a.interestCount < b.interestCount) {
return 1;
}
// a must be equal to b
return 0;
});
setPosts([...newPostList]);
});
});
});
}, [interested]);
return (
<MarginContainer>
<InfiniteScroll
dataLength={posts.length}
next={() => setHasMore(false)}
hasMore={hasMore}
loader={<Loader />}
>
<div style={{ display: 'flex' }}>
<TitleText> 신기한 PICK</TitleText>
<div style={{ marginLeft: 20 }}>
<img
src="/images/Detail/Interesting.png"
alt="Interesting"
/>
</div>
</div>
<Container>
{posts.map(({ post, id }) => (
<Picture
Type="Inter"
uid={post.uid}
id={id}
key={id}
advertising={post.advertising}
area={post.area}
avatar={post.avatar}
heart={post.heart}
imageUrl={post.imageUrl}
latitude={post.latitude}
longitude={post.longitude}
mood={post.mood}
novelty={post.novelty}
rating={post.rating}
review={post.review}
timestamp={post.timestamp}
title={post.title}
username={post.username}
address={post.address}
/>
))}
</Container>
</InfiniteScroll>
</MarginContainer>
);
}

export default InterestPick;
3 changes: 3 additions & 0 deletions src/components/PickBox/PickBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ function PickBox() {
background:
'linear-gradient(151.01deg, #61BFDA -17.86%, #4366E9 105.09%)',
}}
onClick={() => {
history.push('/interest');
}}
>
<InterestingBox>
<img src="/images/Interesting.png" alt="Interesting" />
Expand Down