fix(send): result-driven status styling + full-precision USD preview

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 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 14:25:43 -05:00
parent e978db85ca
commit 6ed80d2d79

View File

@@ -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));
}
}