diff --git a/src/components/poll.jsx b/src/components/poll.jsx index 27090c3b..f40b5e6c 100644 --- a/src/components/poll.jsx +++ b/src/components/poll.jsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from 'preact/hooks'; +import { useState } from 'preact/hooks'; import shortenNumber from '../utils/shorten-number'; @@ -62,29 +62,13 @@ export default function Poll({ const [showResults, setShowResults] = useState(false); const optionsHaveVoteCounts = options.every((o) => o.votesCount !== null); - const pollRef = useRef(); - useEffect(() => { - const handleSwipe = () => { - console.log('swiped left'); - setShowResults(!showResults); - }; - pollRef.current?.addEventListener?.('swiped-left', handleSwipe); - return () => { - pollRef.current?.removeEventListener?.('swiped-left', handleSwipe); - }; - }, [showResults]); - return (
{ - setShowResults(!showResults); - }} > {(showResults && optionsHaveVoteCounts) || voted || expired ? ( <> @@ -138,11 +122,12 @@ export default function Poll({ )} @@ -198,26 +183,43 @@ export default function Poll({ )}

{!expired && !readOnly && ( - <> - {' '} - •{' '} - + (async () => { + await refresh(); + setUIState('default'); + })(); + }} + > + + )} + {!voted && !expired && !readOnly && optionsHaveVoteCounts && ( + + )} + {!expired && !readOnly && ' '} {shortenNumber(votesCount)} vote {votesCount === 1 ? '' : 's'} {!!votersCount && votersCount !== votesCount && ( diff --git a/src/components/status.css b/src/components/status.css index 238324b1..7a5b3b04 100644 --- a/src/components/status.css +++ b/src/components/status.css @@ -1138,6 +1138,7 @@ a.card:is(:hover, :focus) { min-width: 160px; } .poll-meta { + color: var(--text-insignificant-color); margin: 8px 16px; font-size: 90%; user-select: none;