diff --git a/src/ui/windows/balance_tab.cpp b/src/ui/windows/balance_tab.cpp index 23a7f2e..18c7eae 100644 --- a/src/ui/windows/balance_tab.cpp +++ b/src/ui/windows/balance_tab.cpp @@ -721,6 +721,13 @@ static void RenderBalanceDonut(App* app) { if (usd_value > 0.0) snprintf(buf, sizeof(buf), "$%.2f USD", usd_value); else snprintf(buf, sizeof(buf), "$-.-- USD"); Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), buf); + { // total period-earnings beside the USD when the earnings toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + ImGui::SameLine(0, Layout::spacingMd()); + Type().textColored(TypeStyle::Caption, earnCol, earnText.c_str()); + } + } } RenderSyncBar(app, dl, vs); ImGui::Dummy(ImVec2(0, cGap)); @@ -922,6 +929,13 @@ static void RenderBalanceConsolidated(App* app) { if (usd_value > 0.0) snprintf(buf, sizeof(buf), "$%.2f USD", usd_value); else snprintf(buf, sizeof(buf), "$-.-- USD"); dl->AddText(capFont, capFont->LegacySize, ImVec2(cx, cy), OnSurfaceDisabled(), buf); + { // total period-earnings to the right of the USD when the earnings toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + float usdW = capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, buf).x; + dl->AddText(capFont, capFont->LegacySize, ImVec2(cx + usdW + Layout::spacingLg(), cy), earnCol, earnText.c_str()); + } + } // Market badge (top-right) { @@ -1297,6 +1311,15 @@ static void RenderBalanceVerticalStack(App* app) { dl->AddText(capFont, capFont->LegacySize, ImVec2(rowEnd.x - amtSz.x - rowPad, cy), i == 0 ? OnSurface() : rowInfos[i].accent, buf); + if (i == 0) { // total period-earnings, left of the Total row's amount, when the toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + float earnW = capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, earnText.c_str()).x; + dl->AddText(capFont, capFont->LegacySize, + ImVec2(rowEnd.x - amtSz.x - rowPad - Layout::spacingMd() - earnW, cy), + earnCol, earnText.c_str()); + } + } // Proportion bar (for shielded/transparent rows — fills gap between label and amount) if (i == 1 || i == 2) { @@ -1496,6 +1519,15 @@ static void RenderBalanceVertical2x2(App* app) { dl->AddText(capFont, capFont->LegacySize, ImVec2(cellMax.x - amtSz.x - rowPad, cy), cell.isMarket ? cell.accent : (row == 0 && col == 0 ? OnSurface() : cell.accent), buf); + if (row == 0 && col == 0) { // total period-earnings below the Total cell's amount, toggle on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + float earnW = capFont->CalcTextSizeA(capFont->LegacySize, 10000, 0, earnText.c_str()).x; + dl->AddText(capFont, capFont->LegacySize, + ImVec2(cellMax.x - earnW - rowPad, cy + capFont->LegacySize + 2.0f * dp), + earnCol, earnText.c_str()); + } + } // Proportion bar (shielded/transparent) if (cell.hasBar) { @@ -1603,6 +1635,13 @@ static void RenderBalanceShield(App* app) { if (usd_value > 0.0) snprintf(buf, sizeof(buf), "$%.2f USD", usd_value); else snprintf(buf, sizeof(buf), "$-.-- USD"); Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), buf); + { // total period-earnings beside the USD when the earnings toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + ImGui::SameLine(0, Layout::spacingMd()); + Type().textColored(TypeStyle::Caption, earnCol, earnText.c_str()); + } + } } RenderSyncBar(app, dl, vs); ImGui::Dummy(ImVec2(0, cGap)); @@ -1785,6 +1824,13 @@ static void RenderBalanceTimeline(App* app) { if (usd_value > 0.0) snprintf(buf, sizeof(buf), "$%.2f USD", usd_value); else snprintf(buf, sizeof(buf), "$-.-- USD"); Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), buf); + { // total period-earnings beside the USD when the earnings toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + ImGui::SameLine(0, Layout::spacingMd()); + Type().textColored(TypeStyle::Caption, earnCol, earnText.c_str()); + } + } } RenderSyncBar(app, dl, vs); ImGui::Dummy(ImVec2(0, cGap)); @@ -2151,6 +2197,13 @@ static void RenderBalanceMinimal(App* app) { else snprintf(buf, sizeof(buf), "$-.-- USD"); ImGui::SameLine(0, Layout::spacingLg()); Type().textColored(TypeStyle::Caption, OnSurfaceDisabled(), buf); + { // total period-earnings beside the USD when the earnings toggle is on + std::string earnText; ImU32 earnCol; + if (FormatTotalEarnings(app, earnText, earnCol)) { + ImGui::SameLine(0, Layout::spacingMd()); + Type().textColored(TypeStyle::Caption, earnCol, earnText.c_str()); + } + } RenderSyncBar(app, dl, vs);