diff --git a/src/ui/windows/balance_components.cpp b/src/ui/windows/balance_components.cpp index 779c8eb..06f6781 100644 --- a/src/ui/windows/balance_components.cpp +++ b/src/ui/windows/balance_components.cpp @@ -97,6 +97,18 @@ bool FormatTotalEarnings(App* app, std::string& outText, ImU32& outCol) { } // Render compact hero line: logo + balance + USD + mining on one line +float DrawPendingChip(ImDrawList* dl, ImVec2 pos, float maxRight, ImFont* font, float fontSize) { + using namespace material; + if (s_dispUnconfirmed <= 1e-9) return 0.0f; + char buf[64]; + snprintf(buf, sizeof(buf), TR("baltab_pending_chip"), s_dispUnconfirmed); + const float w = font->CalcTextSizeA(fontSize, 10000.0f, 0.0f, buf).x; + if (pos.x + w > maxRight) return 0.0f; // would overflow the card — skip rather than overlap + dl->AddText(font, fontSize, pos, WithAlpha(Warning(), 230), buf); + if (IsRectHovered(pos, ImVec2(pos.x + w, pos.y + fontSize))) Tooltip("%s", TR("baltab_pending_tip")); + return w; +} + void RenderCompactHero(App* app, ImDrawList* dl, float availW, float hs, float vs, float heroHeightOverride) { using namespace material; char buf[64]; diff --git a/src/ui/windows/balance_components.h b/src/ui/windows/balance_components.h index c25fa70..9ecdcbd 100644 --- a/src/ui/windows/balance_components.h +++ b/src/ui/windows/balance_components.h @@ -33,6 +33,11 @@ void RenderSharedAddressList(App* app, float listH, float availW, float glassRou void RenderSharedRecentTx(App* app, float recentH, float availW, float hs, float vs); void RenderSyncBar(App* app, ImDrawList* dl, float vs); +// Draws a labeled "Pending +X" chip (unconfirmed balance) at `pos`, via the draw list only, when there +// is unconfirmed balance AND it fits left of `maxRight`. Returns the width drawn (0 if skipped). Adds a +// hover tooltip. Shared by the balance layouts so pending isn't visible in only one of them. +float DrawPendingChip(ImDrawList* dl, ImVec2 pos, float maxRight, ImFont* font, float fontSize); + // Total period-earnings for the whole wallet, formatted per the earnings settings. Returns false // (and leaves out* untouched) when the global earnings toggle is off, so layouts show it only when // the user has opted into the earnings view. Shared by RenderCompactHero and the layout totals. diff --git a/src/ui/windows/balance_tab.cpp b/src/ui/windows/balance_tab.cpp index a5bcb20..79df85c 100644 --- a/src/ui/windows/balance_tab.cpp +++ b/src/ui/windows/balance_tab.cpp @@ -748,6 +748,11 @@ static void RenderBalanceDonut(App* app) { dl->AddText(capFont, capFont->LegacySize, ImVec2(ImGui::GetCursorScreenPos().x, tickerY), OnSurfaceMedium(), DRAGONX_TICKER); + DrawPendingChip(dl, ImVec2(ImGui::GetCursorScreenPos().x + + capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, DRAGONX_TICKER).x + + Layout::spacingMd(), tickerY), + ImGui::GetCursorScreenPos().x + ImGui::GetContentRegionAvail().x, + capFont, capFont->LegacySize); ImGui::NewLine(); // USD value @@ -1663,6 +1668,11 @@ static void RenderBalanceShield(App* app) { dl->AddText(capFont, capFont->LegacySize, ImVec2(ImGui::GetCursorScreenPos().x, pos.y + heroSz.y - capFont->LegacySize), OnSurfaceMedium(), DRAGONX_TICKER); + DrawPendingChip(dl, ImVec2(ImGui::GetCursorScreenPos().x + + capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, DRAGONX_TICKER).x + + Layout::spacingMd(), pos.y + heroSz.y - capFont->LegacySize), + ImGui::GetCursorScreenPos().x + ImGui::GetContentRegionAvail().x, + capFont, capFont->LegacySize); ImGui::NewLine(); double usd_value = state.getBalanceUSD(); @@ -1852,6 +1862,11 @@ static void RenderBalanceTimeline(App* app) { dl->AddText(capFont, capFont->LegacySize, ImVec2(ImGui::GetCursorScreenPos().x, pos.y + heroSz.y - capFont->LegacySize), OnSurfaceMedium(), DRAGONX_TICKER); + DrawPendingChip(dl, ImVec2(ImGui::GetCursorScreenPos().x + + capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, DRAGONX_TICKER).x + + Layout::spacingMd(), pos.y + heroSz.y - capFont->LegacySize), + ImGui::GetCursorScreenPos().x + ImGui::GetContentRegionAvail().x, + capFont, capFont->LegacySize); ImGui::NewLine(); double usd_value = state.getBalanceUSD();