From 1cb9f6491761c147da4ae3ab0d5f7b2c837211df Mon Sep 17 00:00:00 2001 From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Date: Wed, 23 Oct 2024 09:49:44 -0300 Subject: [PATCH] ssh: Clean up bits of the main modal UI (#19604) This PR main relevant change is removing the logic we had inserted for keyboard nav scroll as that was unreliable; we need to figure out a better solution still. I'm also removing the visible on hover behavior for the scrollbar as that was making us lose the click and drag feature the component has. Lastly, I added a bit of right-margin in the delete icon button so that's not too crammed with the scrollbar. Release Notes: - N/A --- crates/recent_projects/src/remote_servers.rs | 36 +++++++------------- crates/remote/src/ssh_session.rs | 2 +- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 407f3eb292..654cb0a83d 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -373,24 +373,12 @@ impl RemoteServerProjects { } } - fn scroll_to_selected(&self, _: &mut ViewContext) { - if let Mode::Default(scroll_state) = &self.mode { - if let ui::ScrollableHandle::NonUniform(scroll_handle) = scroll_state.scroll_handle() { - if let Some(active_item) = self.selectable_items.active_item { - scroll_handle.scroll_to_item(active_item); - } - } - } - } - fn next_item(&mut self, _: &menu::SelectNext, cx: &mut ViewContext) { if !matches!(self.mode, Mode::Default(_) | Mode::ViewServerOptions(_, _)) { return; } self.selectable_items.next(cx); - cx.notify(); - self.scroll_to_selected(cx); } fn prev_item(&mut self, _: &menu::SelectPrev, cx: &mut ViewContext) { @@ -398,8 +386,6 @@ impl RemoteServerProjects { return; } self.selectable_items.prev(cx); - cx.notify(); - self.scroll_to_selected(cx); } pub fn project_picker( @@ -818,14 +804,19 @@ impl RemoteServerProjects { .child(Label::new(project.paths.join(", "))) .on_click(cx.listener(move |this, _, cx| callback(this, cx))) .end_hover_slot::(Some( - IconButton::new("remove-remote-project", IconName::TrashAlt) - .icon_size(IconSize::Small) - .shape(IconButtonShape::Square) - .on_click( - cx.listener(move |this, _, cx| this.delete_ssh_project(server_ix, ix, cx)), + div() + .mr_2() + .child( + // Right-margin to offset it from the Scrollbar + IconButton::new("remove-remote-project", IconName::TrashAlt) + .icon_size(IconSize::Small) + .shape(IconButtonShape::Square) + .size(ButtonSize::Large) + .tooltip(|cx| Tooltip::text("Delete Remote Project", cx)) + .on_click(cx.listener(move |this, _, cx| { + this.delete_ssh_project(server_ix, ix, cx) + })), ) - .size(ButtonSize::Large) - .tooltip(|cx| Tooltip::text("Delete Remote Project", cx)) .into_any_element(), )) } @@ -1217,7 +1208,6 @@ impl RemoteServerProjects { List::new() .empty_message( v_flex() - // .child(ListSeparator) .child(div().px_3().child( Label::new("No remote servers registered yet.").color(Color::Muted), )) @@ -1241,7 +1231,6 @@ impl RemoteServerProjects { Section::new().padded(false).child( v_flex() .min_h(rems(20.)) - .group("remote-projects-section") .size_full() .relative() .child(ListSeparator) @@ -1263,7 +1252,6 @@ impl RemoteServerProjects { ) .child( div() - .visible_on_hover("remote-projects-section") .occlude() .h_full() .absolute() diff --git a/crates/remote/src/ssh_session.rs b/crates/remote/src/ssh_session.rs index fc189f29fe..2ea8c315b7 100644 --- a/crates/remote/src/ssh_session.rs +++ b/crates/remote/src/ssh_session.rs @@ -1397,7 +1397,7 @@ impl SshRemoteConnection { check_interval ); delegate.set_status( - Some("Waiting for another Zed instance to finish uploading binary..."), + Some("Waiting for another Zed instance to finish uploading binary"), cx, ); smol::Timer::after(check_interval).await;