diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index 6fda4d594fe50e708a6f58df5ee8935536cc6061..999165b9d856c7cc9befdf95dbe090c00186968b 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -264,20 +264,43 @@ impl TitleBar { fn render_ssh_project_host(&self, cx: &mut ViewContext) -> Option { let host = self.project.read(cx).ssh_connection_string(cx)?; - let meta = SharedString::from(format!("Connected to: {host}")); - let indicator_color = match self.project.read(cx).ssh_connection_state(cx)? { + + let (indicator_color, meta) = match self.project.read(cx).ssh_connection_state(cx)? { + remote::ConnectionState::Connecting => (Color::Info, format!("Connecting to: {host}")), + remote::ConnectionState::Connected => (Color::Success, format!("Connected to: {host}")), + remote::ConnectionState::HeartbeatMissed => ( + Color::Warning, + format!("Connection attempt to {host} missed. Retrying..."), + ), + remote::ConnectionState::Reconnecting => ( + Color::Warning, + format!("Lost connection to {host}. Reconnecting..."), + ), + remote::ConnectionState::Disconnected => { + (Color::Error, format!("Disconnected from {host}")) + } + }; + + let indicator_border_color = cx.theme().colors().title_bar_background; + + let icon_color = match self.project.read(cx).ssh_connection_state(cx)? { remote::ConnectionState::Connecting => Color::Info, - remote::ConnectionState::Connected => Color::Success, + remote::ConnectionState::Connected => Color::Default, remote::ConnectionState::HeartbeatMissed => Color::Warning, remote::ConnectionState::Reconnecting => Color::Warning, remote::ConnectionState::Disconnected => Color::Error, }; + + let meta = SharedString::from(meta); + let indicator = div() .absolute() - .size_1p5() - .right_0p5() - .bottom_0p5() + .size_2p5() + .right_0() + .bottom_0() .rounded_full() + .border_2() + .border_color(indicator_border_color) .bg(indicator_color.color(cx)); Some( @@ -287,6 +310,7 @@ impl TitleBar { IconButton::new("ssh-server-icon", IconName::Server) .icon_size(IconSize::Small) .shape(IconButtonShape::Square) + .icon_color(icon_color) .tooltip(move |cx| { Tooltip::with_meta( "Remote Project",