diff --git a/.eslintrc.json b/.eslintrc.json index 81257cb3..ad777401 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,7 +3,7 @@ "env": { "browser": true }, - "plugins": ["@typescript-eslint", "jsx-a11y"], + "plugins": ["@typescript-eslint", "jsx-a11y", "prettier"], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/recommended", @@ -41,6 +41,7 @@ "no-var": 0, "prefer-const": 1, "prefer-rest-params": 0, + "prettier/prettier": "error", "quote-props": 0, "unicorn/filename-case": 0 } diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 449f6963..61561e98 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -982,6 +982,121 @@ export class PostListing extends Component { ); } + get modBanFromCommunityButton() { + return ( + + ); + } + + get modUnbanFromCommunityButton() { + return ( + + ); + } + + get addModToCommunityButton() { + return ( + + ); + } + + get modBanButton() { + return ( + + ); + } + + get modUnbanButton() { + return ( + + ); + } + + get purgePersonButton() { + return ( + + ); + } + + get purgePostButton() { + return ( + + ); + } + + get toggleAdminButton() { + return ( + + ); + } + get modRemoveButton() { const removed = this.postView.post.removed; return ( @@ -1016,54 +1131,14 @@ export class PostListing extends Component { {this.canMod_ && ( <> {!this.creatorIsMod_ && - (!post_view.creator_banned_from_community ? ( - - ) : ( - - ))} - {!post_view.creator_banned_from_community && ( - - )} + (!post_view.creator_banned_from_community + ? this.modBanFromCommunityButton + : this.modUnbanFromCommunityButton)} + {!post_view.creator_banned_from_community && + this.addModToCommunityButton} )} + {/* Community creators and admins can transfer community to another mod */} {(amCommunityCreator(post_view.creator.id, this.props.moderators) || this.canAdmin_) && @@ -1115,62 +1190,16 @@ export class PostListing extends Component { <> {!this.creatorIsAdmin_ && ( <> - {!isBanned(post_view.creator) ? ( - - ) : ( - - )} - - + {!isBanned(post_view.creator) + ? this.modBanButton + : this.modUnbanButton} + {this.purgePersonButton} + {this.purgePostButton} )} - {!isBanned(post_view.creator) && post_view.creator.local && ( - - )} + {!isBanned(post_view.creator) && + post_view.creator.local && + this.toggleAdminButton} )}