From 4ff54095fde058c8e0e008e88edab7d423b7e49b Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 21 Jun 2022 07:35:19 -0400 Subject: [PATCH] Add help text for selecting multiple --- app/soapbox/components/polls/poll-option.tsx | 1 - app/soapbox/components/polls/poll.tsx | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/soapbox/components/polls/poll-option.tsx b/app/soapbox/components/polls/poll-option.tsx index 7aa68667e..427033021 100644 --- a/app/soapbox/components/polls/poll-option.tsx +++ b/app/soapbox/components/polls/poll-option.tsx @@ -11,7 +11,6 @@ import type { } 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}}' }, }); diff --git a/app/soapbox/components/polls/poll.tsx b/app/soapbox/components/polls/poll.tsx index 3a96c34ff..b6d8a0d0f 100644 --- a/app/soapbox/components/polls/poll.tsx +++ b/app/soapbox/components/polls/poll.tsx @@ -1,11 +1,12 @@ import classNames from 'classnames'; import React, { useState } from 'react'; +import { defineMessages, useIntl } from 'react-intl'; import { openModal } from 'soapbox/actions/modals'; import { vote } from 'soapbox/actions/polls'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; -import { Stack } from '../ui'; +import { Stack, Text } from '../ui'; import PollFooter from './poll-footer'; import PollOption from './poll-option'; @@ -17,8 +18,13 @@ interface IPoll { status?: string, } +const messages = defineMessages({ + multiple: { id: 'poll.chooseMultiple', defaultMessage: 'Choose as many as you\'d like.' }, +}); + const Poll: React.FC = ({ id, status }): JSX.Element | null => { const dispatch = useAppDispatch(); + const intl = useIntl(); const isLoggedIn = useAppSelector((state) => state.me); const poll = useAppSelector((state) => state.polls.get(id)); @@ -61,6 +67,12 @@ const Poll: React.FC = ({ id, status }): JSX.Element | null => { return ( // eslint-disable-next-line jsx-a11y/no-static-element-interactions
e.stopPropagation()}> + {poll.multiple && ( + + {intl.formatMessage(messages.multiple)} + + )} + {poll.options.map((option, i) => (