<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>
WebSocketService.Instance.likeComment(form);
this.setState(this.state);
+ setupTippy();
}
handleCommentDownvote(i: CommentNodeI) {
WebSocketService.Instance.likeComment(form);
this.setState(this.state);
+ setupTippy();
}
handleModRemoveShow(i: CommentNode) {
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}`;
+ }
}
</button>
<div
class={`unselectable pointer font-weight-bold text-muted px-1`}
- data-tippy-content={i18n.t('number_of_points', {
- count: this.state.score,
- })}
+ data-tippy-content={this.pointsTippy}
>
{this.state.score}
</div>
<>
<span
class="unselectable pointer mr-2"
- data-tippy-content={i18n.t('number_of_points', {
- count: this.state.score,
- })}
+ data-tippy-content={this.pointsTippy}
>
<li className="list-inline-item">
<span className="text-muted">
WebSocketService.Instance.likePost(form);
i.setState(i.state);
+ setupTippy();
}
handlePostDisLike(i: PostListing) {
WebSocketService.Instance.likePost(form);
i.setState(i.state);
+ setupTippy();
}
handleEditClick(i: PostListing) {
i.setState(i.state);
setupTippy();
}
+
+ 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}`;
+ }
}
import {
UserOperation,
Comment,
- CommentNode,
+ CommentNode as CommentNodeI,
Post,
PrivateMessage,
User,
export function commentsToFlatNodes(
comments: Array<Comment>
-): Array<CommentNode> {
- let nodes: Array<CommentNode> = [];
+): Array<CommentNodeI> {
+ let nodes: Array<CommentNodeI> = [];
for (let comment of comments) {
nodes.push({ comment: comment });
}
return nodes;
}
-export function commentSort(tree: Array<CommentNode>, sort: CommentSortType) {
+export function commentSort(tree: Array<CommentNodeI>, sort: CommentSortType) {
// First, put removed and deleted comments at the bottom, then do your other sorts
if (sort == CommentSortType.Top) {
tree.sort(
}
}
-export function commentSortSortType(tree: Array<CommentNode>, sort: SortType) {
+export function commentSortSortType(tree: Array<CommentNodeI>, sort: SortType) {
commentSort(tree, convertCommentSortType(sort));
}
"downvotes_disabled": "Downvotes disabled",
"enable_downvotes": "Enable Downvotes",
"upvote": "Upvote",
+ "number_of_upvotes": "{{count}} Upvote",
+ "number_of_upvotes_plural": "{{count}} Upvotes",
"downvote": "Downvote",
+ "number_of_downvotes": "{{count}} Downvote",
+ "number_of_downvotes_plural": "{{count}} Downvotes",
"open_registration": "Open Registration",
"registration_closed": "Registration closed",
"enable_nsfw": "Enable NSFW",