Skip to content

Commit

Permalink
Merge pull request #416 from ryanpwaldon/fix/hide-admin-features-for-…
Browse files Browse the repository at this point in the history
…non-admins

fix(dashboard): hide member edit actions for non-admins
  • Loading branch information
vplasencia authored Mar 5, 2024
2 parents fbe9c1a + 1a8973c commit 89d16b8
Showing 1 changed file with 47 additions and 39 deletions.
86 changes: 47 additions & 39 deletions apps/dashboard/src/pages/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,18 +543,19 @@ ${memberIds.join("\n")}
>
<HStack justify="space-between" w="100%">
<HStack>
{_group.type === "off-chain" && (
<Checkbox
isChecked={_selectedMembers.includes(
memberId
)}
onChange={() =>
toggleMemberSelection(
{_group.type === "off-chain" &&
isGroupAdmin && (
<Checkbox
isChecked={_selectedMembers.includes(
memberId
)
}
/>
)}
)}
onChange={() =>
toggleMemberSelection(
memberId
)
}
/>
)}
<Icon
color="balticSea.300"
boxSize="6"
Expand All @@ -568,44 +569,51 @@ ${memberIds.join("\n")}
</Text>
</HStack>

{_group.type === "off-chain" && (
<Menu>
<MenuButton
as={IconButton}
aria-label="Options"
icon={
<Icon
color="balticSea.300"
boxSize="6"
as={MdOutlineMoreVert}
/>
}
variant="link"
/>
<MenuList>
<MenuItem
{_group.type === "off-chain" &&
isGroupAdmin && (
<Menu>
<MenuButton
as={IconButton}
aria-label="Options"
icon={
<Icon
mt="5px"
color="balticSea.300"
boxSize="6"
as={MdOutlineCancel}
as={
MdOutlineMoreVert
}
/>
}
onClick={() =>
removeMember(memberId)
}
>
Remove
</MenuItem>
</MenuList>
</Menu>
)}
variant="link"
/>
<MenuList>
<MenuItem
icon={
<Icon
mt="5px"
color="balticSea.300"
boxSize="6"
as={
MdOutlineCancel
}
/>
}
onClick={() =>
removeMember(
memberId
)
}
>
Remove
</MenuItem>
</MenuList>
</Menu>
)}
</HStack>
</Flex>
))
)}
{_group.type === "off-chain" && (
{_group.type === "off-chain" && isGroupAdmin && (
<Flex mt="20px" justify="space-between" align="center">
<ButtonGroup>
<Button
Expand Down

0 comments on commit 89d16b8

Please sign in to comment.