From 1ddec1df0edc8d5746a22d837efc90cc716c9852 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin <10401817+Brawaru@users.noreply.github.com> Date: Wed, 13 Oct 2021 09:59:31 +0700 Subject: [PATCH] [Glitch] Add single option votes tooltip in polls Port 0f50a97175b892f32d26299216f9cc5fb8b0508b to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/components/poll.js | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/app/javascript/flavours/glitch/components/poll.js b/app/javascript/flavours/glitch/components/poll.js index f230823cc3..970b007051 100644 --- a/app/javascript/flavours/glitch/components/poll.js +++ b/app/javascript/flavours/glitch/components/poll.js @@ -12,8 +12,18 @@ import RelativeTimestamp from './relative_timestamp'; import Icon from 'flavours/glitch/components/icon'; const messages = defineMessages({ - closed: { id: 'poll.closed', defaultMessage: 'Closed' }, - voted: { id: 'poll.voted', defaultMessage: 'You voted for this answer', description: 'Tooltip of the "voted" checkmark in polls' }, + 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 makeEmojiMap = record => record.get('emojis').reduce((obj, emoji) => { @@ -148,9 +158,16 @@ class Poll extends ImmutablePureComponent { data-index={optionIndex} /> )} - {showResults && - {Math.round(percent)}% - } + {showResults && ( + + {Math.round(percent)}% + + )}