fix(ui): consistent hashrate units, full-address tooltips, drop dead vars

- Balance card hashrate now uses the shared FormatHashrate() (TH/GH/MH/KH/H)
  instead of a bespoke two-tier KH/s formatter.
- Recent-tx rows show the full untruncated address on hover — two z-addresses can
  truncate to the same first/last window — and the truncate helpers guard maxLen<=3.
- Remove the unused viewTop/viewBot "viewport culling" locals in the tx list
  (pagination already bounds per-frame work).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 14:25:43 -05:00
parent 6ed80d2d79
commit a605e35409
4 changed files with 10 additions and 15 deletions

View File

@@ -6,6 +6,7 @@
#include "balance_address_list.h"
#include "balance_tab_helpers.h"
#include "balance_recent_tx.h"
#include "mining_tab_helpers.h" // FormatHashrate (consistent MH/GH/.. scaling)
#include "key_export_dialog.h"
#include "qr_popup_dialog.h"
#include "address_label_dialog.h"
@@ -430,10 +431,7 @@ static void RenderBalanceClassic(App* app)
dl->AddCircleFilled(ImVec2(cx + 4 * dp, cy + capFont->LegacySize * 0.5f),
S.drawElement("tabs.balance.classic", "mining-dot-radius").sizeOr(3.0f), mineCol);
double hr = state.mining.localHashrate;
if (hr >= 1000.0)
snprintf(buf, sizeof(buf), " Mining %.1f KH/s", hr / 1000.0);
else
snprintf(buf, sizeof(buf), " Mining %.0f H/s", hr);
snprintf(buf, sizeof(buf), " Mining %s", FormatHashrate(hr).c_str());
dl->AddText(capFont, capFont->LegacySize,
ImVec2(cx + 12 * dp, cy),
WithAlpha(Success(), 200), buf);
@@ -1175,6 +1173,10 @@ static void RenderBalanceClassic(App* app)
dl->AddRectFilled(rowPos, rowEnd,
IM_COL32(255, 255, 255, 15), S.drawElement("tabs.balance", "row-hover-rounding").sizeOr(4.0f));
ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
// Show the full, untruncated address — two z-addresses can truncate to the
// same first/last window, so the truncated text alone can't disambiguate.
if (!tx.address.empty())
ImGui::SetTooltip("%s", tx.address.c_str());
if (ImGui::IsMouseClicked(0))
app->setCurrentPage(NavPage::History);
}
@@ -3202,10 +3204,7 @@ static void RenderBalanceTwoRow(App* app) {
}
if (state.mining.generate) {
double hr = state.mining.localHashrate;
if (hr >= 1000.0)
snprintf(buf, sizeof(buf), "Mining %.1f KH/s", hr / 1000.0);
else
snprintf(buf, sizeof(buf), "Mining %.0f H/s", hr);
snprintf(buf, sizeof(buf), "Mining %s", FormatHashrate(hr).c_str());
Type().textColored(TypeStyle::Caption, WithAlpha(Success(), 200), buf);
ImGui::SameLine();
}