agent: Add use_modifier_to_send section in the settings view (#34866)

This PR also converts all of these switch-based settings to use the new
`SwitchField` component, introduced in
https://github.com/zed-industries/zed/pull/34713.

Release Notes:

- agent: Added the ability to change the `use_modifier_to_send` setting
from the agent panel settings UI.
This commit is contained in:
Danilo Leal 2025-07-22 09:42:34 -03:00 committed by GitHub
parent c7158f0bd7
commit a3850b3d38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 69 additions and 104 deletions

View file

@ -588,7 +588,7 @@ impl SwitchField {
toggle_state: toggle_state.into(),
on_click: Arc::new(on_click),
disabled: false,
color: SwitchColor::default(),
color: SwitchColor::Accent,
}
}
@ -634,6 +634,15 @@ impl RenderOnce for SwitchField {
}
}),
)
.when(!self.disabled, |this| {
this.on_click({
let on_click = self.on_click.clone();
let toggle_state = self.toggle_state;
move |_click, window, cx| {
(on_click)(&toggle_state.inverse(), window, cx);
}
})
})
}
}