diff --git a/client/public/styles.css b/client/public/styles.css index 7841adc..44cdad8 100644 --- a/client/public/styles.css +++ b/client/public/styles.css @@ -11,6 +11,11 @@ body{cursor: pointer;} .home{ min-height: 100vh; + width: 100%; +} + +.recommendation{ + display: none; } .activity-info{ @@ -123,3 +128,15 @@ body{cursor: pointer;} width: 30%; } } + +@media only screen and (min-width: 1200px){ + .recommendation{ + width: 30%; + float: left; + display: block; + } + .home{ + width: 70%; + float: left; + } +} \ No newline at end of file diff --git a/client/src/Components/home.component.js b/client/src/Components/home.component.js index b9e75a2..caf7290 100644 --- a/client/src/Components/home.component.js +++ b/client/src/Components/home.component.js @@ -28,6 +28,8 @@ const Home = () => { const [skip, setSkip] = useState(0); const [likeInfo, setLikeInfo] = useState({}); const [totalLikes, setTotalLikes] = useState({}); + const [newestUser, setNewestUser] = useState([]); + const [taggedList, setTaggedList] = useState([]); useEffect(() => { check_token().then(result => { @@ -119,6 +121,35 @@ const Home = () => { }) } } + + useEffect(() => { + Axios.get('http://localhost:5000/users/get_newest') + .then(res => { + (res.data).forEach((user) => { + setNewestUser(existing => [...existing, user]) + }) + }) + .catch(err => console.log(err)); + }, []) + + useEffect(() => { + if(userInfo){ + Axios.get(`http://localhost:5000/posts/get/tagged/${userInfo.username}`) + .then(res => { + (res.data).forEach((tag) => { + Axios.get("http://localhost:5000/users") + .then(users => { + (users.data).forEach((user) => { + if(user._id === tag.user){ + tag.username = user.username; + setTaggedList(ex => [...ex, tag]); + } + }) + }) + }) + }) + } + }, [userInfo]) const GeneratePost = ({post}) => { return