Add last block earnings display to UI

Updated `updateUI()` in `main.js` to show last block earnings with a "+" prefix and "SATS" suffix. Modified `dashboard.html` to include a new span element that conditionally displays the earnings or defaults to "+0 SATS".
This commit is contained in:
DJObleezy 2025-04-26 06:13:58 -07:00
parent e0c5f085cc
commit 24c46f058b
2 changed files with 8 additions and 1 deletions

View File

@ -1693,6 +1693,13 @@ function updateUI() {
data.btc_price != null ? "$" + numberWithCommas(parseFloat(data.btc_price).toFixed(2)) : "N/A" data.btc_price != null ? "$" + numberWithCommas(parseFloat(data.btc_price).toFixed(2)) : "N/A"
); );
// Update last block earnings
if (data.last_block_earnings !== undefined) {
// Format with "+" prefix and "SATS" suffix
updateElementText("last_block_earnings",
"+" + numberWithCommas(data.last_block_earnings) + " SATS");
}
// Network hashrate (already in EH/s but verify) // Network hashrate (already in EH/s but verify)
// Improved version with ZH/s support: // Improved version with ZH/s support:
if (data.network_hashrate >= 1000) { if (data.network_hashrate >= 1000) {

View File

@ -76,7 +76,7 @@
{{ metrics.last_block_time if metrics and metrics.last_block_time else "N/A" }} {{ metrics.last_block_time if metrics and metrics.last_block_time else "N/A" }}
</span> </span>
<span class="green"> <span id="last_block_earnings" class="metric-value green">
{% if metrics and metrics.last_block_earnings %} {% if metrics and metrics.last_block_earnings %}
+{{ metrics.last_block_earnings|int|commafy }} SATS +{{ metrics.last_block_earnings|int|commafy }} SATS
{% else %} {% else %}