feat(balance): safer hide, address-create feedback, neutral tx icon (F003/F021/F038/F074)

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 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 21:42:33 -06:00
co-authored by Claude Opus 4.8
parent cbc930f640
commit 7656c7f92c
3 changed files with 27 additions and 9 deletions
+18 -8
View File
@@ -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();
}
}
+5 -1
View File
@@ -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,
+4
View File
@@ -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";