Files
ObsidianDragon/src/ui/windows/balance_components.h
T
DanSandClaude Opus 4.8 064c9d1b61 feat(balance): inline period-earnings in the address list and totals
Surfaces the period-earnings aggregator in the Balance tab:
- Toolbar (shared address list): interval pills (1H/1D/1M/1Y), a received-
  vs-net mode toggle, and a global show-all toggle, placed right of "Hide 0
  Balances". The New Z-Address / New mining address buttons move to a footer
  row across from "Showing X of Y" to make room.
- Per address: the row draws its earnings on line 2, left of the $USD value
  (green positive, red negative in net mode), shown when the global toggle
  is on or the address is opted in via a new "Show/Hide earnings" right-click
  item. Works in every layout via the shared list.
- Total: FormatTotalEarnings (gated on the global toggle, so the default
  appearance is unchanged) is wired into the compact hero (dashboard/minimal)
  and the classic layout, left of / beside their USD figure. The remaining
  layouts' totals are not wired yet.
- Settings > Appearance: an "Earnings Display Format" selector (Coin /
  Coin + fiat / Fiat).

New i18n keys are translated into all eight locales; the CJK subset font is
rebuilt for the new glyphs. Builds + test suites pass on both variants.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-15 11:22:12 -05:00

43 lines
1.7 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// Shared rendering components used by every balance-tab layout (the animated hero, the address
// list, the recent-transactions strip, the sync bar) plus the balance-lerp animation state.
// Extracted from balance_tab.cpp so the layouts can be split into their own files later.
#pragma once
#include <string>
#include "imgui.h"
namespace dragonx {
class App;
namespace ui {
// Animated balance display values — lerp toward the wallet's real balances each frame. Defined in
// balance_tab.cpp (the lerp is advanced by UpdateBalanceLerp), shared with the components.
extern double s_dispTotal;
extern double s_dispShielded;
extern double s_dispTransparent;
extern double s_dispUnconfirmed;
// True while an async new-address generation is in flight.
extern bool s_generating_z_address;
void UpdateBalanceLerp(App* app);
void RenderCompactHero(App* app, ImDrawList* dl, float availW, float hs, float vs,
float heroHeightOverride = -1.0f);
void RenderSharedAddressList(App* app, float listH, float availW, float glassRound, float hs, float vs,
float reserveBelow = 0.0f);
void RenderSharedRecentTx(App* app, float recentH, float availW, float hs, float vs);
void RenderSyncBar(App* app, ImDrawList* dl, float vs);
// 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.
bool FormatTotalEarnings(App* app, std::string& outText, ImU32& outCol);
} // namespace ui
} // namespace dragonx