From 6ed80d2d7975c1739387f5c5bc1a108826daf83d Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 7 Jun 2026 14:25:43 -0500 Subject: [PATCH] fix(send): result-driven status styling + full-precision USD preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The transaction-status overlay decided error vs. success styling by searching the status string for "Error"/"Failed" — so under a non-English locale a failed send rendered as a green success. Drive it from the existing s_status_success flag instead. Also show the USD-mode DRGX preview at 8 dp so it matches the confirm panel and the amount actually sent (was 4 dp). Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/send_tab.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/windows/send_tab.cpp b/src/ui/windows/send_tab.cpp index d045039..36cbb55 100644 --- a/src/ui/windows/send_tab.cpp +++ b/src/ui/windows/send_tab.cpp @@ -499,9 +499,10 @@ static void RenderTxProgress(ImDrawList* dl, float x, float y, float w, } if (s_tx_status.empty() && !s_sending) return; - bool is_error = !s_sending && (s_tx_status.find("Error") != std::string::npos || - s_tx_status.find("Failed") != std::string::npos || - s_tx_status.find("error") != std::string::npos); + // Drive error styling from the authoritative result flag, not English substrings in a + // (translatable) status string — otherwise a failed send renders as a green success + // under a non-English locale. + bool is_error = !s_sending && !s_tx_status.empty() && !s_status_success; // ---- ERROR: absolute-positioned overlay, does not displace layout ---- if (is_error) { @@ -1313,7 +1314,9 @@ void RenderSendTab(App* app) { ImVec2 iMin = ImGui::GetItemRectMin(); ImVec2 iMax = ImGui::GetItemRectMax(); - snprintf(buf, sizeof(buf), "\xe2\x89\x88 %.4f %s", s_amount, DRAGONX_TICKER); + // Show full 8-dp precision so the inline DRGX preview matches the confirm + // panel and the amount actually sent (was %.4f — disagreed with the send). + snprintf(buf, sizeof(buf), "\xe2\x89\x88 %.8f %s", s_amount, DRAGONX_TICKER); ImFont* font = capFont; ImVec2 sz = font->CalcTextSizeA(font->LegacySize, 10000, 0, buf); float tx = iMax.x - sz.x - ImGui::GetStyle().FramePadding.x; @@ -1477,10 +1480,7 @@ void RenderSendTab(App* app) { ImVec2 progPos = ImGui::GetCursorScreenPos(); RenderTxProgress(dl, progPos.x, progPos.y, formW, body2, capFont, cardBottom); - if ((!s_tx_status.empty() || s_sending) && - (s_sending || (s_tx_status.find("Error") == std::string::npos && - s_tx_status.find("Failed") == std::string::npos && - s_tx_status.find("error") == std::string::npos))) { + if ((!s_tx_status.empty() || s_sending) && (s_sending || s_status_success)) { ImGui::Dummy(ImVec2(0, sectionGap)); } }