diff --git a/server/src/actions/comment.rs b/server/src/actions/comment.rs index ceedf29..93e808a 100644 --- a/server/src/actions/comment.rs +++ b/server/src/actions/comment.rs @@ -103,6 +103,7 @@ impl Comment { pub fn from_post(conn: &PgConnection, post: &Post) -> Result, Error> { use schema::community::dsl::*; Comment::belonging_to(post) + .order_by(comment::published.desc()) .load::(conn) } } diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index 193da3d..5e383c0 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -131,7 +131,7 @@ export class Post extends Component { commentsTree() { let nodes = this.buildCommentsTree(); return ( -
+
); @@ -147,7 +147,7 @@ export class Post extends Component { } else if (op == UserOperation.GetPost) { let res: PostResponse = msg; this.state.post = res.post; - this.state.comments = res.comments.reverse(); + this.state.comments = res.comments; this.setState(this.state); } else if (op == UserOperation.CreateComment) { let res: CommentResponse = msg; @@ -177,10 +177,11 @@ export class CommentNodes extends Component {this.props.nodes.map(node => -
-
-
-
+
+
+
+
20
+
    @@ -189,7 +190,7 @@ export class CommentNodes extends Component
  • ( - 1300 + +1300 | -29 ) points diff --git a/ui/src/main.css b/ui/src/main.css index cb2d53d..30fbc8d 100644 --- a/ui/src/main.css +++ b/ui/src/main.css @@ -1,3 +1,14 @@ + + + .pointer { cursor: pointer; } + +.upvote:hover { + color: var(--info); +} + +.downvote:hover { + color: var(--danger); +}