From 3dd1681d85769abdfedb86e120edcbf4a0bf8532 Mon Sep 17 00:00:00 2001 From: Fini Date: Mon, 1 Jun 2026 04:13:15 +0800 Subject: [PATCH] fix(settings): align agents nav icon --- .../src/widgets/agent_settings_panel.rs | 2 +- .../src/widgets/agent_settings_panel_tests.rs | 33 ++++++++++++++++++- crates/op-editor-ui/src/widgets/icons.rs | 4 +++ crates/op-editor-ui/src/widgets/icons_data.rs | 5 +++ .../op-editor-ui/src/widgets/icons_tests.rs | 1 + 5 files changed, 43 insertions(+), 2 deletions(-) diff --git a/crates/op-editor-ui/src/widgets/agent_settings_panel.rs b/crates/op-editor-ui/src/widgets/agent_settings_panel.rs index a5bf947fe..d860b7396 100644 --- a/crates/op-editor-ui/src/widgets/agent_settings_panel.rs +++ b/crates/op-editor-ui/src/widgets/agent_settings_panel.rs @@ -458,7 +458,7 @@ fn paint_sidebar( cx.backend.fill_round_rect(r, 8.0, theme.accent); } let icon = match tab { - AgentSettingsTab::Agents => Icon::Pencil, + AgentSettingsTab::Agents => Icon::Pen, AgentSettingsTab::Mcp => Icon::Terminal, AgentSettingsTab::Images => Icon::Image, AgentSettingsTab::System => Icon::Settings, diff --git a/crates/op-editor-ui/src/widgets/agent_settings_panel_tests.rs b/crates/op-editor-ui/src/widgets/agent_settings_panel_tests.rs index 386db55e9..63fef9664 100644 --- a/crates/op-editor-ui/src/widgets/agent_settings_panel_tests.rs +++ b/crates/op-editor-ui/src/widgets/agent_settings_panel_tests.rs @@ -11,6 +11,7 @@ use op_editor_core::EditorState; struct CaptureBackend { fills: Vec<(Rect, Color)>, icon_strokes: Vec<(Point2D, f32, usize)>, + svg_strokes: Vec<(String, Point2D, f32)>, ops: Vec<&'static str>, } @@ -26,8 +27,9 @@ impl RenderBackend for CaptureBackend { fn stroke_line(&mut self, _: Point2D, _: Point2D, _: Color, _: f32) {} fn fill_round_rect(&mut self, _: Rect, _: f32, _: Color) {} fn stroke_round_rect(&mut self, _: Rect, _: f32, _: Color, _: f32) {} - fn stroke_svg_path(&mut self, _: &str, at: Point2D, size: f32, _: Color, _: f32) { + fn stroke_svg_path(&mut self, d: &str, at: Point2D, size: f32, _: Color, _: f32) { self.icon_strokes.push((at, size, self.ops.len())); + self.svg_strokes.push((d.to_owned(), at, size)); self.ops.push("icon"); } fn save(&mut self) { @@ -97,6 +99,35 @@ fn close_button_paints_after_scrollable_content() { ); } +#[test] +fn agents_nav_icon_uses_ts_pen_glyph_not_pencil() { + const PEN_PATH: &str = + "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"; + let state = EditorState::default(); + let panel = AgentSettingsPanel::for_editor(&state); + let rect = panel.rect(1200.0, 800.0); + let mut backend = CaptureBackend::default(); + let mut cx = PaintCx { + backend: &mut backend, + }; + + panel.paint(&mut cx, rect); + + let agents_nav_icon = Point2D::new(rect.origin.x + 20.0, rect.origin.y + 63.0); + let strokes: Vec<_> = backend + .svg_strokes + .iter() + .filter(|(_, at, size)| { + (at.x - agents_nav_icon.x).abs() < 0.01 + && (at.y - agents_nav_icon.y).abs() < 0.01 + && (*size - 14.0).abs() < 0.01 + }) + .collect(); + + assert_eq!(strokes.len(), 1, "TS settings sidebar uses lucide Pen"); + assert_eq!(strokes[0].0, PEN_PATH); +} + #[test] fn hit_test_resolves_builtin_agent_api_key_field() { let mut state = EditorState::default(); diff --git a/crates/op-editor-ui/src/widgets/icons.rs b/crates/op-editor-ui/src/widgets/icons.rs index 10828e9d5..cbd521eeb 100644 --- a/crates/op-editor-ui/src/widgets/icons.rs +++ b/crates/op-editor-ui/src/widgets/icons.rs @@ -96,6 +96,8 @@ pub enum Icon { Copy, /// Pencil — rename / edit affordance. Pencil, + /// Pen — settings Agents tab glyph. + Pen, /// ArrowUp — move up. ArrowUp, /// ArrowDown — move down. @@ -286,6 +288,7 @@ impl Icon { Icon::Trash => TRASH, Icon::Copy => COPY, Icon::Pencil => PENCIL, + Icon::Pen => PEN, Icon::ArrowUp => ARROW_UP, Icon::ArrowDown => ARROW_DOWN, Icon::ChevronUp => CHEVRON_UP, @@ -426,6 +429,7 @@ impl Icon { "arrow-up-right" => Icon::ArrowUpRight, "rotate-cw" => Icon::RotateCw, "pencil" | "edit" => Icon::Pencil, + "pen" => Icon::Pen, "copy" => Icon::Copy, "save" => Icon::Save, "download" => Icon::Download, diff --git a/crates/op-editor-ui/src/widgets/icons_data.rs b/crates/op-editor-ui/src/widgets/icons_data.rs index c6921772a..5044be387 100644 --- a/crates/op-editor-ui/src/widgets/icons_data.rs +++ b/crates/op-editor-ui/src/widgets/icons_data.rs @@ -373,6 +373,11 @@ pub(super) const PENCIL: &[&str] = &[ "M15 5l4 4", ]; +// Lucide `pen`. +pub(super) const PEN: &[&str] = &[ + "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z", +]; + // Lucide `arrow-up`. pub(super) const ARROW_UP: &[&str] = &["M12 19V5", "M5 12l7-7 7 7"]; diff --git a/crates/op-editor-ui/src/widgets/icons_tests.rs b/crates/op-editor-ui/src/widgets/icons_tests.rs index 8e03e80ec..13f36f553 100644 --- a/crates/op-editor-ui/src/widgets/icons_tests.rs +++ b/crates/op-editor-ui/src/widgets/icons_tests.rs @@ -92,6 +92,7 @@ fn every_variant_paints_at_least_one_primitive() { Icon::Sparkles, Icon::Wand2, Icon::Close, + Icon::Pen, Icon::ChevronUp, Icon::MessageSquare, Icon::LayoutGrid,