X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fpost%2Fpost-listing.tsx;h=8e69b18ec428f7fea31228f5a73d1dbc18273da8;hb=13df4b9c56e5d27a4b57c69560401b1da9683e0d;hp=222e4857aed577e642226e5bf17b8caf0f7fc557;hpb=f98dee6004355588d3620c6a332b6c5db195a7a9;p=lemmy-ui.git diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 222e485..8e69b18 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -201,7 +201,7 @@ export class PostListing extends Component { const post = this.postView.post; return ( -
+
{!this.state.showEdit ? ( <> {this.listing()} @@ -367,10 +367,8 @@ export class PostListing extends Component { createdLine() { const post_view = this.postView; - const url = post_view.post.url; - const body = post_view.post.body; return ( -
    +
    • @@ -386,10 +384,10 @@ export class PostListing extends Component { )} {this.props.showCommunity && ( - - {i18n.t("to")} - - + <> + {" "} + {i18n.t("to")} + )}
    • {post_view.post.language_id !== 0 && ( @@ -402,21 +400,6 @@ export class PostListing extends Component { )}
    • •
    • - {url && !(hostname(url) === getExternalHost()) && ( - <> -
    • - - {hostname(url)} - -
    • -
    • •
    • - - )}
    • { />
    • - {body && ( - <> -
    • •
    • -
    • - -
    • - - )}
    ); } @@ -518,84 +486,107 @@ export class PostListing extends Component { const url = post.url; return ( -
    -
    - {url && this.props.showBody ? ( - - ) : ( - this.postLink + <> +
    +
    + {url && this.props.showBody ? ( + + ) : ( + this.postLink + )} +
    + {(url && isImage(url)) || + (post.thumbnail_url && ( + + ))} + {post.removed && ( + + {i18n.t("removed")} + )} -
    - {(url && isImage(url)) || - (post.thumbnail_url && ( - - ))} - {post.removed && ( - - {i18n.t("removed")} - - )} - {post.deleted && ( - - - - )} - {post.locked && ( - - - - )} - {post.featured_community && ( - - - - )} - {post.featured_local && ( - + + )} + {post.locked && ( + + + + )} + {post.featured_community && ( + + + + )} + {post.featured_local && ( + + + + )} + {post.nsfw && ( + + {i18n.t("nsfw")} + + )} +
    + {url && this.urlLine()} + + ); + } + + urlLine() { + const post = this.postView.post; + const url = post.url; + + return ( +

    + {url && !(hostname(url) === getExternalHost()) && ( + - - - )} - {post.nsfw && ( - - {i18n.t("nsfw")} - + {hostname(url)} + )} -

+

); } @@ -625,11 +616,11 @@ export class PostListing extends Component { const post = this.postView.post; return ( -
+
{this.commentsButton} {canShare() && ( ); } @@ -668,57 +669,64 @@ export class PostListing extends Component { // Possible enhancement: Priority+ pattern instead of just hard coding which get hidden behind the show more button. // Possible enhancement: Make each button a component. const post_view = this.postView; + const post = post_view.post; + return ( <> {this.saveButton} {this.crossPostButton} + {/** + * If there is a URL, or if the post has a body and we were told not to + * show the body, show the MetadataCard/body toggle. + */} + {(post.url || (post.body && !this.props.showBody)) && + this.showPreviewButton()} + {this.showBody && post_view.post.body && this.viewSourceButton} - {this.hasAdvancedButtons && ( -
- +
+ -
    - {!this.myPost ? ( - <> -
  • {this.reportButton}
  • -
  • {this.blockButton}
  • - - ) : ( - <> -
  • {this.editButton}
  • -
  • {this.deleteButton}
  • - - )} +
      + {!this.myPost ? ( + <> +
    • {this.reportButton}
    • +
    • {this.blockButton}
    • + + ) : ( + <> +
    • {this.editButton}
    • +
    • {this.deleteButton}
    • + + )} - {/* Any mod can do these, not limited to hierarchy*/} - {(amMod(this.props.moderators) || amAdmin()) && ( - <> -
    • -
      -
    • -
    • {this.lockButton}
    • - {this.featureButtons} - - )} + {/* Any mod can do these, not limited to hierarchy*/} + {(amMod(this.props.moderators) || amAdmin()) && ( + <> +
    • +
      +
    • +
    • {this.lockButton}
    • + {this.featureButtons} + + )} - {(this.canMod_ || this.canAdmin_) && ( -
    • {this.modRemoveButton}
    • - )} -
    -
- )} + {(this.canMod_ || this.canAdmin_) && ( +
  • {this.modRemoveButton}
  • + )} + +
    ); } @@ -727,7 +735,7 @@ export class PostListing extends Component { const post_view = this.postView; return ( { ); } @@ -882,10 +890,14 @@ export class PostListing extends Component { ); }