feat(balance): labeled "Pending +X" chip with tooltip in more layouts
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user