refactor(mining): extract the Earnings card into mining_earnings.{h,cpp} (audit #10, slice 1)
First incremental slice of decomposing the 2628-line mining_tab.cpp monolith (one giant RenderMiningTabContent function). The ~636-line "Earnings" card section is moved verbatim into RenderMiningEarnings(); mining_tab.cpp is now 1992 lines and calls it with the immediate-mode layout context as parameters (draw list, fonts, scale/spacing, glass spec, pool-mode flag). Behavior-preserving by construction: the body is byte-identical (the only additions are a `const bool s_pool_mode = poolMode` alias and a local scratch `buf` so the moved code keeps its original identifiers). The earnings-filter static moved with the card it belongs to. The compiler surfaced every enclosing dependency, which became explicit parameters. Verified: full-node + Windows + lite build, tests, hygiene, clean smoke start. Pending hands-on visual check of the Earnings card before extracting the next section. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
26
src/ui/windows/mining_earnings.h
Normal file
26
src/ui/windows/mining_earnings.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// DragonX Wallet - ImGui Edition
|
||||
// Copyright 2024-2026 The Hush Developers
|
||||
// Released under the GPLv3
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../data/wallet_state.h"
|
||||
#include "../material/draw_helpers.h" // GlassPanelSpec
|
||||
#include "imgui.h"
|
||||
|
||||
namespace dragonx {
|
||||
class App;
|
||||
namespace ui {
|
||||
|
||||
// Renders the mining "Earnings" card (Today | Yesterday | All Time | Est. Daily). Extracted
|
||||
// verbatim from the monolithic mining tab; the immediate-mode layout context (draw list, fonts,
|
||||
// scale/spacing, the glass-panel spec, and the parent's pool-mode flag) is passed in so the
|
||||
// rendering flows in sequence exactly as before.
|
||||
void RenderMiningEarnings(App* app, const WalletState& state, const MiningInfo& mining,
|
||||
ImDrawList* dl, ImFont* capFont, ImFont* sub1, ImFont* ovFont,
|
||||
float dp, float vs, float gap, float pad, bool isMiningActive,
|
||||
bool poolMode, float availWidth,
|
||||
const material::GlassPanelSpec& glassSpec, float sHdr, float gapOver);
|
||||
|
||||
} // namespace ui
|
||||
} // namespace dragonx
|
||||
Reference in New Issue
Block a user