Skip to content

Commit

Permalink
[BUG]: disable button to remove non-user votes (#440)
Browse files Browse the repository at this point in the history
fix: disable button if the user dont have votes
  • Loading branch information
CatiaBarroco-xgeeks authored Sep 12, 2022
1 parent 42e80b7 commit 6e45053
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frontend/src/components/Board/Card/CardFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const CardFooter = React.memo<FooterProps>(
};
const votesData = calculateVotes();

const { cardItemId, votesInThisCard } = votesData;
const { cardItemId, votesInThisCard, votesOfUserInThisCard } = votesData;

const [countVotes, setCountVotes] = useState(0);

Expand Down Expand Up @@ -230,7 +230,8 @@ const CardFooter = React.memo<FooterProps>(
disableVoteButton ||
!isMainboard ||
votesInThisCard.length === 0 ||
!!(user && maxVotes && user.votesCount + countVotes <= 0)
!!(user && maxVotes && user.votesCount + countVotes <= 0) ||
votesOfUserInThisCard === 0
}
onClick={handleDeleteVote}
>
Expand Down

0 comments on commit 6e45053

Please sign in to comment.