diff --git a/twistter-frontend/src/pages/user.js b/twistter-frontend/src/pages/user.js index d48279b..a91dffe 100644 --- a/twistter-frontend/src/pages/user.js +++ b/twistter-frontend/src/pages/user.js @@ -23,179 +23,179 @@ import noImage from '../images/no-img.png'; import Paper from '@material-ui/core/Paper'; const styles = { - button: { - positon: 'relative', - float: 'left', - marginLeft: 30, - marginTop: 15 - }, - paper: { - // marginLeft: "10%", - // marginRight: "10%" - } + button: { + positon: 'relative', + float: 'left', + marginLeft: 30, + marginTop: 15 + }, + paper: { + // marginLeft: "10%", + // marginRight: "10%" + } }; const MyChip = styled(Chip)({ - margin: 2, - color: 'primary' + margin: 2, + color: 'primary' }); class user extends Component { - state = { - profile: null, - imageUrl: null, - topics: null, - newTopic: null - }; + state = { + profile: null, + imageUrl: null, + topics: null, + newTopic: null + }; - handleDelete = (topic) => { - alert(`Delete topic: ${topic}!`); - }; + handleDelete = (topic) => { + alert(`Delete topic: ${topic}!`); + }; - handleAddCircle = () => { - axios - .post('/putTopic', { - topic: this.state.newTopic - }) - .then(function() { - location.reload(); - }) - .catch(function(err) { - console.log(err); - }); - }; + handleAddCircle = () => { + axios + .post('/putTopic', { + topic: this.state.newTopic + }) + .then(function() { + location.reload(); + }) + .catch(function(err) { + console.log(err); + }); + }; - handleChange(event) { - this.setState({ - newTopic: event.target.value - }); - } + handleChange(event) { + this.setState({ + newTopic: event.target.value + }); + } - componentDidMount() { - axios - .get('/user') - .then((res) => { - this.setState({ - profile: res.data.credentials.handle, - imageUrl: res.data.credentials.imageUrl - }); - }) - .catch((err) => console.log(err)); - axios - .get('/getAllTopics') - .then((res) => { - this.setState({ - topics: res.data - }); - }) - .catch((err) => console.log(err)); - } - render() { - const { classes } = this.props; - let profileMarkup = this.state.profile ? ( -

- {this.state.profile} -

- ) : ( -

loading username...

- ); + componentDidMount() { + axios + .get('/user') + .then((res) => { + this.setState({ + profile: res.data.credentials.handle, + imageUrl: res.data.credentials.imageUrl + }); + }) + .catch((err) => console.log(err)); + axios + .get('/getAllTopics') + .then((res) => { + this.setState({ + topics: res.data + }); + }) + .catch((err) => console.log(err)); + } + render() { + const { classes } = this.props; + let profileMarkup = this.state.profile ? ( +

+ {this.state.profile} +

+ ) : ( +

loading username...

+ ); - let topicsMarkup = this.state.topics ? ( - this.state.topics.map((topic) => ( - this.handleDelete(topic)} - /> - )) - ) : ( -

loading topics...

- ); + let topicsMarkup = this.state.topics ? ( + this.state.topics.map((topic) => ( + this.handleDelete(topic)} + /> + )) + ) : ( +

loading topics...

+ ); - let imageMarkup = this.state.imageUrl ? ( - - ) : ( - - ); + let imageMarkup = this.state.imageUrl ? ( + + ) : ( + + ); - // FIX: This needs to check if user's profile page being displayed - // is the same as the user who is logged in - // Can't check for that right now, because this page is always - // showing the logged in users profile, instead of retreiving the - // profile based on the URL entered - let editButtonMarkup = true ? ( - - ) : null; + // FIX: This needs to check if user's profile page being displayed + // is the same as the user who is logged in + // Can't check for that right now, because this page is always + // showing the logged in users profile, instead of retreiving the + // profile based on the URL entered + let editButtonMarkup = true ? ( + + ) : null; - return ( - // - // - //

Posts go here

- //
- // - // {editButtonMarkup} - // {imageMarkup} - // {profileMarkup} - // {topicsMarkup} - // this.handleChange(event)} - // /> - // - // - //
-
- {/* */} + return ( + // + // + //

Posts go here

+ //
+ // + // {editButtonMarkup} + // {imageMarkup} + // {profileMarkup} + // {topicsMarkup} + // this.handleChange(event)} + // /> + // + // + //
+
+ {/* */} - - - {editButtonMarkup} - - - - - {imageMarkup} - {profileMarkup} - {topicsMarkup} - this.handleChange(event)} - /> - - - -

posts here

-
-
-
- - - {/*
*/} + + + {editButtonMarkup} + + + + + {imageMarkup} + {profileMarkup} + {topicsMarkup} + this.handleChange(event)} + /> + + + +

posts here

+
+
+
+ + + {/* */} - {/* + {/*

Posts go here

*/} -
- ); - } +
+ ); + } } // export default user;