From b816523cf9e468549e462ac51b9d3c1f179cd6f7 Mon Sep 17 00:00:00 2001 From: Ategon <benjamin@barbeau.net> Date: Sun, 19 Jan 2025 19:57:50 -0500 Subject: [PATCH] Only show mod zone if user is a mod --- src/components/posts/PostCard.tsx | 82 +++++++++++++++---------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/components/posts/PostCard.tsx b/src/components/posts/PostCard.tsx index 558bdc4..db619e9 100644 --- a/src/components/posts/PostCard.tsx +++ b/src/components/posts/PostCard.tsx @@ -201,8 +201,8 @@ export default function PostCard({ <></> )} </DropdownSection> - <DropdownSection title="Mod Zone"> - {user?.mod ? ( + {user?.mod ? ( + <DropdownSection title="Mod Zone"> <DropdownItem key="remove" startContent={<X />} @@ -236,45 +236,45 @@ export default function PostCard({ > Remove </DropdownItem> - ) : ( - <></> - )} - {user?.admin && !post.author.mod ? ( - <DropdownItem - key="promote-mod" - startContent={<Shield />} - description="Promote user to Mod" - > - Appoint as mod - </DropdownItem> - ) : ( - <></> - )} - {user?.admin && - post.author.mod && - post.author.id !== user.id ? ( - <DropdownItem - key="demote-mod" - startContent={<ShieldX />} - description="Demote user from Mod" - > - Remove as mod - </DropdownItem> - ) : ( - <></> - )} - {user?.admin && !post.author.admin ? ( - <DropdownItem - key="promote-admin" - startContent={<ShieldAlert />} - description="Promote user to Admin" - > - Appoint as admin - </DropdownItem> - ) : ( - <></> - )} - </DropdownSection> + {user?.admin && !post.author.mod ? ( + <DropdownItem + key="promote-mod" + startContent={<Shield />} + description="Promote user to Mod" + > + Appoint as mod + </DropdownItem> + ) : ( + <></> + )} + {user?.admin && + post.author.mod && + post.author.id !== user.id ? ( + <DropdownItem + key="demote-mod" + startContent={<ShieldX />} + description="Demote user from Mod" + > + Remove as mod + </DropdownItem> + ) : ( + <></> + )} + {user?.admin && !post.author.admin ? ( + <DropdownItem + key="promote-admin" + startContent={<ShieldAlert />} + description="Promote user to Admin" + > + Appoint as admin + </DropdownItem> + ) : ( + <></> + )} + </DropdownSection> + ) : ( + <></> + )} </DropdownMenu> </Dropdown> </div>