diff --git a/app/soapbox/components/poll.tsx b/app/soapbox/components/poll.tsx deleted file mode 100644 index e8742ab5f..000000000 --- a/app/soapbox/components/poll.tsx +++ /dev/null @@ -1,290 +0,0 @@ -import classNames from 'classnames'; -import React, { useState } from 'react'; -import { defineMessages, useIntl, FormattedMessage } from 'react-intl'; -import { spring } from 'react-motion'; -import { useDispatch } from 'react-redux'; - -import { openModal } from 'soapbox/actions/modals'; -import { vote, fetchPoll } from 'soapbox/actions/polls'; -import { Text, Button, Icon, Stack, HStack } from 'soapbox/components/ui'; -import Motion from 'soapbox/features/ui/util/optional_motion'; -import { useAppSelector } from 'soapbox/hooks'; - -import RelativeTimestamp from './relative_timestamp'; - -import type { Poll as PollEntity, PollOption as PollOptionEntity } from 'soapbox/types/entities'; - -const messages = defineMessages({ - closed: { id: 'poll.closed', defaultMessage: 'Closed' }, - voted: { id: 'poll.voted', defaultMessage: 'You voted for this answer' }, - votes: { id: 'poll.votes', defaultMessage: '{votes, plural, one {# vote} other {# votes}}' }, -}); - -const PollPercentageBar: React.FC<{ percent: number, leading: boolean }> = ({ percent, leading }): JSX.Element => { - return ( - - {({ width }) => ( - - )} - - ); -}; - -interface IPollOptionText extends IPollOption { - percent: number, -} - -const PollOptionText: React.FC = ({ poll, option, index, active, percent, showResults, onToggle }) => { - const intl = useIntl(); - const voted = poll.own_votes?.includes(index); - const message = intl.formatMessage(messages.votes, { votes: option.votes_count }); - - const handleOptionChange: React.EventHandler = () => { - onToggle(index); - }; - - const handleOptionKeyPress: React.EventHandler = e => { - if (e.key === 'Enter' || e.key === ' ') { - onToggle(index); - e.stopPropagation(); - e.preventDefault(); - } - }; - - return ( -