1 import { Component, linkEvent } from 'inferno';
2 import { Link } from 'inferno-router';
4 CommentNode as CommentNodeI,
6 CommentForm as CommentFormI,
13 AddModToCommunityForm,
15 TransferCommunityForm,
20 } from '../interfaces';
21 import { WebSocketService, UserService } from '../services';
30 import moment from 'moment';
31 import { MomentTime } from './moment-time';
32 import { CommentForm } from './comment-form';
33 import { CommentNodes } from './comment-nodes';
34 import { UserListing } from './user-listing';
35 import { i18n } from '../i18next';
37 interface CommentNodeState {
40 showRemoveDialog: boolean;
42 showBanDialog: boolean;
46 showConfirmTransferSite: boolean;
47 showConfirmTransferCommunity: boolean;
48 showConfirmAppointAsMod: boolean;
49 showConfirmAppointAsAdmin: boolean;
52 showAdvanced: boolean;
62 interface CommentNodeProps {
68 showContext?: boolean;
69 moderators: Array<CommunityUser>;
70 admins: Array<UserView>;
71 // TODO is this necessary, can't I get it from the node itself?
72 postCreatorId?: number;
73 showCommunity?: boolean;
74 sort?: CommentSortType;
78 export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
79 private emptyState: CommentNodeState = {
82 showRemoveDialog: false,
87 banType: BanType.Community,
91 showConfirmTransferSite: false,
92 showConfirmTransferCommunity: false,
93 showConfirmAppointAsMod: false,
94 showConfirmAppointAsAdmin: false,
95 my_vote: this.props.node.comment.my_vote,
96 score: this.props.node.comment.score,
97 upvotes: this.props.node.comment.upvotes,
98 downvotes: this.props.node.comment.downvotes,
99 borderColor: this.props.node.comment.depth
100 ? colorList[this.props.node.comment.depth % colorList.length]
106 constructor(props: any, context: any) {
107 super(props, context);
109 this.state = this.emptyState;
110 this.handleReplyCancel = this.handleReplyCancel.bind(this);
111 this.handleCommentUpvote = this.handleCommentUpvote.bind(this);
112 this.handleCommentDownvote = this.handleCommentDownvote.bind(this);
115 componentWillReceiveProps(nextProps: CommentNodeProps) {
116 this.state.my_vote = nextProps.node.comment.my_vote;
117 this.state.upvotes = nextProps.node.comment.upvotes;
118 this.state.downvotes = nextProps.node.comment.downvotes;
119 this.state.score = nextProps.node.comment.score;
120 this.state.readLoading = false;
121 this.state.saveLoading = false;
122 this.setState(this.state);
126 let node = this.props.node;
129 className={`comment ${
130 node.comment.parent_id && !this.props.noIndent ? 'ml-1' : ''
134 id={`comment-${node.comment.id}`}
135 className={`details comment-node border-top border-light ${
136 this.isCommentNew ? 'mark' : ''
139 !this.props.noIndent &&
140 this.props.node.comment.parent_id &&
141 `border-left: 2px ${this.state.borderColor} solid !important`
146 !this.props.noIndent &&
147 this.props.node.comment.parent_id &&
151 <div class="d-flex flex-wrap align-items-center mb-1 mt-1 text-muted small">
155 name: node.comment.creator_name,
156 avatar: node.comment.creator_avatar,
157 id: node.comment.creator_id,
158 local: node.comment.creator_local,
159 actor_id: node.comment.creator_actor_id,
164 <div className="badge badge-light d-none d-sm-inline mr-2">
169 <div className="badge badge-light d-none d-sm-inline mr-2">
173 {this.isPostCreator && (
174 <div className="badge badge-light d-none d-sm-inline mr-2">
178 {(node.comment.banned_from_community || node.comment.banned) && (
179 <div className="badge badge-danger mr-2">
183 {this.props.showCommunity && (
185 <span class="mx-1">{i18n.t('to')}</span>
186 <Link class="mr-2" to={`/c/${node.comment.community_name}`}>
187 {node.comment.community_name}
192 className="mr-lg-4 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"
193 onClick={linkEvent(this, this.handleCommentCollapse)}
195 {this.state.collapsed ? (
196 <svg class="icon icon-inline">
197 <use xlinkHref="#icon-plus-square"></use>
200 <svg class="icon icon-inline">
201 <use xlinkHref="#icon-minus-square"></use>
206 className={`unselectable pointer ${this.scoreColor}`}
207 onClick={linkEvent(node, this.handleCommentUpvote)}
208 data-tippy-content={this.pointsTippy}
210 <svg class="icon icon-inline mr-1">
211 <use xlinkHref="#icon-zap"></use>
213 <span class="mr-1">{this.state.score}</span>
215 <span className="mr-1">•</span>
217 <MomentTime data={node.comment} />
220 {/* end of user row */}
221 {this.state.showEdit && (
225 onReplyCancel={this.handleReplyCancel}
226 disabled={this.props.locked}
229 {!this.state.showEdit && !this.state.collapsed && (
231 {this.state.viewSource ? (
232 <pre>{this.commentUnlessRemoved}</pre>
236 dangerouslySetInnerHTML={mdToHtml(
237 this.commentUnlessRemoved
241 <div class="d-flex justify-content-between justify-content-lg-start flex-wrap text-muted font-weight-bold">
242 {this.props.showContext && this.linkBtn}
243 {this.props.markable && (
245 class="btn btn-link btn-animate text-muted"
246 onClick={linkEvent(this, this.handleMarkRead)}
249 ? i18n.t('mark_as_unread')
250 : i18n.t('mark_as_read')
253 {this.state.readLoading ? (
257 class={`icon icon-inline ${
258 node.comment.read && 'text-success'
261 <use xlinkHref="#icon-check"></use>
266 {UserService.Instance.user && !this.props.viewOnly && (
269 className={`btn btn-link btn-animate ${
270 this.state.my_vote == 1 ? 'text-info' : 'text-muted'
272 onClick={linkEvent(node, this.handleCommentUpvote)}
273 data-tippy-content={i18n.t('upvote')}
275 <svg class="icon icon-inline">
276 <use xlinkHref="#icon-arrow-up"></use>
278 {this.state.upvotes !== this.state.score && (
279 <span class="ml-1">{this.state.upvotes}</span>
282 {WebSocketService.Instance.site.enable_downvotes && (
284 className={`btn btn-link btn-animate ${
285 this.state.my_vote == -1
289 onClick={linkEvent(node, this.handleCommentDownvote)}
290 data-tippy-content={i18n.t('downvote')}
292 <svg class="icon icon-inline">
293 <use xlinkHref="#icon-arrow-down"></use>
295 {this.state.upvotes !== this.state.score && (
296 <span class="ml-1">{this.state.downvotes}</span>
301 class="btn btn-link btn-animate text-muted"
302 onClick={linkEvent(this, this.handleSaveCommentClick)}
304 node.comment.saved ? i18n.t('unsave') : i18n.t('save')
307 {this.state.saveLoading ? (
311 class={`icon icon-inline ${
312 node.comment.saved && 'text-warning'
315 <use xlinkHref="#icon-star"></use>
320 class="btn btn-link btn-animate text-muted"
321 onClick={linkEvent(this, this.handleReplyClick)}
322 data-tippy-content={i18n.t('reply')}
324 <svg class="icon icon-inline">
325 <use xlinkHref="#icon-reply1"></use>
328 {!this.state.showAdvanced ? (
330 className="btn btn-link btn-animate text-muted"
331 onClick={linkEvent(this, this.handleShowAdvanced)}
332 data-tippy-content={i18n.t('more')}
334 <svg class="icon icon-inline">
335 <use xlinkHref="#icon-more-vertical"></use>
340 {!this.myComment && (
341 <button class="btn btn-link btn-animate">
344 to={`/create_private_message?recipient_id=${node.comment.creator_id}`}
345 title={i18n.t('message').toLowerCase()}
348 <use xlinkHref="#icon-mail"></use>
353 {!this.props.showContext && this.linkBtn}
355 className="btn btn-link btn-animate text-muted"
356 onClick={linkEvent(this, this.handleViewSource)}
357 data-tippy-content={i18n.t('view_source')}
360 class={`icon icon-inline ${
361 this.state.viewSource && 'text-success'
364 <use xlinkHref="#icon-file-text"></use>
370 class="btn btn-link btn-animate text-muted"
371 onClick={linkEvent(this, this.handleEditClick)}
372 data-tippy-content={i18n.t('edit')}
374 <svg class="icon icon-inline">
375 <use xlinkHref="#icon-edit"></use>
379 class="btn btn-link btn-animate text-muted"
382 this.handleDeleteClick
385 !node.comment.deleted
391 class={`icon icon-inline ${
392 node.comment.deleted && 'text-danger'
395 <use xlinkHref="#icon-trash"></use>
400 {/* Admins and mods can remove comments */}
401 {(this.canMod || this.canAdmin) && (
403 {!node.comment.removed ? (
405 class="btn btn-link btn-animate text-muted"
408 this.handleModRemoveShow
415 class="btn btn-link btn-animate text-muted"
418 this.handleModRemoveSubmit
426 {/* Mods can ban from community, and appoint as mods to community */}
430 (!node.comment.banned_from_community ? (
432 class="btn btn-link btn-animate text-muted"
435 this.handleModBanFromCommunityShow
442 class="btn btn-link btn-animate text-muted"
445 this.handleModBanFromCommunitySubmit
451 {!node.comment.banned_from_community &&
452 (!this.state.showConfirmAppointAsMod ? (
454 class="btn btn-link btn-animate text-muted"
457 this.handleShowConfirmAppointAsMod
461 ? i18n.t('remove_as_mod')
462 : i18n.t('appoint_as_mod')}
466 <button class="btn btn-link btn-animate text-muted">
467 {i18n.t('are_you_sure')}
470 class="btn btn-link btn-animate text-muted"
473 this.handleAddModToCommunity
479 class="btn btn-link btn-animate text-muted"
482 this.handleCancelConfirmAppointAsMod
491 {/* Community creators and admins can transfer community to another mod */}
492 {(this.amCommunityCreator || this.canAdmin) &&
494 (!this.state.showConfirmTransferCommunity ? (
496 class="btn btn-link btn-animate text-muted"
499 this.handleShowConfirmTransferCommunity
502 {i18n.t('transfer_community')}
506 <button class="btn btn-link btn-animate text-muted">
507 {i18n.t('are_you_sure')}
510 class="btn btn-link btn-animate text-muted"
513 this.handleTransferCommunity
519 class="btn btn-link btn-animate text-muted"
523 .handleCancelShowConfirmTransferCommunity
530 {/* Admins can ban from all, and appoint other admins */}
534 (!node.comment.banned ? (
536 class="btn btn-link btn-animate text-muted"
539 this.handleModBanShow
542 {i18n.t('ban_from_site')}
546 class="btn btn-link btn-animate text-muted"
549 this.handleModBanSubmit
552 {i18n.t('unban_from_site')}
555 {!node.comment.banned &&
556 (!this.state.showConfirmAppointAsAdmin ? (
558 class="btn btn-link btn-animate text-muted"
561 this.handleShowConfirmAppointAsAdmin
565 ? i18n.t('remove_as_admin')
566 : i18n.t('appoint_as_admin')}
570 <button class="btn btn-link btn-animate text-muted">
571 {i18n.t('are_you_sure')}
574 class="btn btn-link btn-animate text-muted"
583 class="btn btn-link btn-animate text-muted"
586 this.handleCancelConfirmAppointAsAdmin
595 {/* Site Creator can transfer to another admin */}
596 {this.amSiteCreator &&
598 (!this.state.showConfirmTransferSite ? (
600 class="btn btn-link btn-animate text-muted"
603 this.handleShowConfirmTransferSite
606 {i18n.t('transfer_site')}
610 <button class="btn btn-link btn-animate text-muted">
611 {i18n.t('are_you_sure')}
614 class="btn btn-link btn-animate text-muted"
617 this.handleTransferSite
623 class="btn btn-link btn-animate text-muted"
626 this.handleCancelShowConfirmTransferSite
638 {/* end of button group */}
643 {/* end of details */}
644 {this.state.showRemoveDialog && (
647 onSubmit={linkEvent(this, this.handleModRemoveSubmit)}
651 class="form-control mr-2"
652 placeholder={i18n.t('reason')}
653 value={this.state.removeReason}
654 onInput={linkEvent(this, this.handleModRemoveReasonChange)}
656 <button type="submit" class="btn btn-secondary">
657 {i18n.t('remove_comment')}
661 {this.state.showBanDialog && (
662 <form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}>
663 <div class="form-group row">
664 <label class="col-form-label">{i18n.t('reason')}</label>
667 class="form-control mr-2"
668 placeholder={i18n.t('reason')}
669 value={this.state.banReason}
670 onInput={linkEvent(this, this.handleModBanReasonChange)}
673 {/* TODO hold off on expires until later */}
674 {/* <div class="form-group row"> */}
675 {/* <label class="col-form-label">Expires</label> */}
676 {/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.banExpires} onInput={linkEvent(this, this.handleModBanExpiresChange)} /> */}
678 <div class="form-group row">
679 <button type="submit" class="btn btn-secondary">
680 {i18n.t('ban')} {node.comment.creator_name}
685 {this.state.showReply && (
688 onReplyCancel={this.handleReplyCancel}
689 disabled={this.props.locked}
692 {node.children && !this.state.collapsed && (
694 nodes={node.children}
695 locked={this.props.locked}
696 moderators={this.props.moderators}
697 admins={this.props.admins}
698 postCreatorId={this.props.postCreatorId}
699 sort={this.props.sort}
700 sortType={this.props.sortType}
703 {/* A collapsed clearfix */}
704 {this.state.collapsed && <div class="row col-12"></div>}
710 let node = this.props.node;
712 <button className="btn btn-link btn-animate">
715 to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
717 this.props.showContext ? i18n.t('show_context') : i18n.t('link')
720 <svg class="icon icon-inline">
721 <use xlinkHref="#icon-link"></use>
730 <svg class="icon icon-spinner spin">
731 <use xlinkHref="#icon-spinner"></use>
736 get myComment(): boolean {
738 UserService.Instance.user &&
739 this.props.node.comment.creator_id == UserService.Instance.user.id
743 get isMod(): boolean {
745 this.props.moderators &&
747 this.props.moderators.map(m => m.user_id),
748 this.props.node.comment.creator_id
753 get isAdmin(): boolean {
757 this.props.admins.map(a => a.id),
758 this.props.node.comment.creator_id
763 get isPostCreator(): boolean {
764 return this.props.node.comment.creator_id == this.props.postCreatorId;
767 get canMod(): boolean {
768 if (this.props.admins && this.props.moderators) {
769 let adminsThenMods = this.props.admins
771 .concat(this.props.moderators.map(m => m.user_id));
774 UserService.Instance.user,
776 this.props.node.comment.creator_id
783 get canAdmin(): boolean {
787 UserService.Instance.user,
788 this.props.admins.map(a => a.id),
789 this.props.node.comment.creator_id
794 get amCommunityCreator(): boolean {
796 this.props.moderators &&
797 UserService.Instance.user &&
798 this.props.node.comment.creator_id != UserService.Instance.user.id &&
799 UserService.Instance.user.id == this.props.moderators[0].user_id
803 get amSiteCreator(): boolean {
806 UserService.Instance.user &&
807 this.props.node.comment.creator_id != UserService.Instance.user.id &&
808 UserService.Instance.user.id == this.props.admins[0].id
812 get commentUnlessRemoved(): string {
813 let node = this.props.node;
814 return node.comment.removed
815 ? `*${i18n.t('removed')}*`
816 : node.comment.deleted
817 ? `*${i18n.t('deleted')}*`
818 : node.comment.content;
821 handleReplyClick(i: CommentNode) {
822 i.state.showReply = true;
826 handleEditClick(i: CommentNode) {
827 i.state.showEdit = true;
831 handleDeleteClick(i: CommentNode) {
832 let deleteForm: CommentFormI = {
833 content: i.props.node.comment.content,
834 edit_id: i.props.node.comment.id,
835 creator_id: i.props.node.comment.creator_id,
836 post_id: i.props.node.comment.post_id,
837 parent_id: i.props.node.comment.parent_id,
838 deleted: !i.props.node.comment.deleted,
841 WebSocketService.Instance.editComment(deleteForm);
844 handleSaveCommentClick(i: CommentNode) {
846 i.props.node.comment.saved == undefined
848 : !i.props.node.comment.saved;
849 let form: SaveCommentForm = {
850 comment_id: i.props.node.comment.id,
854 WebSocketService.Instance.saveComment(form);
856 i.state.saveLoading = true;
857 i.setState(this.state);
860 handleReplyCancel() {
861 this.state.showReply = false;
862 this.state.showEdit = false;
863 this.setState(this.state);
866 handleCommentUpvote(i: CommentNodeI) {
867 let new_vote = this.state.my_vote == 1 ? 0 : 1;
869 if (this.state.my_vote == 1) {
871 this.state.upvotes--;
872 } else if (this.state.my_vote == -1) {
873 this.state.downvotes--;
874 this.state.upvotes++;
875 this.state.score += 2;
877 this.state.upvotes++;
881 this.state.my_vote = new_vote;
883 let form: CommentLikeForm = {
884 comment_id: i.comment.id,
885 post_id: i.comment.post_id,
886 score: this.state.my_vote,
889 WebSocketService.Instance.likeComment(form);
890 this.setState(this.state);
894 handleCommentDownvote(i: CommentNodeI) {
895 let new_vote = this.state.my_vote == -1 ? 0 : -1;
897 if (this.state.my_vote == 1) {
898 this.state.score -= 2;
899 this.state.upvotes--;
900 this.state.downvotes++;
901 } else if (this.state.my_vote == -1) {
902 this.state.downvotes--;
905 this.state.downvotes++;
909 this.state.my_vote = new_vote;
911 let form: CommentLikeForm = {
912 comment_id: i.comment.id,
913 post_id: i.comment.post_id,
914 score: this.state.my_vote,
917 WebSocketService.Instance.likeComment(form);
918 this.setState(this.state);
922 handleModRemoveShow(i: CommentNode) {
923 i.state.showRemoveDialog = true;
927 handleModRemoveReasonChange(i: CommentNode, event: any) {
928 i.state.removeReason = event.target.value;
932 handleModRemoveSubmit(i: CommentNode) {
933 event.preventDefault();
934 let form: CommentFormI = {
935 content: i.props.node.comment.content,
936 edit_id: i.props.node.comment.id,
937 creator_id: i.props.node.comment.creator_id,
938 post_id: i.props.node.comment.post_id,
939 parent_id: i.props.node.comment.parent_id,
940 removed: !i.props.node.comment.removed,
941 reason: i.state.removeReason,
944 WebSocketService.Instance.editComment(form);
946 i.state.showRemoveDialog = false;
950 handleMarkRead(i: CommentNode) {
951 // if it has a user_mention_id field, then its a mention
952 if (i.props.node.comment.user_mention_id) {
953 let form: EditUserMentionForm = {
954 user_mention_id: i.props.node.comment.user_mention_id,
955 read: !i.props.node.comment.read,
957 WebSocketService.Instance.editUserMention(form);
959 let form: CommentFormI = {
960 content: i.props.node.comment.content,
961 edit_id: i.props.node.comment.id,
962 creator_id: i.props.node.comment.creator_id,
963 post_id: i.props.node.comment.post_id,
964 parent_id: i.props.node.comment.parent_id,
965 read: !i.props.node.comment.read,
968 WebSocketService.Instance.editComment(form);
971 i.state.readLoading = true;
972 i.setState(this.state);
975 handleModBanFromCommunityShow(i: CommentNode) {
976 i.state.showBanDialog = !i.state.showBanDialog;
977 i.state.banType = BanType.Community;
981 handleModBanShow(i: CommentNode) {
982 i.state.showBanDialog = !i.state.showBanDialog;
983 i.state.banType = BanType.Site;
987 handleModBanReasonChange(i: CommentNode, event: any) {
988 i.state.banReason = event.target.value;
992 handleModBanExpiresChange(i: CommentNode, event: any) {
993 i.state.banExpires = event.target.value;
997 handleModBanFromCommunitySubmit(i: CommentNode) {
998 i.state.banType = BanType.Community;
1000 i.handleModBanBothSubmit(i);
1003 handleModBanSubmit(i: CommentNode) {
1004 i.state.banType = BanType.Site;
1005 i.setState(i.state);
1006 i.handleModBanBothSubmit(i);
1009 handleModBanBothSubmit(i: CommentNode) {
1010 event.preventDefault();
1012 if (i.state.banType == BanType.Community) {
1013 let form: BanFromCommunityForm = {
1014 user_id: i.props.node.comment.creator_id,
1015 community_id: i.props.node.comment.community_id,
1016 ban: !i.props.node.comment.banned_from_community,
1017 reason: i.state.banReason,
1018 expires: getUnixTime(i.state.banExpires),
1020 WebSocketService.Instance.banFromCommunity(form);
1022 let form: BanUserForm = {
1023 user_id: i.props.node.comment.creator_id,
1024 ban: !i.props.node.comment.banned,
1025 reason: i.state.banReason,
1026 expires: getUnixTime(i.state.banExpires),
1028 WebSocketService.Instance.banUser(form);
1031 i.state.showBanDialog = false;
1032 i.setState(i.state);
1035 handleShowConfirmAppointAsMod(i: CommentNode) {
1036 i.state.showConfirmAppointAsMod = true;
1037 i.setState(i.state);
1040 handleCancelConfirmAppointAsMod(i: CommentNode) {
1041 i.state.showConfirmAppointAsMod = false;
1042 i.setState(i.state);
1045 handleAddModToCommunity(i: CommentNode) {
1046 let form: AddModToCommunityForm = {
1047 user_id: i.props.node.comment.creator_id,
1048 community_id: i.props.node.comment.community_id,
1051 WebSocketService.Instance.addModToCommunity(form);
1052 i.state.showConfirmAppointAsMod = false;
1053 i.setState(i.state);
1056 handleShowConfirmAppointAsAdmin(i: CommentNode) {
1057 i.state.showConfirmAppointAsAdmin = true;
1058 i.setState(i.state);
1061 handleCancelConfirmAppointAsAdmin(i: CommentNode) {
1062 i.state.showConfirmAppointAsAdmin = false;
1063 i.setState(i.state);
1066 handleAddAdmin(i: CommentNode) {
1067 let form: AddAdminForm = {
1068 user_id: i.props.node.comment.creator_id,
1071 WebSocketService.Instance.addAdmin(form);
1072 i.state.showConfirmAppointAsAdmin = false;
1073 i.setState(i.state);
1076 handleShowConfirmTransferCommunity(i: CommentNode) {
1077 i.state.showConfirmTransferCommunity = true;
1078 i.setState(i.state);
1081 handleCancelShowConfirmTransferCommunity(i: CommentNode) {
1082 i.state.showConfirmTransferCommunity = false;
1083 i.setState(i.state);
1086 handleTransferCommunity(i: CommentNode) {
1087 let form: TransferCommunityForm = {
1088 community_id: i.props.node.comment.community_id,
1089 user_id: i.props.node.comment.creator_id,
1091 WebSocketService.Instance.transferCommunity(form);
1092 i.state.showConfirmTransferCommunity = false;
1093 i.setState(i.state);
1096 handleShowConfirmTransferSite(i: CommentNode) {
1097 i.state.showConfirmTransferSite = true;
1098 i.setState(i.state);
1101 handleCancelShowConfirmTransferSite(i: CommentNode) {
1102 i.state.showConfirmTransferSite = false;
1103 i.setState(i.state);
1106 handleTransferSite(i: CommentNode) {
1107 let form: TransferSiteForm = {
1108 user_id: i.props.node.comment.creator_id,
1110 WebSocketService.Instance.transferSite(form);
1111 i.state.showConfirmTransferSite = false;
1112 i.setState(i.state);
1115 get isCommentNew(): boolean {
1116 let now = moment.utc().subtract(10, 'minutes');
1117 let then = moment.utc(this.props.node.comment.published);
1118 return now.isBefore(then);
1121 handleCommentCollapse(i: CommentNode) {
1122 i.state.collapsed = !i.state.collapsed;
1123 i.setState(i.state);
1126 handleViewSource(i: CommentNode) {
1127 i.state.viewSource = !i.state.viewSource;
1128 i.setState(i.state);
1131 handleShowAdvanced(i: CommentNode) {
1132 i.state.showAdvanced = !i.state.showAdvanced;
1133 i.setState(i.state);
1138 if (this.state.my_vote == 1) {
1140 } else if (this.state.my_vote == -1) {
1141 return 'text-danger';
1143 return 'text-muted';
1147 get pointsTippy(): string {
1148 let points = i18n.t('number_of_points', {
1149 count: this.state.score,
1152 let upvotes = i18n.t('number_of_upvotes', {
1153 count: this.state.upvotes,
1156 let downvotes = i18n.t('number_of_downvotes', {
1157 count: this.state.downvotes,
1160 return `${points} • ${upvotes} • ${downvotes}`;