Open modal from zeta title bar button

This commit is contained in:
Agus Zubiaga 2025-01-22 12:36:44 -03:00
parent 4ae18e8ad4
commit d71f1fa832
4 changed files with 56 additions and 25 deletions

1
Cargo.lock generated
View file

@ -13394,6 +13394,7 @@ dependencies = [
"windows 0.58.0",
"workspace",
"zed_actions",
"zed_predict_tos",
]
[[package]]

View file

@ -48,6 +48,7 @@ telemetry.workspace = true
workspace.workspace = true
zed_actions.workspace = true
git_ui.workspace = true
zed_predict_tos.workspace = true
[target.'cfg(windows)'.dependencies]
windows.workspace = true

View file

@ -36,6 +36,7 @@ use ui::{
use util::ResultExt;
use workspace::{notifications::NotifyResultExt, Workspace};
use zed_actions::{OpenBrowser, OpenRecent, OpenRemote};
use zed_predict_tos::ZedPredictTos;
#[cfg(feature = "stories")]
pub use stories::*;
@ -206,39 +207,51 @@ impl Render for TitleBar {
)
.overflow_hidden()
.child(
h_flex()
.h_full()
.px_1()
.items_center()
.gap_1p5()
.bg(cx.theme().colors().text_accent.opacity(0.04))
.hover(|style| {
style.bg(cx.theme().colors().element_hover)
})
.border_r_1()
.border_color(
cx.theme().colors().editor_foreground.opacity(0.1),
)
.child(
Icon::new(IconName::ZedPredict)
.size(IconSize::Small),
)
ButtonLike::new("try-zed-predict")
.child(
h_flex()
.gap_0p5()
.h_full()
.px_1()
.items_center()
.gap_1p5()
.child(
Label::new("Introducing:")
.size(LabelSize::Small)
.color(Color::Muted),
Icon::new(IconName::ZedPredict)
.size(IconSize::Small),
)
.child(
Label::new("Zed AI's Edit Predictions")
.size(LabelSize::Small),
h_flex()
.gap_0p5()
.child(
Label::new("Introducing:")
.size(LabelSize::Small)
.color(Color::Muted),
)
.child(
Label::new(
"Zed AI's Edit Predictions",
)
.size(LabelSize::Small),
),
),
),
)
.on_click({
let workspace = self.workspace.clone();
let user_store = self.user_store.clone();
move |_, cx| {
let Some(workspace) = workspace.upgrade()
else {
return;
};
ZedPredictTos::toggle(
workspace,
user_store.clone(),
cx,
);
}
}),
)
.child(
IconButton::new("share", IconName::Close)
IconButton::new("close", IconName::Close)
.icon_size(IconSize::Indicator),
),
),

View file

@ -99,6 +99,22 @@ impl Render for ZedPredictTos {
.on_any_mouse_down(cx.listener(|this, _: &MouseDownEvent, cx| {
cx.focus(&this.focus_handle);
}))
.child({
let tab = |_n: u8| {
h_flex()
.px_10()
.bg(cx.theme().colors().text_accent.opacity(0.15))
.border_1()
.border_color(cx.theme().colors().text_accent.opacity(0.8))
.rounded_md()
.child(
Label::new("tab")
.color(Color::Muted),
)
};
v_flex().items_center().gap_3().w_full().child(tab(0).ml_neg_32()).child(tab(1)).child(tab(2).ml_32())
})
.child(
h_flex()
.w_full()