feat(ui): width-responsiveness — content max-width cap + per-surface form/input clamps

Wide/ultrawide (1440-3440px) responsiveness was unhealthy: no page/content-level
max-width cap existed, and every card/form/table derived width from raw
GetContentRegionAvail().x with floor-only clamps, so surfaces stretched edge-to-edge
(2000-3000px inputs, ballooning cards, giant grid cells, 2000px+ dead row-voids).

Root cause: adopt the (previously dead-code) clamp helpers.
- New Layout::kContentMaxWidth() (~1600dp, tunable via ui.toml [layout]
  content-max-width; <=0 disables). Cap ##ContentArea to it and center the column in
  wider windows — every tab derives from this child, so one change tames the app at
  wide widths. No-op below the cap (fills as before), so 1080p/1440p are unaffected.

Per-surface upper-clamps (std::min(cap*dp, expr), floors preserved) where a single
element is still too wide even within the capped column:
- Settings: Theme/Layout/Language combos, the font-scale slider (~3000px -> 360dp),
  the effect sliders, Explorer URL and RPC credential fields.
- Send / Receive: cap the compose / receive cards to a readable form width and center
  them (Indent(pad+offset) so the auto-layout fields align with the hand-drawn card);
  the recent-tx lists below keep the full column width.
- Chat message bubbles + composer, mining pool URL/payout inputs + stats left/right
  split, contacts search, and the lite-network add-server row / server cards / status
  panel (capped + centered).
- Wizard: vertically center the cards when they fit (was top-anchored, leaving a void
  on tall monitors), compensating the content-height measurement so it can't oscillate.

The 1600 cap also subsumes the fixed-4-column balance grids (~400px cards) and the
right-anchored row dead-gaps (voids shrink from ~2700px to ~800px), so those are left
to the cap rather than blind column/row redesigns.

Verified at 1024/1280 (and via a temporary 900dp cap to exercise the cap+center path,
since the test display clamps to 1280) across full-node + Lite + Windows (ctest green)
and an adversarial diff review (clean). The true wide/ultrawide look and the 1600dp cap
value still want eyes on a real wide monitor.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-18 23:15:39 -05:00
co-authored by Claude Opus 4.8
parent ce8c7696d4
commit 9205addf55
11 changed files with 127 additions and 42 deletions
+8 -3
View File
@@ -189,8 +189,11 @@ void RenderMiningModeToggle(App* app, const WalletState& state, const MiningInfo
float perGroupExtra = iconBtnW * 2; // dropdown + bookmark
float remainW = contentEndX - inputsStartX - Layout::spacingSm() - resetBtnW
- Layout::spacingSm() - perGroupExtra * 2;
float urlW = std::max(60.0f, remainW * 0.30f);
float wrkW = std::max(40.0f, remainW * 0.70f);
// Floor keeps the inputs usable when cramped; the ceiling stops a
// single input sprawling absurdly wide on a large window (leftover
// space becomes right-side margin). Caps are logical px * dp.
float urlW = std::min(std::max(60.0f, remainW * 0.30f), 420.0f * dp);
float wrkW = std::min(std::max(40.0f, remainW * 0.70f), 560.0f * dp);
// Track positions for popup alignment
float urlGroupStartX = ImGui::GetCursorScreenPos().x;
@@ -451,7 +454,9 @@ void RenderMiningModeToggle(App* app, const WalletState& state, const MiningInfo
// --- Worker: Popup positioned below the input group ---
// Popup sized to fit full z-addresses without truncation;
// zero horizontal padding so item highlights are flush with edges.
float addrPopupW = std::max(wrkGroupW, availWidth * 0.55f);
// Wide enough for full z-addresses, but ceiling it so it doesn't span
// the whole window on a large display (leftover -> unused margin).
float addrPopupW = std::min(std::max(wrkGroupW, availWidth * 0.55f), 640.0f * dp);
ImGui::SetNextWindowPos(ImVec2(wrkGroupStartX, wrkGroupStartY + inputFrameH2));
ImGui::SetNextWindowSize(ImVec2(addrPopupW, 0));
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f * dp);