Skip to content

Commit

Permalink
fixes tooltips on bounty detail pages (#4938)
Browse files Browse the repository at this point in the history
* copy on /results

* tooltips

* fixes tooltips on bounties with otu crowdfunding

* changed let to const
  • Loading branch information
owocki authored and thelostone-mc committed Aug 2, 2019
1 parent a6ffe32 commit 1058a00
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 4 additions & 0 deletions app/assets/v2/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,7 @@ div.busyOverlay {
.g-modal .modal-footer {
border: none;
}

.inner-tooltip {
pointer-events: none;
}
12 changes: 8 additions & 4 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ var heads = {
var callbacks = {
'github_url': link_ize,
'value_in_token': function(key, val, result) {
return [ 'amount', token_value_to_display(val) + ' ' + result['token_name'] ];
const title = token_value_to_display(val) + ' ' + result['token_name'];
const title_expand = title + ' in funding from original funder.';

$('#value_in_token').parents('.token').attr('title', title_expand);
return [ 'amount', title ];
},
'avatar_url': function(key, val, result) {
return [ 'avatar', '<a href="/profile/' + result['org_name'] + '"><img class="avatar ' + result['github_org_name'] + '" src="' + val + '"></a>' ];
Expand Down Expand Up @@ -233,9 +237,8 @@ var callbacks = {
if (val === null) {
return [ null, null ];
}
var rates_estimate = get_rates_estimate(val);

$('#value_in_usdt_wrapper').attr('title', '<div class="tooltip-info tooltip-sm">' + rates_estimate + '</div>');
$('#value_in_usdt_wrapper').attr('title', '<div class="tooltip-info">The funding in this bounty adds up to $' + val + ' USD </div>');

return [ 'Amount_usd', val ];
},
Expand Down Expand Up @@ -296,7 +299,7 @@ var callbacks = {
const tokenValue = Math.round(1.0 * ratio);
const timestamp = new Date(obj['timestamp']);
const timePeg = timeDifference(dateNow, timestamp > dateNow ? dateNow : timestamp, false, 60 * 60);
const tooltip = `$ ${Math.round(usd)} USD in crowdfunding`;
const tooltip = `+ ${funding} ${tokenName} in crowdfunding`;

leftHtml += '<p class="m-0">+ ' + funding + ' ' + tokenName + '</p>';
rightHtml += '<p class="m-0">@ $' + tokenValue + ' ' + tokenName + ' as of ' + timePeg + '</p>';
Expand All @@ -307,6 +310,7 @@ var callbacks = {
newTokenTag(funding, tokenName, tooltip, true),
usdTagElement
);

}

$('#value_in_usdt').html(Math.round(totalUSDValue));
Expand Down
7 changes: 2 additions & 5 deletions app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,14 +1360,11 @@ function newTokenTag(amount, tokenName, tooltipInfo, isCrowdfunded) {
span.innerHTML = amount + ' ' + tokenName +
(isCrowdfunded ? '<i class="fas fa-users ml-1"></i>' : '');

p.className = 'inner-tooltip';
p.appendChild(span);
ele.appendChild(p);

if (tooltipInfo) {
ele.title =
'<div class="tooltip-info tooltip-sm">' +
tooltipInfo +
'</div>';
ele.title = tooltipInfo;
}

return ele;
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/templates/bounty/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ <h4 id="title" class="font-title"></h4>
<div class="col-12 text-center text-lg-left">
<div class="tags font-caption align-items-center">
<div class="tag token">
<p>
<p class="inner-tooltip">
<span id="value_in_token"></span>
</p>
</div>
<div id="value_in_usdt_wrapper" title="" class="tag usd ml-3">
<p>
<p class="inner-tooltip">
<span id="value_in_usdt"></span>
<span>USD</span>
</p>
Expand Down
2 changes: 1 addition & 1 deletion app/retail/templates/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<div class="container">
<h2 class="content-block__title">
${{ universe_total_usd|floatformat:2|intcomma }} of {% blocktrans %}
Total Platform Value
Gross Marketplace Value
{% endblocktrans %}
{% if keyword %}({{keyword}}){%endif%}
</h2>
Expand Down

0 comments on commit 1058a00

Please sign in to comment.