From 44bbc459736ac53b9150903af14c20a497caf9ab Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 3 Mar 2020 02:29:45 -0500 Subject: A first pass at adding icons, and tippy tooltips. - Adding icons for post-listing, comment-node, and navbar. - Adding html titles. - Updating moment expand to use users locale. --- ui/src/components/post-listing.tsx | 133 +++++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 35 deletions(-) (limited to 'ui/src/components/post-listing.tsx') diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index 732664e8..5f3fef09 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -30,6 +30,7 @@ import { pictshareAvatarThumbnail, showAvatars, imageThumbnailer, + setupTippy, } from '../utils'; import { i18n } from '../i18next'; @@ -101,6 +102,10 @@ export class PostListing extends Component { } } + componentDidUpdate() { + setupTippy(); + } + componentWillReceiveProps(nextProps: PostListingProps) { this.state.my_vote = nextProps.post.my_vote; this.state.upvotes = nextProps.post.upvotes; @@ -185,7 +190,7 @@ export class PostListing extends Component { return ( {this.imgThumb()} @@ -246,12 +251,13 @@ export class PostListing extends Component { this.state.my_vote == 1 ? 'text-info' : 'text-muted' }`} onClick={linkEvent(this, this.handlePostLike)} + data-tippy-content={i18n.t('upvote')} > -
+
{this.state.score}
{WebSocketService.Instance.site.enable_downvotes && ( @@ -260,6 +266,7 @@ export class PostListing extends Component { this.state.my_vote == -1 ? 'text-danger' : 'text-muted' }`} onClick={linkEvent(this, this.handlePostDisLike)} + data-tippy-content={i18n.t('downvote')} > @@ -333,8 +340,8 @@ export class PostListing extends Component { <> {!this.state.imageExpanded ? ( [+] @@ -342,7 +349,7 @@ export class PostListing extends Component { ) : ( [-] @@ -439,22 +446,37 @@ export class PostListing extends Component {
  • - - (+{this.state.upvotes} - | - -{this.state.downvotes} - ) + + + + + {this.state.upvotes}
  • - - {i18n.t('number_of_comments', { + + + + + {this.state.downvotes} + +
  • +
  • + + + + + {post.number_of_comments}
  • -
      +
        {this.props.post.duplicates && ( <>
      • @@ -470,65 +492,90 @@ export class PostListing extends Component { )}
      -
        +
          {UserService.Instance.user && ( <> {this.props.showBody && ( <> -
        • +
        • - {post.saved ? i18n.t('unsave') : i18n.t('save')} + + +
        • -
        • +
        • - {i18n.t('cross_post')} + + +
        • )} {this.myPost && this.props.showBody && ( <> -
        • +
        • - {i18n.t('edit')} + + +
        • -
        • +
        • - {!post.deleted - ? i18n.t('delete') - : i18n.t('restore')} + + +
        • )} {!this.state.showAdvanced && this.props.showBody ? ( -
        • +
        • - {i18n.t('more')} + + +
        • ) : ( <> {this.props.showBody && post.body && ( -
        • +
        • { )} {this.canModOnSelf && ( <> -
        • +
        • - {post.locked - ? i18n.t('unlock') - : i18n.t('lock')} + + +
        • -
        • +
        • - {post.stickied - ? i18n.t('unsticky') - : i18n.t('sticky')} + + +
        • -- cgit v1.2.3