agent: Improve pickers and their triggers styles in the panel (#40284)
Making all triggers have the same style when the picker is open (including changing the icon when the picker opens on top of the trigger). Also removed the footer from the ACP model selector given there's nothing to consider when that's the case; users can only configure LLM providers when using Zed's built-in agent. Release Notes: - N/A
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use gpui::{
|
||||
AnyView, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Subscription,
|
||||
AnyView, Corner, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Pixels, Point,
|
||||
Subscription,
|
||||
};
|
||||
use ui::{
|
||||
App, ButtonCommon, FluentBuilder as _, IntoElement, PopoverMenu, PopoverMenuHandle,
|
||||
PopoverTrigger, RenderOnce, Window, px,
|
||||
FluentBuilder as _, IntoElement, PopoverMenu, PopoverMenuHandle, PopoverTrigger, prelude::*,
|
||||
};
|
||||
|
||||
use crate::{Picker, PickerDelegate};
|
||||
@@ -19,6 +19,7 @@ where
|
||||
tooltip: TT,
|
||||
handle: Option<PopoverMenuHandle<Picker<P>>>,
|
||||
anchor: Corner,
|
||||
offset: Option<Point<Pixels>>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
@@ -43,6 +44,10 @@ where
|
||||
trigger,
|
||||
tooltip,
|
||||
handle: None,
|
||||
offset: Some(Point {
|
||||
x: px(0.0),
|
||||
y: px(-2.0),
|
||||
}),
|
||||
anchor,
|
||||
}
|
||||
}
|
||||
@@ -51,6 +56,11 @@ where
|
||||
self.handle = Some(handle);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn offset(mut self, offset: Point<Pixels>) -> Self {
|
||||
self.offset = Some(offset);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, TT, P> EventEmitter<DismissEvent> for PickerPopoverMenu<T, TT, P>
|
||||
@@ -86,9 +96,6 @@ where
|
||||
.trigger_with_tooltip(self.trigger, self.tooltip)
|
||||
.anchor(self.anchor)
|
||||
.when_some(self.handle, |menu, handle| menu.with_handle(handle))
|
||||
.offset(gpui::Point {
|
||||
x: px(0.0),
|
||||
y: px(-2.0),
|
||||
})
|
||||
.when_some(self.offset, |menu, offset| menu.offset(offset))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user