Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Made the 'update zed to collaborate' button clickable

Mikayla Maki4ea7a24b93a5
diff --git a/Cargo.lock b/Cargo.lock
index abf9a12f0e3..e45ed5c4334 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1253,6 +1253,7 @@ name = "collab_ui"
version = "0.1.0"
dependencies = [
"anyhow",
+ "auto_update",
"call",
"client",
"clock",
diff --git a/crates/collab_ui/Cargo.toml b/crates/collab_ui/Cargo.toml
index ac13e361fd9..2dc4cc769a8 100644
--- a/crates/collab_ui/Cargo.toml
+++ b/crates/collab_ui/Cargo.toml
@@ -22,6 +22,7 @@ test-support = [
]
[dependencies]
+auto_update = { path = "../auto_update" }
call = { path = "../call" }
client = { path = "../client" }
clock = { path = "../clock" }
diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs
index 9f2c0fbee90..184a432ea39 100644
--- a/crates/collab_ui/src/collab_titlebar_item.rs
+++ b/crates/collab_ui/src/collab_titlebar_item.rs
@@ -504,7 +504,9 @@ impl CollabTitlebarItem {
workspace: &ViewHandle<Workspace>,
cx: &mut RenderContext<Self>,
) -> Option<ElementBox> {
- let theme = &cx.global::<Settings>().theme;
+ enum ConnectionStatusButton {}
+
+ let theme = &cx.global::<Settings>().theme.clone();
match &*workspace.read(cx).client().status().borrow() {
client::Status::ConnectionError
| client::Status::ConnectionLost
@@ -527,13 +529,20 @@ impl CollabTitlebarItem {
.boxed(),
),
client::Status::UpgradeRequired => Some(
- Label::new(
- "Please update Zed to collaborate".to_string(),
- theme.workspace.titlebar.outdated_warning.text.clone(),
- )
- .contained()
- .with_style(theme.workspace.titlebar.outdated_warning.container)
- .aligned()
+ MouseEventHandler::<ConnectionStatusButton>::new(0, cx, |_, _| {
+ Label::new(
+ "Please update Zed to collaborate".to_string(),
+ theme.workspace.titlebar.outdated_warning.text.clone(),
+ )
+ .contained()
+ .with_style(theme.workspace.titlebar.outdated_warning.container)
+ .aligned()
+ .boxed()
+ })
+ .with_cursor_style(CursorStyle::PointingHand)
+ .on_click(MouseButton::Left, |_, cx| {
+ cx.dispatch_action(auto_update::Check);
+ })
.boxed(),
),
_ => None,
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index d6e8a1a4beb..7be2818b61e 100644
--- a/crates/zed/src/zed.rs
+++ b/crates/zed/src/zed.rs
@@ -408,17 +408,19 @@ pub fn build_window_options(
}
fn restart(_: &Restart, cx: &mut gpui::MutableAppContext) {
- let cli_process = dbg!(cx.platform().path_for_auxiliary_executable("cli"))
+ let cli_process = cx
+ .platform()
+ .path_for_auxiliary_executable("cli")
.log_err()
.and_then(|path| {
Command::new(path)
- .args(["--restart-from", &format!("{}", dbg!(std::process::id()))])
+ .args(["--restart-from", &format!("{}", std::process::id())])
.spawn()
.log_err()
});
cx.spawn(|mut cx| async move {
- let did_quit = dbg!(cx.update(quit).await?);
+ let did_quit = cx.update(quit).await?;
if !did_quit {
if let Some(mut cli_process) = cli_process {
cli_process.kill().log_err();
@@ -467,7 +469,6 @@ fn quit(cx: &mut gpui::MutableAppContext) -> Task<Result<bool>> {
return Ok(false);
}
}
- dbg!("about to quit");
cx.platform().quit();
anyhow::Ok(true)
})