From 7141bf9000e51d20baa9a789d7033e752ccd5a4a Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Tue, 3 Dec 2019 19:15:23 -0500 Subject: [PATCH] changed color if user is following the same topic --- twistter-frontend/src/pages/otherUser.js | 33 +++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/twistter-frontend/src/pages/otherUser.js b/twistter-frontend/src/pages/otherUser.js index d173936..a7b4935 100644 --- a/twistter-frontend/src/pages/otherUser.js +++ b/twistter-frontend/src/pages/otherUser.js @@ -21,6 +21,7 @@ import Typography from "@material-ui/core/Typography"; import AddCircle from "@material-ui/icons/AddCircle"; import TextField from "@material-ui/core/TextField"; import VerifiedIcon from "@material-ui/icons/CheckSharp"; +import DoneIcon from "@material-ui/icons/Done"; // component import "../App.css"; @@ -75,7 +76,8 @@ class user extends Component { topics: null, user: null, following: null, - posts: null + posts: null, + myTopics: null }; } @@ -128,7 +130,10 @@ class user extends Component { .get("/user") .then(res => { this.setState({ - following: res.data.credentials.following.includes(this.state.profile) + following: res.data.credentials.following.includes( + this.state.profile + ), + myTopics: res.data.credentials.followedTopics }); }) .catch(err => console.log(err)); @@ -171,9 +176,31 @@ class user extends Component { ) : (

loading username...

); + + console.log(this.state.topics); + console.log(this.state.myTopics); let topicsMarkup = this.state.topics ? ( this.state.topics.map( - topic => // console.log({ topic }.topic.id) + topic => + this.state.myTopics ? ( + this.state.myTopics.includes(topic) ? ( + } + /> + ) : ( + + ) + ) : ( +

+ ) + // topic => // console.log({ topic }.topic.id) ) ) : (

 no topic yet