X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fpost%2Fpost-listing.tsx;h=922fa61efbb72c23508d7e3f80168ecd02dd0365;hb=02ffa85b589ea630b259f6c2617b399e05972716;hp=a95599b258e74c5fd480ce1fa418d28a0078662c;hpb=f8fd90cc2edc77af4dc6d463da8adb499a77b971;p=lemmy-ui.git diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index a95599b..922fa61 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()} @@ -386,10 +386,10 @@ export class PostListing extends Component { )} {this.props.showCommunity && ( - - {i18n.t("to")} - - + <> + {" "} + {i18n.t("to")} + )} {post_view.post.language_id !== 0 && ( @@ -497,7 +497,7 @@ export class PostListing extends Component { const post = this.postView.post; return ( { to={`/post/${post.id}`} title={i18n.t("comments")} > -
@@ -519,88 +519,78 @@ export class PostListing extends Component { return (
-
- {url ? ( - this.props.showBody ? ( - -
- - ) : ( - this.postLink - ) +
+ {url && this.props.showBody ? ( + ) : ( this.postLink )} - {(url && isImage(url)) || - (post.thumbnail_url && ( - - ))} - {post.removed && ( - - {i18n.t("removed")} - - )} - {post.deleted && ( - - - - )} - {post.locked && ( - - - - )} - {post.featured_community && ( - - - - )} - {post.featured_local && ( - - - - )} - {post.nsfw && ( - - {i18n.t("nsfw")} - - )}
+ {(url && isImage(url)) || + (post.thumbnail_url && ( + + ))} + {post.removed && ( + + {i18n.t("removed")} + + )} + {post.deleted && ( + + + + )} + {post.locked && ( + + + + )} + {post.featured_community && ( + + + + )} + {post.featured_local && ( + + + + )} + {post.nsfw && ( + {i18n.t("nsfw")} + )}
); } @@ -631,11 +621,11 @@ export class PostListing extends Component { const post = this.postView.post; return ( -
+
{this.commentsButton} {canShare() && (
); } - postActions(mobile = false) { + get hasAdvancedButtons() { + return ( + this.myPost || + (this.showBody && this.postView.post.body) || + amMod(this.props.moderators) || + amAdmin() || + this.canMod_ || + this.canAdmin_ + ); + } + + postActions() { // 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; @@ -667,37 +668,53 @@ export class PostListing extends Component { <> {this.saveButton} {this.crossPostButton} - {mobile && this.showMoreButton} - {(!mobile || this.state.showAdvanced) && ( - <> - {!this.myPost && ( - <> - {this.reportButton} - {this.blockButton} - - )} - {this.myPost && (this.showBody || this.state.showAdvanced) && ( - <> - {this.editButton} - {this.deleteButton} - - )} - - )} - {this.state.showAdvanced && ( - <> - {this.showBody && post_view.post.body && this.viewSourceButton} - {/* Any mod can do these, not limited to hierarchy*/} - {(amMod(this.props.moderators) || amAdmin()) && ( - <> - {this.lockButton} - {this.featureButton} - - )} - {(this.canMod_ || this.canAdmin_) && <>{this.modRemoveButton}} - + + {this.showBody && post_view.post.body && this.viewSourceButton} + + {this.hasAdvancedButtons && ( +
+ + +
    + {!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} + + )} + + {(this.canMod_ || this.canAdmin_) && ( +
  • {this.modRemoveButton}
  • + )} +
+
)} - {!mobile && this.showMoreButton} ); } @@ -706,7 +723,7 @@ export class PostListing extends Component { const post_view = this.postView; return ( { get reportButton() { return ( ); } @@ -859,12 +876,16 @@ export class PostListing extends Component { get blockButton() { return ( ); } @@ -872,12 +893,12 @@ export class PostListing extends Component { get editButton() { return ( ); } @@ -887,37 +908,26 @@ export class PostListing extends Component { const label = !deleted ? i18n.t("delete") : i18n.t("restore"); return ( ); } - get showMoreButton() { - return ( - - ); - } - get viewSourceButton() { return ( ); } - get featureButton() { + get featureButtons() { const featuredCommunity = this.postView.post.featured_community; const labelCommunity = featuredCommunity ? i18n.t("unfeature_from_community") @@ -969,48 +981,56 @@ export class PostListing extends Component { ? i18n.t("unfeature_from_local") : i18n.t("feature_in_local"); return ( - - - {amAdmin() && ( + <> +
  • - )} - +
  • +
  • + {amAdmin() && ( + + )} +
  • + ); } @@ -1018,7 +1038,7 @@ export class PostListing extends Component { const removed = this.postView.post.removed; return (