Only show mod zone if user is a mod

This commit is contained in:
Ategon 2025-01-19 19:57:50 -05:00
parent 743c217ab2
commit b816523cf9

View file

@ -201,8 +201,8 @@ export default function PostCard({
<></> <></>
)} )}
</DropdownSection> </DropdownSection>
<DropdownSection title="Mod Zone"> {user?.mod ? (
{user?.mod ? ( <DropdownSection title="Mod Zone">
<DropdownItem <DropdownItem
key="remove" key="remove"
startContent={<X />} startContent={<X />}
@ -236,45 +236,45 @@ export default function PostCard({
> >
Remove Remove
</DropdownItem> </DropdownItem>
) : ( {user?.admin && !post.author.mod ? (
<></> <DropdownItem
)} key="promote-mod"
{user?.admin && !post.author.mod ? ( startContent={<Shield />}
<DropdownItem description="Promote user to Mod"
key="promote-mod" >
startContent={<Shield />} Appoint as mod
description="Promote user to Mod" </DropdownItem>
> ) : (
Appoint as mod <></>
</DropdownItem> )}
) : ( {user?.admin &&
<></> post.author.mod &&
)} post.author.id !== user.id ? (
{user?.admin && <DropdownItem
post.author.mod && key="demote-mod"
post.author.id !== user.id ? ( startContent={<ShieldX />}
<DropdownItem description="Demote user from Mod"
key="demote-mod" >
startContent={<ShieldX />} Remove as mod
description="Demote user from Mod" </DropdownItem>
> ) : (
Remove as mod <></>
</DropdownItem> )}
) : ( {user?.admin && !post.author.admin ? (
<></> <DropdownItem
)} key="promote-admin"
{user?.admin && !post.author.admin ? ( startContent={<ShieldAlert />}
<DropdownItem description="Promote user to Admin"
key="promote-admin" >
startContent={<ShieldAlert />} Appoint as admin
description="Promote user to Admin" </DropdownItem>
> ) : (
Appoint as admin <></>
</DropdownItem> )}
) : ( </DropdownSection>
<></> ) : (
)} <></>
</DropdownSection> )}
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</div> </div>