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 ca9f9dad..dd6ba0cd 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -961,6 +961,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 ( @@ -995,54 +1110,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_) && @@ -1094,62 +1169,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} )}