feat(settings): make RPC CONNECTION a collapsible toggle (like Tools & Actions)

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) <noreply@anthropic.com>
This commit is contained in:
2026-07-02 02:49:19 -05:00
parent 51667b5a27
commit d68bc27aac

View File

@@ -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");