Skip to content

Commit 3d03668

Browse files
committed
UX polish: tooltip edge clamping, merged payout 0.0000 DOGE, resize
- Share page tooltip flips left/up when near screen edges - Share page PPLNS treemap: 75-85vh height, dynamic resize - Merged Payout column shows "0.0000 DOGE" instead of "-"
1 parent 62b36c0 commit 3d03668

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

web-static/dashboard.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2641,7 +2641,7 @@ <h4>Legend</h4>
26412641
.style('color', '#c3a634')
26422642
.text(d3.format(',.2f')(mp.amount) + ' ' + (mp.symbol || 'DOGE'));
26432643
} else {
2644-
mergedPayoutCell.style('color', '#666').text('-');
2644+
mergedPayoutCell.style('color', '#666').text('0.0000 DOGE');
26452645
}
26462646

26472647
// Create worker rows (expanded for multi-worker, hidden for single)

web-static/share.html

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,13 +730,17 @@
730730
}
731731
}
732732

733+
var _shareEntries = entries;
734+
var _shareMinerAddr = (share && share.share_data) ? share.share_data.payout_address : '';
735+
function renderSharePPLNS() {
733736
var w = grid.clientWidth;
734737
var vh = window.innerHeight || document.documentElement.clientHeight;
735-
var h = Math.max(400, Math.min(w * 0.5, vh * 0.7));
738+
var h = Math.max(vh * 0.75, Math.min(w * 0.55, vh * 0.85));
736739
grid.style.height = h + 'px';
740+
grid.innerHTML = '';
737741

738-
var rects = pplnsTreemap(entries, 0, 0, w, h);
739-
var minerAddr = (share && share.share_data) ? share.share_data.payout_address : '';
742+
var rects = pplnsTreemap(_shareEntries, 0, 0, w, h);
743+
var minerAddr = _shareMinerAddr;
740744
var addrPrefix = ci.address_explorer_url_prefix || 'https://blockchair.com/litecoin/address/';
741745

742746
rects.forEach(function(r) {
@@ -876,15 +880,31 @@
876880
tooltip.style.display = 'block';
877881
});
878882
cell.addEventListener('mousemove', function(ev) {
879-
tooltip.style.left = (ev.clientX + 14) + 'px';
880-
tooltip.style.top = (ev.clientY + 14) + 'px';
883+
var tw = tooltip.offsetWidth || 320;
884+
var th = tooltip.offsetHeight || 120;
885+
var tx = ev.clientX + 14;
886+
var ty = ev.clientY + 14;
887+
if (tx + tw > window.innerWidth - 8) tx = ev.clientX - tw - 14;
888+
if (ty + th > window.innerHeight - 8) ty = ev.clientY - th - 14;
889+
if (tx < 8) tx = 8;
890+
if (ty < 8) ty = 8;
891+
tooltip.style.left = tx + 'px';
892+
tooltip.style.top = ty + 'px';
881893
});
882894
cell.addEventListener('mouseleave', function() {
883895
tooltip.style.display = 'none';
884896
});
885897

886898
grid.appendChild(cell);
887899
});
900+
} // end renderSharePPLNS
901+
renderSharePPLNS();
902+
// Resize handler
903+
var _resizeTimer;
904+
window.addEventListener('resize', function() {
905+
clearTimeout(_resizeTimer);
906+
_resizeTimer = setTimeout(renderSharePPLNS, 200);
907+
});
888908
}); // end d3.json sharechain/window
889909
}
890910

0 commit comments

Comments
 (0)