From bcfc324426f075af9a79a64a3bb941fe63c83e0a Mon Sep 17 00:00:00 2001 From: DanS Date: Sun, 18 Oct 2026 13:07:43 -0500 Subject: [PATCH] feat(balance): labeled "Pending +X" chip with tooltip in more layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unconfirmed balance was shown in only one layout as an unlabeled "+X" that read as a mystery. It's now a labeled "Pending +X" chip with an "awaiting confirmations" tooltip — the Classic card's badge is relabeled, and the shared compact hero (Dashboard + Two-row layouts) now draws it too. (The remaining hand-drawn layouts can reuse the same pattern as a follow-up.) Co-Authored-By: Claude Opus 4.8 --- src/ui/windows/balance_components.cpp | 12 ++++++++++++ src/ui/windows/balance_tab.cpp | 5 +++-- src/util/i18n.cpp | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/ui/windows/balance_components.cpp b/src/ui/windows/balance_components.cpp index e998b57..779c8eb 100644 --- a/src/ui/windows/balance_components.cpp +++ b/src/ui/windows/balance_components.cpp @@ -136,6 +136,18 @@ void RenderCompactHero(App* app, ImDrawList* dl, float availW, float hs, float v ImGui::Dummy(ImVec2(capFont->CalcTextSizeA(tickerFontSize, 10000, 0, DRAGONX_TICKER).x + Layout::spacingLg(), lineH)); ImGui::SameLine(); + // Pending (unconfirmed) chip — so these layouts show it too, labeled, not just the Classic card. + if (s_dispUnconfirmed > 1e-9) { + snprintf(buf, sizeof(buf), TR("baltab_pending_chip"), s_dispUnconfirmed); + ImVec2 pp = ImGui::GetCursorScreenPos(); + dl->AddText(capFont, tickerFontSize, ImVec2(pp.x, tickerY), WithAlpha(Warning(), 230), buf); + float pw = capFont->CalcTextSizeA(tickerFontSize, 10000, 0, buf).x; + if (material::IsRectHovered(ImVec2(pp.x, tickerY), ImVec2(pp.x + pw, tickerY + tickerFontSize))) + material::Tooltip("%s", TR("baltab_pending_tip")); + ImGui::Dummy(ImVec2(pw + Layout::spacingLg(), lineH)); + ImGui::SameLine(); + } + // Total period-earnings (left of the USD) when the global earnings toggle is on. { std::string earnText; ImU32 earnCol; diff --git a/src/ui/windows/balance_tab.cpp b/src/ui/windows/balance_tab.cpp index 2b17fcd..a5bcb20 100644 --- a/src/ui/windows/balance_tab.cpp +++ b/src/ui/windows/balance_tab.cpp @@ -525,9 +525,9 @@ static void RenderBalanceClassic(App* app) WithAlpha(Success(), 160), buf); } - // Unconfirmed badge (top-right corner) + // Pending badge (top-right corner) — labeled so an unconfirmed "+X" doesn't read as a mystery. if (state.unconfirmed_balance > 0.0) { - snprintf(buf, sizeof(buf), "+%.4f", state.unconfirmed_balance); + snprintf(buf, sizeof(buf), TR("baltab_pending_chip"), state.unconfirmed_balance); ImVec2 ts = capFont->CalcTextSizeA( capFont->LegacySize, 10000, 0, buf); float bp = S.drawElement("tabs.balance.classic", "unconfirmed-badge-padding").sizeOr(4.0f) * dp; @@ -540,6 +540,7 @@ static void RenderBalanceClassic(App* app) dl->AddText(capFont, capFont->LegacySize, ImVec2(bMin.x + bp, bMin.y + bp * 0.5f), amberCol, buf); + if (material::IsRectHovered(bMin, bMax)) material::Tooltip("%s", TR("baltab_pending_tip")); } // Hover glow + click to Receive diff --git a/src/util/i18n.cpp b/src/util/i18n.cpp index b3a165a..6447834 100644 --- a/src/util/i18n.cpp +++ b/src/util/i18n.cpp @@ -1452,6 +1452,8 @@ void I18n::loadBuiltinEnglish() strings_["confirmations"] = "Confirmations"; strings_["confirmed"] = "Confirmed"; strings_["pending"] = "Pending"; + strings_["baltab_pending_chip"] = "Pending +%.4f"; + strings_["baltab_pending_tip"] = "Awaiting confirmations — not spendable yet; it moves to your available balance once confirmed."; strings_["sent"] = "sent"; strings_["received"] = "received"; strings_["mined"] = "mined";