Skip to content

Commit

Permalink
fix(web): disable changing my own role and deleting myself
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Oct 25, 2023
1 parent db515bf commit e40fe33
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const MemberListItem: React.FC<Props> = ({ user, role, owner, isMe, onChangeRole
{ key: "OWNER", label: t("Owner") },
];

const editable = owner && !isMe;

return (
<Wrapper align="flex-start" justify="space-between">
<StyleAvatar innerText={user.name} />
Expand All @@ -55,16 +57,17 @@ const MemberListItem: React.FC<Props> = ({ user, role, owner, isMe, onChangeRole
currentItem={role}
body={roles.find(r => r.key === role)?.label}
onSubmit={saveEdit}
disabled={!owner}
disabled={!editable}
/>
{owner && !isMe && <StyledIcon icon="bin" size={20} onClick={onRemove} />}
{editable && <StyledIcon icon="bin" size={20} onClick={onRemove} />}
</Wrapper>
);
};

const Wrapper = styled(Flex)`
width: 100%;
height: 100px;
padding-right: ${metricsSizes["l"]}px;
color: ${({ theme }) => theme.classic.properties.contentsText};
`;

Expand All @@ -73,10 +76,10 @@ const StyledEditableItem = styled(EditableItem)`
`;

const StyledIcon = styled(Icon)`
padding: 0;
margin: 0 ${metricsSizes["l"]}px;
cursor: pointer;
margin-left: ${metricsSizes["l"]}px;
`;

const StyleAvatar = styled(Avatar)`
margin-right: ${metricsSizes["m"]}px;
`;
Expand Down

0 comments on commit e40fe33

Please sign in to comment.