fix(settings): align agents nav icon
This commit is contained in:
parent
f75041c29d
commit
3dd1681d85
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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"];
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue