mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 18:28:47 +00:00
Merge branch 'master' of https://github.com/ClaytonWWilson/CS307-Team24
This commit is contained in:
commit
6335690046
BIN
twistter-frontend/src/images/original.png
Normal file
BIN
twistter-frontend/src/images/original.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 48 KiB |
@ -11,7 +11,7 @@ import CardContent from '@material-ui/core/CardContent';
|
|||||||
import Chip from '@material-ui/core/Chip';
|
import Chip from '@material-ui/core/Chip';
|
||||||
import Paper from '@material-ui/core/Paper';
|
import Paper from '@material-ui/core/Paper';
|
||||||
import Typography from "@material-ui/core/Typography";
|
import Typography from "@material-ui/core/Typography";
|
||||||
|
import AddCircle from '@material-ui/icons/AddCircle';
|
||||||
|
|
||||||
// component
|
// component
|
||||||
import Profile from '../components/profile/Profile';
|
import Profile from '../components/profile/Profile';
|
||||||
@ -28,29 +28,63 @@ const PostCard = styled(Card)({
|
|||||||
padding: '0 30px',
|
padding: '0 30px',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const MyChip = styled(Chip)({
|
||||||
|
margin: 2,
|
||||||
|
color: 'primary'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const styles = (theme) => ({
|
||||||
|
...theme
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleDelete = () => {
|
||||||
|
alert("Delete this topic!");
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAddCircle = () => {
|
||||||
|
alert("Add topic");
|
||||||
|
}
|
||||||
|
|
||||||
class user extends Component {
|
class user extends Component {
|
||||||
state = {
|
state = {
|
||||||
profile: null
|
profile: null,
|
||||||
|
topics: null
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
axios
|
axios
|
||||||
.get("/user")
|
.get("/user")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res.data.userData.credentials.handle);
|
console.log(res.data.credentials.handle);
|
||||||
this.setState({
|
this.setState({
|
||||||
profile: res.data.userData.credentials.handle
|
profile: res.data.credentials.handle
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
|
axios
|
||||||
|
.get("/getAllTopics")
|
||||||
|
.then(res => {
|
||||||
|
console.log(res.data[1]);
|
||||||
|
this.setState({
|
||||||
|
topics: res.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(err => console.log(err));
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
|
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>loading profile...</p>
|
</p>) : (<p>loading username...</p>);
|
||||||
|
|
||||||
|
|
||||||
|
let topicsMarkup = this.state.topics ? (
|
||||||
|
this.state.topics.map(topic => <MyChip
|
||||||
|
label={{topic}.topic.topic}
|
||||||
|
onDelete={handleDelete}/>)
|
||||||
|
) : (<p> loading topics...</p>);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={16}>
|
<Grid container spacing={16}>
|
||||||
@ -60,6 +94,12 @@ class user extends Component {
|
|||||||
<Grid item sm={4} xs={12}>
|
<Grid item sm={4} xs={12}>
|
||||||
<img src={noImage}/>
|
<img src={noImage}/>
|
||||||
{profileMarkup}
|
{profileMarkup}
|
||||||
|
{topicsMarkup}
|
||||||
|
<MyChip
|
||||||
|
icon={<AddCircle />}
|
||||||
|
clickable
|
||||||
|
onClick={handleAddCircle}
|
||||||
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -50,7 +50,13 @@ export default {
|
|||||||
marginBottom: 20
|
marginBottom: 20
|
||||||
},
|
},
|
||||||
paper: {
|
paper: {
|
||||||
padding: 20
|
padding: 10,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexWrap: 'wrap'
|
||||||
|
},
|
||||||
|
chip: {
|
||||||
|
margin: 0.5,
|
||||||
},
|
},
|
||||||
profile: {
|
profile: {
|
||||||
'& .image-wrapper': {
|
'& .image-wrapper': {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user