feat(shield): explain merge-mode radios, label+balance dest combo, fee guards (F032/F063/F064/F095)
UX audit, Shield/Consolidate surface (batch 1):
- F032: the "Into one address" / "Keep in each address" radios get explanatory tooltips.
- F063: the destination z-address combo now shows each address's label and balance (and
a watch-only marker), matching the from-address combo; the closed preview shows the
label too. (F095) truncation uses the shared ellipsized helper, not ASCII "...".
- F064: the Advanced fee field shows the default ("default 0.0001 DRGX"), a Reset button,
and a warning when the fee is zero or far above the default.
New strings (English). Build + tests green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -526,8 +526,11 @@ void ShieldDialog::render(App* app)
|
||||
// Where the funds go: all into one address, or each address's notes back into that address.
|
||||
ImGui::TextUnformatted(TR("merge_where")); // own line: the choices are long in some languages
|
||||
int where = s_per_address ? 1 : 0;
|
||||
ImGui::RadioButton(TR("merge_into_one"), &where, 0); ImGui::SameLine();
|
||||
ImGui::RadioButton(TR("merge_into_one"), &where, 0);
|
||||
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("merge_into_one_tip")); // F032
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(TR("merge_keep_each"), &where, 1);
|
||||
if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("merge_keep_each_tip")); // F032
|
||||
s_per_address = (where == 1);
|
||||
ImGui::Spacing();
|
||||
|
||||
@@ -648,19 +651,30 @@ void ShieldDialog::render(App* app)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
std::string to_display = s_to_address[0] ? s_to_address : TR("shield_select_z");
|
||||
if (to_display.length() > static_cast<size_t>(addrLbl.truncate))
|
||||
to_display = to_display.substr(0, addrFront.truncate) + "..." + to_display.substr(to_display.length() - addrBack.truncate);
|
||||
// Prefer the destination's label; fall back to a consistently-ellipsized address. (F063/F095)
|
||||
std::string to_display;
|
||||
if (s_to_address[0]) {
|
||||
const std::string zlbl = app->getAddressLabel(s_to_address);
|
||||
to_display = zlbl.empty() ? shortAddr(s_to_address) : zlbl;
|
||||
} else {
|
||||
to_display = TR("shield_select_z");
|
||||
}
|
||||
ImGui::SetNextItemWidth(-1);
|
||||
if (ImGui::BeginCombo("##ToAddr", to_display.c_str())) {
|
||||
for (size_t i = 0; i < state.z_addresses.size(); i++) {
|
||||
std::string label = state.z_addresses[i].address;
|
||||
if (label.length() > static_cast<size_t>(addrLbl.truncate))
|
||||
label = label.substr(0, addrFront.truncate) + "..." + label.substr(label.length() - addrBack.truncate);
|
||||
const auto& za = state.z_addresses[i];
|
||||
// Label (or ellipsized address) + balance + watch-only marker, like the from-combo. (F063)
|
||||
const std::string zlbl = app->getAddressLabel(za.address);
|
||||
char item[208];
|
||||
std::snprintf(item, sizeof(item), "%s (%s DRGX)%s",
|
||||
zlbl.empty() ? shortAddr(za.address).c_str() : zlbl.c_str(),
|
||||
fmtAmt(za.balance).c_str(),
|
||||
za.isSpendable() ? "" : TR("shield_watch_only_suffix"));
|
||||
bool selected = (s_selected_zaddr_idx == static_cast<int>(i));
|
||||
if (ImGui::Selectable(label.c_str(), selected)) {
|
||||
if (ImGui::Selectable(item, selected)) {
|
||||
s_selected_zaddr_idx = static_cast<int>(i);
|
||||
strncpy(s_to_address, state.z_addresses[i].address.c_str(), sizeof(s_to_address) - 1);
|
||||
strncpy(s_to_address, za.address.c_str(), sizeof(s_to_address) - 1);
|
||||
s_to_address[sizeof(s_to_address) - 1] = '\0';
|
||||
}
|
||||
if (selected) ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
@@ -683,7 +697,23 @@ void ShieldDialog::render(App* app)
|
||||
if (s_fee < 0.0) s_fee = 0.0;
|
||||
if (s_fee > 1.0) s_fee = 1.0;
|
||||
ImGui::SameLine(); ImGui::TextDisabled("DRGX");
|
||||
ImGui::SameLine();
|
||||
{
|
||||
std::string resetLbl = std::string(TR("fee_reset")) + "##FeeReset";
|
||||
if (material::TactileButton(resetLbl.c_str(), ImVec2(0, 0), S.resolveFont(cancelBtn.font)))
|
||||
s_fee = DRAGONX_DEFAULT_FEE; // F064
|
||||
}
|
||||
material::Type().textColored(material::TypeStyle::Caption, material::OnSurfaceMedium(), TR("merge_fee_hint"));
|
||||
// Default fee + out-of-range warning (0, or far above the default). (F064)
|
||||
{
|
||||
char dfh[64];
|
||||
std::snprintf(dfh, sizeof(dfh), TR("fee_default_hint"), fmtAmt(DRAGONX_DEFAULT_FEE).c_str());
|
||||
material::Type().textColored(material::TypeStyle::Caption, material::OnSurfaceDisabled(), dfh);
|
||||
if (s_fee <= 0.0)
|
||||
material::Type().textColored(material::TypeStyle::Caption, material::Warning(), TR("fee_zero_warn"));
|
||||
else if (s_fee > DRAGONX_DEFAULT_FEE * 10.0)
|
||||
material::Type().textColored(material::TypeStyle::Caption, material::Warning(), TR("fee_high_warn"));
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::TextUnformatted(TR("merge_max_inputs"));
|
||||
|
||||
@@ -2929,6 +2929,13 @@ void I18n::loadBuiltinEnglish()
|
||||
strings_["merge_no_spendable"] = "No spendable inputs to consolidate yet.";
|
||||
strings_["merge_where"] = "Where should the funds go?";
|
||||
strings_["merge_into_one"] = "Into one address";
|
||||
strings_["merge_into_one_tip"] = "Moves everything into the chosen address (merges labels and links those funds together).";
|
||||
strings_["merge_keep_each_tip"] = "Balances each address's own notes back into that address — keeps funds separated.";
|
||||
strings_["shield_watch_only_suffix"] = " (watch-only)";
|
||||
strings_["fee_reset"] = "Reset";
|
||||
strings_["fee_default_hint"] = "default %s DRGX";
|
||||
strings_["fee_zero_warn"] = "A zero fee may never confirm.";
|
||||
strings_["fee_high_warn"] = "Well above the default fee \xE2\x80\x94 double-check this.";
|
||||
strings_["merge_keep_each"] = "Keep in each address";
|
||||
strings_["merge_keep_each_desc"] = "Each address's notes are merged back into that same address, so funds you keep apart under different labels stay apart. Shielded addresses only — transparent funds can only be shielded (Into one address).";
|
||||
strings_["merge_keep_each_none"] = "Every shielded address already holds a single note — nothing to consolidate.";
|
||||
|
||||
Reference in New Issue
Block a user