Converted tabs back to spaces

This commit is contained in:
Clayton Wilson 2019-10-29 23:02:36 -04:00
parent 3d875e2bde
commit 3c31db9bf5

View File

@ -23,179 +23,179 @@ import noImage from '../images/no-img.png';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
const styles = { const styles = {
button: { button: {
positon: 'relative', positon: 'relative',
float: 'left', float: 'left',
marginLeft: 30, marginLeft: 30,
marginTop: 15 marginTop: 15
}, },
paper: { paper: {
// marginLeft: "10%", // marginLeft: "10%",
// marginRight: "10%" // marginRight: "10%"
} }
}; };
const MyChip = styled(Chip)({ const MyChip = styled(Chip)({
margin: 2, margin: 2,
color: 'primary' color: 'primary'
}); });
class user extends Component { class user extends Component {
state = { state = {
profile: null, profile: null,
imageUrl: null, imageUrl: null,
topics: null, topics: null,
newTopic: null newTopic: null
}; };
handleDelete = (topic) => { handleDelete = (topic) => {
alert(`Delete topic: ${topic}!`); alert(`Delete topic: ${topic}!`);
}; };
handleAddCircle = () => { handleAddCircle = () => {
axios axios
.post('/putTopic', { .post('/putTopic', {
topic: this.state.newTopic topic: this.state.newTopic
}) })
.then(function() { .then(function() {
location.reload(); location.reload();
}) })
.catch(function(err) { .catch(function(err) {
console.log(err); console.log(err);
}); });
}; };
handleChange(event) { handleChange(event) {
this.setState({ this.setState({
newTopic: event.target.value newTopic: event.target.value
}); });
} }
componentDidMount() { componentDidMount() {
axios axios
.get('/user') .get('/user')
.then((res) => { .then((res) => {
this.setState({ this.setState({
profile: res.data.credentials.handle, profile: res.data.credentials.handle,
imageUrl: res.data.credentials.imageUrl imageUrl: res.data.credentials.imageUrl
}); });
}) })
.catch((err) => console.log(err)); .catch((err) => console.log(err));
axios axios
.get('/getAllTopics') .get('/getAllTopics')
.then((res) => { .then((res) => {
this.setState({ this.setState({
topics: res.data topics: res.data
}); });
}) })
.catch((err) => console.log(err)); .catch((err) => console.log(err));
} }
render() { render() {
const { classes } = this.props; const { classes } = this.props;
let profileMarkup = this.state.profile ? ( let profileMarkup = this.state.profile ? (
<p> <p>
<Typography variant="h5">{this.state.profile}</Typography> <Typography variant="h5">{this.state.profile}</Typography>
</p> </p>
) : ( ) : (
<p>loading username...</p> <p>loading username...</p>
); );
let topicsMarkup = this.state.topics ? ( let topicsMarkup = this.state.topics ? (
this.state.topics.map((topic) => ( this.state.topics.map((topic) => (
<MyChip <MyChip
label={{ topic }.topic.topic} label={{ topic }.topic.topic}
key={{ topic }.topic.topicId} key={{ topic }.topic.topicId}
onDelete={(topic) => this.handleDelete(topic)} onDelete={(topic) => this.handleDelete(topic)}
/> />
)) ))
) : ( ) : (
<p> loading topics...</p> <p> loading topics...</p>
); );
let imageMarkup = this.state.imageUrl ? ( let imageMarkup = this.state.imageUrl ? (
<img src={this.state.imageUrl} height="250" width="250" /> <img src={this.state.imageUrl} height="250" width="250" />
) : ( ) : (
<img src={noImage} /> <img src={noImage} />
); );
// FIX: This needs to check if user's profile page being displayed // FIX: This needs to check if user's profile page being displayed
// is the same as the user who is logged in // is the same as the user who is logged in
// Can't check for that right now, because this page is always // Can't check for that right now, because this page is always
// showing the logged in users profile, instead of retreiving the // showing the logged in users profile, instead of retreiving the
// profile based on the URL entered // profile based on the URL entered
let editButtonMarkup = true ? ( let editButtonMarkup = true ? (
<Button className={classes.button} variant="outlined" color="primary"> <Button className={classes.button} variant="outlined" color="primary">
Edit Profile Edit Profile
</Button> </Button>
) : null; ) : null;
return ( return (
// <Grid container spacing={16}> // <Grid container spacing={16}>
// <Grid item sm={8} xs={12}> // <Grid item sm={8} xs={12}>
// <p>Posts go here</p> // <p>Posts go here</p>
// </Grid> // </Grid>
// <Grid item sm={4} xs={12}> // <Grid item sm={4} xs={12}>
// {editButtonMarkup} // {editButtonMarkup}
// {imageMarkup} // {imageMarkup}
// {profileMarkup} // {profileMarkup}
// {topicsMarkup} // {topicsMarkup}
// <TextField // <TextField
// id="newTopic" // id="newTopic"
// label="new topic" // label="new topic"
// defaultValue="" // defaultValue=""
// margin="normal" // margin="normal"
// variant="outlined" // variant="outlined"
// value={this.state.newTopic} // value={this.state.newTopic}
// onChange={ (event) => this.handleChange(event)} // onChange={ (event) => this.handleChange(event)}
// /> // />
// <AddCircle // <AddCircle
// color="primary" // color="primary"
// clickable // clickable
// onClick={this.handleAddCircle} // onClick={this.handleAddCircle}
// /> // />
// </Grid> // </Grid>
// </Grid> // </Grid>
<div> <div>
{/* <Paper className={classes.paper}> */} {/* <Paper className={classes.paper}> */}
<Grid container> <Grid container>
<Grid item sm> <Grid item sm>
{editButtonMarkup} {editButtonMarkup}
</Grid> </Grid>
<Grid item sm> <Grid item sm>
<Grid container direction="column"> <Grid container direction="column">
<Grid item sm> <Grid item sm>
{imageMarkup} {imageMarkup}
{profileMarkup} {profileMarkup}
{topicsMarkup} {topicsMarkup}
<TextField <TextField
id="newTopic" id="newTopic"
label="new topic" label="new topic"
defaultValue="" defaultValue=""
margin="normal" margin="normal"
variant="outlined" variant="outlined"
value={this.state.newTopic} value={this.state.newTopic}
onChange={(event) => this.handleChange(event)} onChange={(event) => this.handleChange(event)}
/> />
<AddCircle color="primary" clickable onClick={this.handleAddCircle} /> <AddCircle color="primary" clickable onClick={this.handleAddCircle} />
</Grid> </Grid>
<Grid item sm> <Grid item sm>
<p>posts here</p> <p>posts here</p>
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
<Grid item sm /> <Grid item sm />
</Grid> </Grid>
{/* </Paper> */} {/* </Paper> */}
{/* <GridList> {/* <GridList>
<GridListTile key="subheader"> <GridListTile key="subheader">
<p>Posts go here</p> <p>Posts go here</p>
</GridListTile> </GridListTile>
</GridList> */} </GridList> */}
</div> </div>
); );
} }
} }
// export default user; // export default user;