From fb9796b0c4de13146bb638584f9c20a8765d8e4e Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 14 Jun 2022 16:14:14 -0400 Subject: [PATCH 1/9] Redesign Poll within Status --- .../pleroma-status-with-poll-with-emojis.json | 2 +- app/soapbox/components/poll.tsx | 119 +++++++++++------- app/soapbox/components/relative_timestamp.js | 18 +-- app/soapbox/components/status_content.tsx | 9 +- app/soapbox/features/test_timeline/index.tsx | 2 +- .../features/ui/components/poll_preview.tsx | 48 ++++--- app/soapbox/locales/en.json | 2 +- 7 files changed, 122 insertions(+), 78 deletions(-) diff --git a/app/soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json b/app/soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json index 76c722a45..3439ebd8f 100644 --- a/app/soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json +++ b/app/soapbox/__fixtures__/pleroma-status-with-poll-with-emojis.json @@ -196,7 +196,7 @@ "expired": false, "expires_at": "2022-03-12T01:33:18.000Z", "id": "AHHue67gF2JDqCQGhc", - "multiple": false, + "multiple": true, "options": [ { "title": "Regular emoji ๐Ÿ˜ ", diff --git a/app/soapbox/components/poll.tsx b/app/soapbox/components/poll.tsx index e95b4342e..e8742ab5f 100644 --- a/app/soapbox/components/poll.tsx +++ b/app/soapbox/components/poll.tsx @@ -6,8 +6,7 @@ import { useDispatch } from 'react-redux'; import { openModal } from 'soapbox/actions/modals'; import { vote, fetchPoll } from 'soapbox/actions/polls'; -import Icon from 'soapbox/components/icon'; -import { Text, Button, Stack, HStack } from 'soapbox/components/ui'; +import { Text, Button, Icon, Stack, HStack } from 'soapbox/components/ui'; import Motion from 'soapbox/features/ui/util/optional_motion'; import { useAppSelector } from 'soapbox/hooks'; @@ -21,10 +20,10 @@ const messages = defineMessages({ votes: { id: 'poll.votes', defaultMessage: '{votes, plural, one {# vote} other {# votes}}' }, }); -const PollPercentageBar: React.FC<{percent: number, leading: boolean}> = ({ percent, leading }): JSX.Element => { +const PollPercentageBar: React.FC<{ percent: number, leading: boolean }> = ({ percent, leading }): JSX.Element => { return ( - {({ width }) =>( + {({ width }) => ( = ({ poll, option, index, active return (