refactor(ui): extract shared ProgressBar / CopyableTextOverlay / DrawPill helpers
UI-standardization audit: three draw patterns were copy-pasted across tabs and dialogs. Promote each to a material:: helper and adopt at every verbatim site. Output is pixel-identical (same colors/geometry threaded through as params). - material::DrawProgressBar / ProgressBar — replaces 3 byte-identical rounded fill bars in the daemon/xmrig/bootstrap download dialogs. - material::CopyableTextOverlay — the click-to-copy affordance (hit button + hand cursor + tooltip + hover underline + clipboard) shared by the peers best-block hash and the 3 mining stats (difficulty/block/address). Returns "copied this frame" so callers keep their own toast (no ui-layer dependency). - material::DrawPill / PillSize — rounded bg + optional border + inset text badge, shared by the explorer status pill, the market Z/T chip, and the network official/custom tag. Divergent one-offs left in place (transactions status pills use schema rounding around pre-positioned multi-line text; the mining filter-pill is a button bg). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -182,16 +182,7 @@ private:
|
||||
: TR("xmrig_installing");
|
||||
Type().text(TypeStyle::Subtitle2, title);
|
||||
ImGui::Spacing();
|
||||
const float barH = 8.0f * dp;
|
||||
const float barW = fullW();
|
||||
const ImVec2 bMin = ImGui::GetCursorScreenPos();
|
||||
const ImVec2 bMax(bMin.x + barW, bMin.y + barH);
|
||||
ImDrawList* dl = ImGui::GetWindowDrawList();
|
||||
dl->AddRectFilled(bMin, bMax, IM_COL32(255, 255, 255, 30), 4.0f * dp);
|
||||
const float fillW = barW * (p.percent / 100.0f);
|
||||
if (fillW > 0)
|
||||
dl->AddRectFilled(bMin, ImVec2(bMin.x + fillW, bMax.y), Primary(), 4.0f * dp);
|
||||
ImGui::Dummy(ImVec2(0, barH));
|
||||
material::ProgressBar(fullW(), 8.0f * dp, p.percent / 100.0f);
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("%s", p.status_text.c_str());
|
||||
ImGui::Spacing();
|
||||
|
||||
Reference in New Issue
Block a user