diff --git a/Cargo.lock b/Cargo.lock index 0318edb208e98758241785352d6a067141c5e8f4..cc201bd8842d54cb51e7a4eedbf0b9c7ffc444a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16034,6 +16034,7 @@ dependencies = [ "project", "prompt_store", "recent_projects", + "remote", "serde_json", "settings", "theme", diff --git a/crates/sidebar/Cargo.toml b/crates/sidebar/Cargo.toml index b788fd0c00aebc5d6c4acda0df2719e9adf9af11..f66b1632657c9045575f55703be3651efb570bdb 100644 --- a/crates/sidebar/Cargo.toml +++ b/crates/sidebar/Cargo.toml @@ -32,6 +32,7 @@ gpui.workspace = true menu.workspace = true project.workspace = true recent_projects.workspace = true +remote.workspace = true settings.workspace = true theme.workspace = true theme_settings.workspace = true diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 538020c646b4eb2607a5adb686a60dbc03d37940..54e7dd32a49f3ebf0f314502cb542a0df07dca16 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -23,6 +23,7 @@ use menu::{ }; use project::{AgentId, AgentRegistryStore, Event as ProjectEvent, linked_worktree_short_name}; use recent_projects::sidebar_recent_projects::SidebarRecentProjects; +use remote::RemoteConnectionOptions; use ui::utils::platform_title_bar_height; use settings::Settings as _; @@ -1165,6 +1166,34 @@ impl Sidebar { } } + fn render_remote_project_icon( + &self, + ix: usize, + workspace: &Entity, + cx: &mut Context, + ) -> Option { + let project = workspace.read(cx).project().read(cx); + let remote_connection_options = project.remote_connection_options(cx)?; + + let remote_icon_per_type = match remote_connection_options { + RemoteConnectionOptions::Wsl(_) => IconName::Linux, + RemoteConnectionOptions::Docker(_) => IconName::Box, + _ => IconName::Server, + }; + + Some( + div() + .id(format!("remote-project-icon-{}", ix)) + .child( + Icon::new(remote_icon_per_type) + .size(IconSize::XSmall) + .color(Color::Muted), + ) + .tooltip(Tooltip::text("Remote Project")) + .into_any_element(), + ) + } + fn render_project_header( &self, ix: usize, @@ -1220,17 +1249,6 @@ impl Sidebar { .element_active .blend(color.element_background.opacity(0.2)); - let is_remote = workspace.read(cx).project().read(cx).is_via_remote_server(); - let remote_id = SharedString::from(format!("{id_prefix}-remote-project-{ix}")); - let remote_icon = div() - .id(remote_id) - .child( - Icon::new(IconName::Server) - .size(IconSize::XSmall) - .color(Color::Muted), - ) - .tooltip(Tooltip::text("Remote Project")); - h_flex() .id(id) .group(&group_name) @@ -1262,7 +1280,10 @@ impl Sidebar { ), ) .child(label) - .when(is_remote, |this| this.child(remote_icon)) + .when_some( + self.render_remote_project_icon(ix, workspace, cx), + |this, icon| this.child(icon), + ) .when(is_collapsed, |this| { this.when(has_running_threads, |this| { this.child(