From: Dessalines Date: Fri, 25 Sep 2020 21:16:41 +0000 (-0500) Subject: Improving action / comment bar. Fixes #37 X-Git-Url: http://these/git/?a=commitdiff_plain;h=107869a96b8d8d989461f7974684d381d257a566;p=lemmy-ui.git Improving action / comment bar. Fixes #37 - Added abbreviations for relative fromNow times in english. --- diff --git a/src/shared/components/comment-node.tsx b/src/shared/components/comment-node.tsx index 19c1bdc..030515c 100644 --- a/src/shared/components/comment-node.tsx +++ b/src/shared/components/comment-node.tsx @@ -208,31 +208,20 @@ export class CommentNode extends Component { )} {/* This is an expanding spacer for mobile */}
- + {this.state.score} + • @@ -295,7 +284,7 @@ export class CommentNode extends Component { data-tippy-content={i18n.t('upvote')} > - + {this.state.upvotes !== this.state.score && ( {this.state.upvotes} @@ -312,7 +301,7 @@ export class CommentNode extends Component { data-tippy-content={i18n.t('downvote')} > - + {this.state.upvotes !== this.state.score && ( {this.state.downvotes} diff --git a/src/shared/components/community.tsx b/src/shared/components/community.tsx index 2fae830..299456b 100644 --- a/src/shared/components/community.tsx +++ b/src/shared/components/community.tsx @@ -459,7 +459,8 @@ export class Community extends Component { res.op == UserOperation.DeletePost || res.op == UserOperation.RemovePost || res.op == UserOperation.LockPost || - res.op == UserOperation.StickyPost + res.op == UserOperation.StickyPost || + res.op == UserOperation.SavePost ) { let data = res.data as PostResponse; editPostFindRes(data, this.state.posts); diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index 3489761..e83e705 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -771,7 +771,14 @@ export class Main extends Component { } } this.setState(this.state); - } else if (res.op == UserOperation.EditPost) { + } else if ( + res.op == UserOperation.EditPost || + res.op == UserOperation.DeletePost || + res.op == UserOperation.RemovePost || + res.op == UserOperation.LockPost || + res.op == UserOperation.StickyPost || + res.op == UserOperation.SavePost + ) { let data = res.data as PostResponse; editPostFindRes(data, this.state.posts); this.setState(this.state); diff --git a/src/shared/components/post-listing.tsx b/src/shared/components/post-listing.tsx index 732d573..cac0fd7 100644 --- a/src/shared/components/post-listing.tsx +++ b/src/shared/components/post-listing.tsx @@ -194,7 +194,7 @@ export class PostListing extends Component { if (isImage(post.url)) { return ( + )} - + ); } @@ -576,21 +586,6 @@ export class PostListing extends Component { <> {this.props.showBody && ( <> -
  • - -
  • { {i18n.t('modlog')}
  • -
  • - -
  • ); } diff --git a/src/shared/utils.ts b/src/shared/utils.ts index b5d7dd0..16b99f8 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -927,6 +927,7 @@ export function editPostRes(data: PostResponse, post: Post) { post.stickied = data.post.stickied; post.body = data.post.body; post.locked = data.post.locked; + post.saved = data.post.saved; } } @@ -1153,3 +1154,24 @@ export function wsSubscribe(parseMessage: any): Subscription { return null; } } + +moment.updateLocale('en', { + relativeTime: { + future: 'in %s', + past: '%s ago', + s: '<1m', + ss: '%ds', + m: '1m', + mm: '%dm', + h: '1h', + hh: '%dh', + d: '1d', + dd: '%dd', + w: '1w', + ww: '%dw', + M: '1m', + MM: '%dm', + y: '1y', + yy: '%dy', + }, +});