feat(send): richer success card — amount, recipient, View in History (F093)

UX audit, Send surface: after a send the card showed only "Transaction sent" + a
truncated txid. It now reads "Sent 2.5000 DRGX to <label/address>" (captured at
dispatch, before the form clears) and offers a History button beside Copy. Choice
a. 2 new strings (English). Build + tests green. Send surface done except F056
(HiDPI), held for a cross-surface DPI pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 20:11:53 -06:00
co-authored by Claude Opus 4.8
parent d2b6d881e1
commit 684fb64f4b
2 changed files with 33 additions and 2 deletions
+31 -2
View File
@@ -56,6 +56,9 @@ static bool s_sending = false;
static double s_status_timestamp = 0.0;
static bool s_status_success = false;
static std::string s_result_txid = "";
static double s_result_amount = 0.0; // captured at send dispatch, for the success card (F093)
static std::string s_result_recipient = ""; // contact label or truncated address, captured at dispatch
static bool s_view_history_requested = false; // success-card "View in History" → handled in RenderSendTab
static double s_send_start_time = 0.0;
@@ -700,7 +703,15 @@ static void RenderTxProgress(ImDrawList* dl, float x, float y, float w,
ImVec2 iSz = iconFont->CalcTextSizeA(iconFont->LegacySize, 1000.0f, 0.0f, checkIcon);
dl->AddText(iconFont, iconFont->LegacySize,
ImVec2(ix, iy), Success(), checkIcon);
dl->AddText(body2, body2->LegacySize, ImVec2(ix + iSz.x + schema::UI().drawElement("tabs.send", "progress-icon-text-gap").size * dp, iy), Success(), TR("send_tx_sent"));
// Richer confirmation: "Sent 2.5000 DRGX to Alice" instead of a bare "Transaction sent". (F093)
if (!s_result_recipient.empty()) {
char amtbuf[48];
snprintf(amtbuf, sizeof(amtbuf), "%.4f %s", s_result_amount, DRAGONX_TICKER);
snprintf(buf, sizeof(buf), TR("send_sent_summary"), amtbuf, s_result_recipient.c_str());
} else {
snprintf(buf, sizeof(buf), "%s", TR("send_tx_sent"));
}
dl->AddText(body2, body2->LegacySize, ImVec2(ix + iSz.x + schema::UI().drawElement("tabs.send", "progress-icon-text-gap").size * dp, iy), Success(), buf);
if (!s_result_txid.empty()) {
float txY = iy + body2->LegacySize + schema::UI().drawElement("tabs.send", "txid-y-offset").size * dp;
@@ -712,7 +723,13 @@ static void RenderTxProgress(ImDrawList* dl, float x, float y, float w,
snprintf(buf, sizeof(buf), TR("send_txid_label"), dispTxid.c_str());
dl->AddText(capFont, capFont->LegacySize, ImVec2(ix + schema::UI().drawElement("tabs.send", "txid-label-x-offset").size * dp, txY),
OnSurfaceDisabled(), buf);
ImGui::SetCursorScreenPos(ImVec2(pMax.x - schema::UI().drawElement("tabs.send", "txid-copy-btn-right-offset").size * dp, txY - schema::UI().drawElement("tabs.send", "txid-copy-btn-y-offset").size * dp));
// History + Copy, right-aligned as a pair (History drawn first, Copy via SameLine to its right).
float btnY = txY - schema::UI().drawElement("tabs.send", "txid-copy-btn-y-offset").size * dp;
float copyRightOff = schema::UI().drawElement("tabs.send", "txid-copy-btn-right-offset").size * dp;
ImGui::SetCursorScreenPos(ImVec2(pMax.x - copyRightOff - 78.0f * dp, btnY));
if (TactileSmallButton(TR("send_view_history"), schema::UI().resolveFont("button")))
s_view_history_requested = true; // RenderSendTab (has app) performs the navigation
ImGui::SameLine(0, Layout::spacingSm());
if (TactileSmallButton(TR("copy"), schema::UI().resolveFont("button"))) {
ImGui::SetClipboardText(s_result_txid.c_str());
Notifications::instance().info(TR("send_txid_copied"));
@@ -981,6 +998,14 @@ void RenderSendConfirmPopup(App* app) {
} else {
s_sending = true;
s_send_start_time = ImGui::GetTime();
// Capture what's being sent now (the form is cleared in the callback) so the success card
// can say "Sent X to <label>". (F093)
s_result_amount = s_amount;
{
std::string who = app->getAddressLabel(s_to_address);
s_result_recipient = who.empty()
? util::truncateMiddle(std::string(s_to_address), 16) : who;
}
s_tx_status = std::string(TR("sending")) + "...";
std::string memo_str = (is_valid_z && s_memo[0]) ? s_memo : "";
@@ -1826,6 +1851,10 @@ void RenderSendTab(App* app)
{
ImVec2 progPos = ImGui::GetCursorScreenPos();
RenderTxProgress(dl, progPos.x, progPos.y, formW, body2, capFont, cardBottom);
if (s_view_history_requested) { // success-card "View in History" (RenderTxProgress has no app)
s_view_history_requested = false;
app->setCurrentPage(ui::NavPage::History);
}
if ((!s_tx_status.empty() || s_sending) && (s_sending || s_status_success)) {
ImGui::Dummy(ImVec2(0, sectionGap));
}
+2
View File
@@ -2800,6 +2800,8 @@ void I18n::loadBuiltinEnglish()
strings_["send_src_tag_mining"] = "Mining";
strings_["send_currency_toggle_tip"] = "Switch between entering the amount in DRGX or USD.";
strings_["send_recipient_prefilled"] = "Recipient filled in — enter an amount to send again.";
strings_["send_sent_summary"] = "Sent %s to %s";
strings_["send_view_history"] = "History";
strings_["send_tx_success"] = "Transaction sent successfully!";
strings_["send_status_unconfirmed"] = "Transaction status could not be confirmed";
strings_["send_err_needs_rescan"] = "Your wallet's shielded note data is out of date with the blockchain (this happens after a bootstrap or reindex). Run a full rescan via Settings -> Rescan Blockchain and let it finish completely, then try sending again.";