From: Dessalines Date: Thu, 19 Mar 2020 15:45:23 +0000 (-0400) Subject: Adding loading indicators to save and mark as read. #519 X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%22https:/hacktivis.me/%24%7Bsrc%7D?a=commitdiff_plain;h=47dd8acf54bf648fd374aac2fa611ca008919284;p=lemmy.git Adding loading indicators to save and mark as read. #519 --- diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index cbe58725..8809c5b7 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -56,6 +56,8 @@ interface CommentNodeState { upvotes: number; downvotes: number; borderColor: string; + readLoading: boolean; + saveLoading: boolean; } interface CommentNodeProps { @@ -97,6 +99,8 @@ export class CommentNode extends Component { borderColor: this.props.node.comment.depth ? colorList[this.props.node.comment.depth % colorList.length] : colorList[0], + readLoading: false, + saveLoading: false, }; constructor(props: any, context: any) { @@ -113,6 +117,8 @@ export class CommentNode extends Component { this.state.upvotes = nextProps.node.comment.upvotes; this.state.downvotes = nextProps.node.comment.downvotes; this.state.score = nextProps.node.comment.score; + this.state.readLoading = false; + this.state.saveLoading = false; this.setState(this.state); } @@ -255,12 +261,16 @@ export class CommentNode extends Component { : i18n.t('mark_as_read') } > - - - + {this.state.readLoading ? ( + this.loadingIcon + ) : ( + + + + )} )} @@ -308,25 +318,37 @@ export class CommentNode extends Component {
  • - - + - +
  • + {this.props.markable && this.linkBtn} {!this.state.showAdvanced ? (
  • )} -
  • - -
  • + {!this.props.markable && this.linkBtn}
  • -
  • - +
  • )} {this.mine && ( <> -
  • - +
  • -
  • - +
  • )} -
  • - +