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:
@@ -600,17 +600,11 @@ static void renderChainStats(App* app, float availWidth) {
|
||||
|
||||
float maxTextW = cardW * 0.34f;
|
||||
statusText = truncateHashToFit(statusText, capFont, maxTextW);
|
||||
ImVec2 textSz = capFont->CalcTextSizeA(capFont->LegacySize, 1000.0f, 0.0f, statusText.c_str());
|
||||
float pillPadX = Layout::spacingSm();
|
||||
float pillH = capFont->LegacySize + Layout::spacingXs() * 2.0f;
|
||||
float pillW = textSz.x + pillPadX * 2.0f;
|
||||
ImVec2 pillMin(cardMin.x + cardW - pad - pillW, cardMin.y + pad * 0.5f);
|
||||
ImVec2 pillMax(pillMin.x + pillW, pillMin.y + pillH);
|
||||
|
||||
dl->AddRectFilled(pillMin, pillMax, WithAlpha(pillCol, 32), pillH * 0.5f);
|
||||
dl->AddRect(pillMin, pillMax, WithAlpha(pillCol, 110), pillH * 0.5f, 0, 1.0f * dp);
|
||||
dl->AddText(capFont, capFont->LegacySize,
|
||||
ImVec2(pillMin.x + pillPadX, pillMin.y + Layout::spacingXs()), pillCol, statusText.c_str());
|
||||
ImVec2 pillPad(Layout::spacingSm(), Layout::spacingXs());
|
||||
ImVec2 pillSz = material::PillSize(statusText.c_str(), capFont, pillPad);
|
||||
ImVec2 pillMin(cardMin.x + cardW - pad - pillSz.x, cardMin.y + pad * 0.5f);
|
||||
material::DrawPill(dl, pillMin, statusText.c_str(), capFont, pillCol,
|
||||
WithAlpha(pillCol, 32), WithAlpha(pillCol, 110), pillPad);
|
||||
};
|
||||
|
||||
auto drawChainTip = [&](const ImVec2& cardMin, float cardW) {
|
||||
|
||||
Reference in New Issue
Block a user