From 7656c7f92cfb79ede8169da2cee81a6a5c233a72 Mon Sep 17 00:00:00 2001 From: DanS Date: Wed, 18 Nov 2026 21:42:33 -0600 Subject: [PATCH] feat(balance): safer hide, address-create feedback, neutral tx icon (F003/F021/F038/F074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UX audit, Balance surface (batch 1): - F003: the per-row eye only hides an EMPTY or already-hidden address now (match the right-click menu) — hiding a funded address on one unconfirmed click was a fund-visibility footgun; a tooltip explains when it's disabled. - F021: the create-address buttons show "Available once sync finishes" while greyed during sync. - F038: creating an address now toasts success/failure instead of only logging. - F074: generic transactions get a neutral swap icon; the hard-hat icon now means mined only (shield gets the shield icon). New strings (English). Build + tests green. Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/balance_components.cpp | 26 ++++++++++++++++++-------- src/ui/windows/balance_tab_helpers.cpp | 6 +++++- src/util/i18n.cpp | 4 ++++ 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/ui/windows/balance_components.cpp b/src/ui/windows/balance_components.cpp index 948d8a3..413cd6b 100644 --- a/src/ui/windows/balance_components.cpp +++ b/src/ui/windows/balance_components.cpp @@ -642,8 +642,10 @@ void RenderSharedAddressList(App* app, float listH, float availW, if (bHov) material::Tooltip("%s", row.favorite ? TR("remove_favorite") : TR("favorite_address")); } - // Eye button (zero balance or hidden) + // Eye button — only an EMPTY or already-hidden address may be hidden (match the right-click + // menu); hiding a funded address on one unconfirmed click was a fund-visibility footgun. (F003) bool showEye = true; + const bool canHide = row.hidden || addr.balance < 1e-9; // Always reserve space for both buttons so content doesn't shift float contentRight = rowLayout.contentRight; @@ -657,16 +659,18 @@ void RenderSharedAddressList(App* app, float listH, float availW, ImFont* iconFont = Type().iconSmall(); const char* hideIcon = row.hidden ? ICON_MD_VISIBILITY : ICON_MD_VISIBILITY_OFF; ImVec2 iSz = iconFont->CalcTextSizeA(iconFont->LegacySize, 1000.0f, 0.0f, hideIcon); - ImU32 iconCol = bHov ? OnSurface() : OnSurfaceDisabled(); + ImU32 iconCol = (canHide && bHov) ? OnSurface() : OnSurfaceDisabled(); dl->AddText(iconFont, iconFont->LegacySize, ImVec2(eyeRect.x + (eyeRect.width - iSz.x) * 0.5f, eyeRect.y + (eyeRect.height - iSz.y) * 0.5f), iconCol, hideIcon); if (bHov && mouseClicked) { if (row.hidden) app->unhideAddress(addr.address); - else app->hideAddress(addr.address); - btnClicked = true; + else if (canHide) app->hideAddress(addr.address); + btnClicked = true; // consume the click either way (don't fall through to row-copy) } - if (bHov) material::Tooltip("%s", row.hidden ? TR("restore_address") : TR("hide_address")); + if (bHov) material::Tooltip("%s", row.hidden ? TR("restore_address") + : canHide ? TR("hide_address") + : TR("bal_hide_only_empty")); } // ---- Type icon or custom icon ---- @@ -1009,17 +1013,23 @@ void RenderSharedAddressList(App* app, float listH, float availW, s_generating_z_address = true; app->createNewZAddress([](const std::string& addr) { s_generating_z_address = false; - DEBUG_LOGF("Created new z-address: %s\n", addr.c_str()); + if (!addr.empty()) Notifications::instance().success(TR("bal_address_created"), 5.0f); // F038 + else Notifications::instance().error(TR("bal_address_create_failed")); }); } + if (sharedAddrSyncing && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) + material::Tooltip("%s", TR("bal_addr_wait_sync")); // F021: say why it's greyed ImGui::SameLine(); if (TactileButton(TR("new_mining_address"), ImVec2(buttonWidth, 0), S.resolveFont(addrBtn.font.empty() ? "button" : addrBtn.font))) { app->createNewTAddress([](const std::string& addr) { - DEBUG_LOGF("Created new t-address: %s\n", addr.c_str()); + if (!addr.empty()) Notifications::instance().success(TR("bal_address_created"), 5.0f); // F038 + else Notifications::instance().error(TR("bal_address_create_failed")); }); } - if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_new_mining_address")); + if (sharedAddrSyncing && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) + material::Tooltip("%s", TR("bal_addr_wait_sync")); // F021 + else if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_new_mining_address")); ImGui::EndDisabled(); } } diff --git a/src/ui/windows/balance_tab_helpers.cpp b/src/ui/windows/balance_tab_helpers.cpp index d5ee44b..fe9a5aa 100644 --- a/src/ui/windows/balance_tab_helpers.cpp +++ b/src/ui/windows/balance_tab_helpers.cpp @@ -67,11 +67,15 @@ void DrawTxIcon(ImDrawList* drawList, const std::string& type, { using namespace material; ImFont* iconFont = Type().iconSmall(); - const char* icon = ICON_MD_CONSTRUCTION; + const char* icon = ICON_MD_SWAP_HORIZ; // neutral default for generic/unknown types (F074) if (type == "send") { icon = ICON_MD_CALL_MADE; } else if (type == "receive") { icon = ICON_MD_CALL_RECEIVED; + } else if (type == "mined") { + icon = ICON_MD_CONSTRUCTION; // the hard hat now means mined ONLY + } else if (type == "shield") { + icon = ICON_MD_SHIELD; } ImVec2 size = iconFont->CalcTextSizeA(iconFont->LegacySize, 1000.0f, 0.0f, icon); drawList->AddText(iconFont, iconFont->LegacySize, diff --git a/src/util/i18n.cpp b/src/util/i18n.cpp index 5a021d3..9371ee1 100644 --- a/src/util/i18n.cpp +++ b/src/util/i18n.cpp @@ -1326,6 +1326,10 @@ void I18n::loadBuiltinEnglish() strings_["recv_undo_tip"] = "Restore the amount and memo you just cleared."; strings_["recv_explorer_tip"] = "Opens this address on an external block explorer (a third-party website)."; strings_["recv_enlarge_qr_tip"] = "Show the full address and a larger QR code."; + strings_["bal_hide_only_empty"] = "Only an empty address can be hidden."; + strings_["bal_address_created"] = "New address created."; + strings_["bal_address_create_failed"] = "Couldn't create the address — check the connection and try again."; + strings_["bal_addr_wait_sync"] = "Available once sync finishes."; strings_["copy_uri"] = "Copy URI"; strings_["qr_unavailable"] = "QR unavailable"; strings_["received_label"] = "Received";