From 9f6aa186dec2f77753f713ec2f534f83ce2c49ca Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Sat, 12 Sep 2020 01:37:46 +0300 Subject: delete separation of single and double click --- src/components/PollCard/PollCard.tsx | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/components') diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 56f5dbd..540679f 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -51,10 +51,8 @@ const PollCard: React.FC = React.memo(({ poll, setPoll }) => { const { enqueueSnackbar } = useSnackbar(); const { isAuthenticated } = useAuth(); const date: string = new Date(poll.createdAt).toLocaleString('default', DATE_FORMAT); - let timer: ReturnType; - let prevent = false; - const handleVote = (which: Which) => { + const handleVote = (which: Which) => () => { if (!isAuthenticated) { enqueueSnackbar('Unauthorized users can not vote in polls', { variant: 'error' @@ -79,19 +77,6 @@ const PollCard: React.FC = React.memo(({ poll, setPoll }) => { } }; - const handleClick = (which: Which) => () => { - if (!prevent) { - prevent = true; - timer = setTimeout(() => { - prevent = false; - }, 200); - } else { - clearTimeout(timer); - prevent = false; - handleVote(which); - } - }; - let leftPercentage; let rightPercentage; @@ -109,11 +94,11 @@ const PollCard: React.FC = React.memo(({ poll, setPoll }) => {
- + - + -- cgit v1.2.3