diff options
Diffstat (limited to 'ui/src/components/post.tsx')
-rw-r--r-- | ui/src/components/post.tsx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index 1e334b1d..931ced2d 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -29,7 +29,7 @@ import { WebSocketJsonResponse, } from '../interfaces'; import { WebSocketService, UserService } from '../services'; -import { wsJsonToRes, hotRank } from '../utils'; +import { wsJsonToRes, hotRank, toast } from '../utils'; import { PostListing } from './post-listing'; import { PostListings } from './post-listings'; import { Sidebar } from './sidebar'; @@ -179,7 +179,7 @@ export class Post extends Component<any, PostState> { postId={this.state.post.id} disabled={this.state.post.locked} /> - {this.sortRadios()} + {this.state.comments.length > 0 && this.sortRadios()} {this.commentsTree()} </div> <div class="col-12 col-sm-12 col-md-4"> @@ -346,7 +346,7 @@ export class Post extends Component<any, PostState> { console.log(msg); let res = wsJsonToRes(msg); if (res.error) { - alert(i18n.t(res.error)); + toast(i18n.t(msg.error), 'danger'); return; } else if (res.op == UserOperation.GetPost) { let data = res.data as GetPostResponse; @@ -401,7 +401,11 @@ export class Post extends Component<any, PostState> { found.score = data.comment.score; found.upvotes = data.comment.upvotes; found.downvotes = data.comment.downvotes; - if (data.comment.my_vote !== null) found.my_vote = data.comment.my_vote; + if (data.comment.my_vote !== null) { + found.my_vote = data.comment.my_vote; + found.upvoteLoading = false; + found.downvoteLoading = false; + } this.setState(this.state); } else if (res.op == UserOperation.CreatePostLike) { let data = res.data as CreatePostLikeResponse; |