From d68bc27aacf05aaee78898eb3d774f200982d406 Mon Sep 17 00:00:00 2001 From: DanS Date: Thu, 2 Jul 2026 02:49:19 -0500 Subject: [PATCH] feat(settings): make RPC CONNECTION a collapsible toggle (like Tools & Actions) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the static "RPC CONNECTION" overline header with a full-width clickable toggle (label + expand/collapse arrow, transparent button with hover) that reveals the Host/Port/Username/Password fields + auto-detected caption only when expanded — same idiom as the "Tools & Actions…" section. Collapsed by default (rpc_expanded). Field rendering/bindings unchanged. Full-node build clean; hygiene clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/ui/pages/settings_page.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/ui/pages/settings_page.cpp b/src/ui/pages/settings_page.cpp index 8bc7fb4..db38289 100644 --- a/src/ui/pages/settings_page.cpp +++ b/src/ui/pages/settings_page.cpp @@ -146,6 +146,7 @@ struct SettingsPageState { bool debug_expanded = false; bool effects_expanded = false; bool tools_expanded = false; + bool rpc_expanded = false; // Node & Security: reveal the RPC connection fields bool confirm_clear_ztx = false; bool confirm_delete_blockchain = false; bool confirm_rescan = false; @@ -2113,11 +2114,30 @@ void RenderSettingsPage(App* app) { if (ImGui::IsItemHovered()) material::Tooltip("%s", TR("tt_open_data_dir")); } - // -------------------- RPC -------------------- + // -------------------- RPC (collapsible, like Tools & Actions) -------------------- ImGui::Dummy(ImVec2(0, Layout::spacingSm())); - Type().textColored(TypeStyle::Overline, OnSurfaceMedium(), TR("rpc_connection")); - ImGui::Dummy(ImVec2(0, Layout::spacingXs())); { + ImFont* rpcHdrFont = Type().overline(); + const char* rpcArrow = s_settingsState.rpc_expanded ? ICON_MD_EXPAND_LESS : ICON_MD_EXPAND_MORE; + ImGui::PushFont(body2); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0,0,0,0)); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1,1,1,0.05f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1,1,1,0.08f)); + ImVec2 hdrPos = ImGui::GetCursorScreenPos(); + if (ImGui::Button("##RpcToggle", ImVec2(contentW, ImGui::GetFrameHeight()))) + s_settingsState.rpc_expanded = !s_settingsState.rpc_expanded; + if (ImGui::IsItemHovered()) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); + float textY = hdrPos.y + (ImGui::GetFrameHeight() - rpcHdrFont->LegacySize) * 0.5f; + dl->AddText(rpcHdrFont, rpcHdrFont->LegacySize, ImVec2(hdrPos.x, textY), OnSurfaceMedium(), TR("rpc_connection")); + ImFont* rpcIconFont = Type().iconSmall(); + if (!rpcIconFont) rpcIconFont = body2; + float rpcArrowW = rpcIconFont->CalcTextSizeA(rpcIconFont->LegacySize, FLT_MAX, 0, rpcArrow).x; + dl->AddText(rpcIconFont, rpcIconFont->LegacySize, ImVec2(hdrPos.x + contentW - rpcArrowW, textY), OnSurfaceMedium(), rpcArrow); + ImGui::PopStyleColor(3); + ImGui::PopFont(); + } + if (s_settingsState.rpc_expanded) { + ImGui::Dummy(ImVec2(0, Layout::spacingXs())); // Four fields (Host, Port, Username, Password) across one row when the // card is wide enough; otherwise 2x2. Each field is "label [input]". const char* hostLbl = TR("rpc_host");