From: Sasha Sorokin <10401817+Brawaru@users.noreply.github.com>
Date: Wed, 13 Oct 2021 02:59:31 +0000 (+0700)
Subject: Add single option votes tooltip in polls (#16849)
X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=89b5071fde2f111eaa53ce404712423de25a593d;p=mastodon.git
Add single option votes tooltip in polls (#16849)
Adds a tooltip when hovering over the percentages in a poll showing how
many votes were cast for that option.
Also removes descriptions from messages here since they are not picked
up by Crowdin anyway and might be confusing to other developers :)
Fixes #16820
---
diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js
index 477f56e13..85aa28816 100644
--- a/app/javascript/mastodon/components/poll.js
+++ b/app/javascript/mastodon/components/poll.js
@@ -12,8 +12,18 @@ import RelativeTimestamp from './relative_timestamp';
import Icon from 'mastodon/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)}%
+
+ )}