Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1428 like/dislike tooltip #1466

Merged
merged 3 commits into from
Nov 8, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
"avatar": "User's avatar",
"category": "Category",
"close_button": "Close",
"dislike": "Vote with dislike",
"expected_payout": "Expected payout",
"like": "Vote with like",
"tag": "Hashtag",
"username": "Username"
},
Expand Down Expand Up @@ -452,6 +450,7 @@
},
"delegated_vesting": "%(VESTING_TOKEN)s delegated from this account",
"delete": "Delete",
"dislike": "Dislike",
"dismiss": "Dismiss",
"do_you_need_to": "Do you need to",
"documentation": "Documentation",
Expand Down Expand Up @@ -494,6 +493,7 @@
"invites": "Invites",
"joined": "Joined",
"keep_me_logged_in": "Keep me logged in",
"like": "Like",
"loading": "Loading",
"login": "Login",
"login_to_see_memo": "login to see memo",
Expand Down
4 changes: 2 additions & 2 deletions app/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@
"avatar": "Аватар пользователя",
"category": "Категория",
"close_button": "Закрыть",
"dislike": "Поставить не нравится",
"expected_payout": "Ожидаемая выплата",
"like": "Поставить нравится",
"tag": "Тег",
"username": "Никнейм автора"
},
Expand Down Expand Up @@ -454,6 +452,7 @@
},
"delegated_vesting": "%(VESTING_TOKEN)s делегированная с этого аккаунта",
"delete": "Удалить",
"dislike": "Голосовать против",
"dismiss": "Скрыть",
"do_you_need_to": "Вам нужно",
"documentation": "Документация",
Expand Down Expand Up @@ -496,6 +495,7 @@
"invites": "Приглашения",
"joined": "Присоединился",
"keep_me_logged_in": "Оставить меня залогиненным",
"like": "Голосовать за",
"loading": "Загрузка",
"login": "Войти",
"login_to_see_memo": "Авторизуйтесь, чтобы увидеть примечание",
Expand Down
53 changes: 28 additions & 25 deletions src/app/components/common/VotePanel/VotePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,28 +253,34 @@ export default class VotePanel extends PureComponent {
const { className, sidePanel, votesSummary } = this.props;
const { showSlider, sliderAction } = this.state;

const likersList = showSlider
? null
: makeTooltip(votesSummary.firstLikes, votesSummary.likes > 10);
const dislikersList = showSlider
? null
: makeTooltip(votesSummary.firstDislikes, votesSummary.dislikes > 10);

return (
<Root className={className} innerRef={this._onRef} vertical={sidePanel}>
<LikeBlock
active={votesSummary.myVote === 'like' || sliderAction === 'like'}
data-tooltip={
showSlider
? null
: makeTooltip(votesSummary.firstLikes, votesSummary.likes > 10)
}
data-tooltip-html
vertical={sidePanel}
>
<LikeWrapper
innerRef={this._onLikeRef}
onClick={this._onLikeClick}
vertical={sidePanel}
role="button"
aria-label={tt('aria_label.like')}
data-tooltip={tt('g.like')}
aria-label={tt('g.like')}
innerRef={this.onLikeRef}
vertical={sidePanel}
onClick={this.onLikeClick}
>
<LikeIcon name="like" />
</LikeWrapper>
<LikeCount onClick={votesSummary.likes === 0 ? null : this.onLikesNumberClick}>
<LikeCount
data-tooltip={likersList}
data-tooltip-html
onClick={votesSummary.likes === 0 ? null : this.onLikesNumberClick}
>
{votesSummary.likes}
{sidePanel ? null : <IconTriangle />}
</LikeCount>
Expand All @@ -283,24 +289,21 @@ export default class VotePanel extends PureComponent {
<LikeBlockNeg
last
activeNeg={votesSummary.myVote === 'dislike' || sliderAction === 'dislike'}
data-tooltip={
showSlider
? null
: makeTooltip(votesSummary.firstDislikes, votesSummary.dislikes > 10)
}
data-tooltip-html
vertical={sidePanel}
>
<LikeWrapper
innerRef={this._onDisLikeRef}
onClick={this._onDislikeClick}
vertical={sidePanel}
role="button"
aria-label={tt('aria_label.dislike')}
data-tooltip={tt('g.dislike')}
aria-label={tt('g.dislike')}
innerRef={this.onDisLikeRef}
vertical={sidePanel}
onClick={this.onDislikeClick}
>
<LikeIconNeg name="like" />
</LikeWrapper>
<LikeCount
data-tooltip={dislikersList}
data-tooltip-html
onClick={votesSummary.dislikes === 0 ? null : this.onDislikesNumberClick}
>
{votesSummary.dislikes}
Expand Down Expand Up @@ -401,15 +404,15 @@ export default class VotePanel extends PureComponent {
this._root = el;
};

_onLikeRef = el => {
onLikeRef = el => {
this._like = el;
};

_onDisLikeRef = el => {
onDisLikeRef = el => {
this._disLike = el;
};

_onLikeClick = () => {
onLikeClick = () => {
const { votesSummary } = this.props;

if (this.state.showSlider) {
Expand All @@ -429,7 +432,7 @@ export default class VotePanel extends PureComponent {
}
};

_onDislikeClick = () => {
onDislikeClick = () => {
const { votesSummary } = this.props;

if (this.state.showSlider) {
Expand Down