summaryrefslogtreecommitdiffstats
path: root/ui/src/components/comment-node.tsx
diff options
context:
space:
mode:
authorDessalines <tyhou13@gmx.com>2020-03-11 19:10:10 -0400
committerDessalines <tyhou13@gmx.com>2020-03-11 19:10:10 -0400
commitf36aa1f40dd92a2dfe4f3e92bfc26a67d08ae2be (patch)
tree2c2d0b645d9a1b9c3312b69f6beaed41ff2e0d56 /ui/src/components/comment-node.tsx
parent4fbf55d79e355608c75aa8218cd7f487c58fa04d (diff)
Show full scores on hover for posts and comments. Fixes #592
Diffstat (limited to 'ui/src/components/comment-node.tsx')
-rw-r--r--ui/src/components/comment-node.tsx22
1 files changed, 19 insertions, 3 deletions
diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx
index 524367bc..32e43fdc 100644
--- a/ui/src/components/comment-node.tsx
+++ b/ui/src/components/comment-node.tsx
@@ -198,9 +198,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
<span
className={`unselectable pointer ${this.scoreColor}`}
onClick={linkEvent(node, this.handleCommentUpvote)}
- data-tippy-content={i18n.t('number_of_points', {
- count: this.state.score,
- })}
+ data-tippy-content={this.pointsTippy}
>
<svg class="icon icon-inline mr-1">
<use xlinkHref="#icon-zap"></use>
@@ -916,6 +914,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.likeComment(form);
this.setState(this.state);
+ setupTippy();
}
handleCommentDownvote(i: CommentNodeI) {
@@ -943,6 +942,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
WebSocketService.Instance.likeComment(form);
this.setState(this.state);
+ setupTippy();
}
handleModRemoveShow(i: CommentNode) {
@@ -1166,4 +1166,20 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
return 'text-muted';
}
}
+
+ get pointsTippy(): string {
+ let points = i18n.t('number_of_points', {
+ count: this.state.score,
+ });
+
+ let upvotes = i18n.t('number_of_upvotes', {
+ count: this.state.upvotes,
+ });
+
+ let downvotes = i18n.t('number_of_downvotes', {
+ count: this.state.downvotes,
+ });
+
+ return `${points} • ${upvotes} • ${downvotes}`;
+ }
}