From ed4154d91c05ab2412f4c4fea901df626d20de0c Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Sat, 20 Jun 2026 10:07:58 +0800 Subject: [PATCH] refactor(editor): sink remaining agent-settings cards to jian Card MCP server card + ACP agent card + 2 built-in provider cards (muted fill + border, r8/r10) now route through jian Card, looks preserved. The whole agent-settings card cluster (7 cards) now shares the canonical primitive. --- .../src/widgets/agent_settings_acp.rs | 9 +++++++-- .../src/widgets/agent_settings_builtin.rs | 18 ++++++++++++++---- .../src/widgets/agent_settings_mcp.rs | 8 ++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/crates/op-editor-ui/src/widgets/agent_settings_acp.rs b/crates/op-editor-ui/src/widgets/agent_settings_acp.rs index b1a9dea5c..9fef00c5f 100644 --- a/crates/op-editor-ui/src/widgets/agent_settings_acp.rs +++ b/crates/op-editor-ui/src/widgets/agent_settings_acp.rs @@ -14,6 +14,7 @@ use crate::widgets::icons::{draw_icon, Icon}; use crate::widgets::PaintCx; use crate::{Color, Point2D, Rect, TextLayout}; use jian_widgets::components::button::{Button, ButtonVariant}; +use jian_widgets::components::card::Card; use op_editor_core::agent_settings::{ AcpAgentConfig, AcpAgentConnectPhase, AcpAgentField, AcpConnectionType, AgentSettings, SettingsFocus, @@ -388,8 +389,12 @@ fn paint_acp_form( card: Rect, now_ms: u64, ) { - cx.backend.fill_round_rect(card, 10.0, theme.muted); - cx.backend.stroke_round_rect(card, 10.0, theme.border, 1.0); + Card { + fill: Some(theme.muted), + border: Some(theme.border), + radius: 10.0, + } + .paint(cx.backend, card, &tokens_from_theme(theme)); draw_text( cx, t_settings(ui, "acp.connectionType"), diff --git a/crates/op-editor-ui/src/widgets/agent_settings_builtin.rs b/crates/op-editor-ui/src/widgets/agent_settings_builtin.rs index 9f07ebd11..4b8e49acf 100644 --- a/crates/op-editor-ui/src/widgets/agent_settings_builtin.rs +++ b/crates/op-editor-ui/src/widgets/agent_settings_builtin.rs @@ -18,9 +18,11 @@ use crate::widgets::agent_settings_i18n::t as t_settings; use crate::widgets::agent_settings_switch::paint_settings_switch; use crate::widgets::brand_icons::{paint_brand_logo, BrandLogo}; use crate::widgets::button::paint_ghost_button_feedback; +use crate::widgets::button::tokens_from_theme; use crate::widgets::icons::{draw_icon, Icon}; use crate::widgets::PaintCx; use crate::{Color, Point2D, Rect, TextLayout}; +use jian_widgets::components::card::Card; use op_editor_core::agent_settings::{ AgentSettings, BuiltinAgentConfig, BuiltinAgentField, BuiltinAgentKind, BuiltinAgentPresetMenuTarget, SettingsFocus, @@ -442,8 +444,12 @@ fn paint_builtin_agent_form( card: Rect, now_ms: u64, ) { - cx.backend.fill_round_rect(card, 10.0, theme.muted); - cx.backend.stroke_round_rect(card, 10.0, theme.border, 1.0); + Card { + fill: Some(theme.muted), + border: Some(theme.border), + radius: 10.0, + } + .paint(cx.backend, card, &tokens_from_theme(theme)); let avatar = Rect { origin: Point2D::new(card.origin.x + 12.0, card.origin.y + 10.0), size: Point2D::new(28.0, 28.0), @@ -544,8 +550,12 @@ fn paint_compact_builtin_agent_card( card: Rect, ) { if agent.enabled { - cx.backend.fill_round_rect(card, 8.0, theme.muted); - cx.backend.stroke_round_rect(card, 8.0, theme.border, 1.0); + Card { + fill: Some(theme.muted), + border: Some(theme.border), + radius: 8.0, + } + .paint(cx.backend, card, &tokens_from_theme(theme)); } let avatar = Rect { origin: Point2D::new(card.origin.x + 12.0, card.origin.y + 12.0), diff --git a/crates/op-editor-ui/src/widgets/agent_settings_mcp.rs b/crates/op-editor-ui/src/widgets/agent_settings_mcp.rs index da609bd8a..59e5510f6 100644 --- a/crates/op-editor-ui/src/widgets/agent_settings_mcp.rs +++ b/crates/op-editor-ui/src/widgets/agent_settings_mcp.rs @@ -234,8 +234,12 @@ fn paint_server_card( now_ms: u64, ) { let card = server_card_rect(content); - cx.backend.fill_round_rect(card, 10.0, theme.muted); - cx.backend.stroke_round_rect(card, 10.0, theme.border, 1.0); + Card { + fill: Some(theme.muted), + border: Some(theme.border), + radius: 10.0, + } + .paint(cx.backend, card, &tokens_from_theme(theme)); let running = settings.mcp_server.running; let mid_y = card.origin.y + SERVER_CARD_H / 2.0; let dot = Rect {