mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 02:08:47 +00:00
formatted feed and userline
This commit is contained in:
parent
e8110d643f
commit
c34f06f130
@ -105,12 +105,11 @@ exports.quoteWithPost = (req, res) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Post has already been quoted.");
|
|
||||||
return res.status(400).json({ error: 'Post has already been quoted.' });
|
return res.status(400).json({ error: 'Post has already been quoted.' });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
return res.status(500).json({error: 'Something is wrong'});
|
return res.status(500).json({error: err});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -151,7 +150,6 @@ exports.quoteWithoutPost = (req, res) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Post has already been quoted.");
|
|
||||||
return res.status(400).json({ error: 'Post has already been quoted.' });
|
return res.status(400).json({ error: 'Post has already been quoted.' });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -32,6 +32,9 @@ class Home extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
posts: res.data
|
posts: res.data
|
||||||
})
|
})
|
||||||
|
this.setState({posts: (this.state.posts).sort((a,b) =>
|
||||||
|
-a.createdAt.localeCompare(b.createdAt))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
}
|
}
|
||||||
@ -51,14 +54,15 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h7"><b>{post.userHandle}</b></Typography>
|
<Typography variant="h7"><b>{post.userHandle}</b></Typography>
|
||||||
<Typography variant="body2" color={"textSecondary"}>{post.createdAt}</Typography>
|
<Typography variant="body2" color={"textSecondary"}>{post.createdAt.substring(0,10) +
|
||||||
|
" " + post.createdAt.substring(11,19)}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body1"><b>{post.microBlogTitle}</b></Typography>
|
<Typography variant="body1"><b>{post.microBlogTitle}</b></Typography>
|
||||||
<Typography variant="body2">{post.body}</Typography>
|
<Typography variant="body2">{post.body}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body2"><b>Topics:</b> {post.microBlogTopics}</Typography>
|
<Typography variant="body2"><b>Topics:</b> {post.microBlogTopics.join("," + " ")}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount} Comments {post.commentCount}</Typography>
|
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount}</Typography>
|
||||||
<Like microBlog = {post.postId}></Like>
|
<Like microBlog = {post.postId}></Like>
|
||||||
<Quote microblog = {post.postId}></Quote>
|
<Quote microblog = {post.postId}></Quote>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|||||||
@ -95,6 +95,9 @@ class user extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
posts: res.data
|
posts: res.data
|
||||||
})
|
})
|
||||||
|
this.setState({posts: (this.state.posts).sort((a,b) =>
|
||||||
|
-a.createdAt.localeCompare(b.createdAt))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
}
|
}
|
||||||
@ -124,7 +127,9 @@ class user extends Component {
|
|||||||
|
|
||||||
let imageMarkup = this.state.imageUrl ? (<img src={this.state.imageUrl} height="150" width="150" />) :
|
let imageMarkup = this.state.imageUrl ? (<img src={this.state.imageUrl} height="150" width="150" />) :
|
||||||
(<img src={noImage} height="150" width="150"/>);
|
(<img src={noImage} height="150" width="150"/>);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let postMarkup = this.state.posts ? (
|
let postMarkup = this.state.posts ? (
|
||||||
this.state.posts.map(post =>
|
this.state.posts.map(post =>
|
||||||
<Card>
|
<Card>
|
||||||
@ -136,14 +141,15 @@ class user extends Component {
|
|||||||
}
|
}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="h7"><b>{post.userHandle}</b></Typography>
|
<Typography variant="h7"><b>{post.userHandle}</b></Typography>
|
||||||
<Typography variant="body2" color={"textSecondary"}>{post.createdAt}</Typography>
|
<Typography variant="body2" color={"textSecondary"}>{post.createdAt.substring(0,10) +
|
||||||
|
" " + post.createdAt.substring(11,19)}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body1"><b>{post.microBlogTitle}</b></Typography>
|
<Typography variant="body1"><b>{post.microBlogTitle}</b></Typography>
|
||||||
<Typography variant="body2">{post.body}</Typography>
|
<Typography variant="body2">{post.body}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body2"><b>Topics:</b> {post.microBlogTopics}</Typography>
|
<Typography variant="body2"><b>Topics:</b> {post.microBlogTopics.join("," + " ")}</Typography>
|
||||||
<br />
|
<br />
|
||||||
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount} Comments {post.commentCount}</Typography>
|
<Typography variant="body2" color={"textSecondary"}>Likes {post.likeCount}</Typography>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user