diff --git a/crates/collab_ui/src/collab_titlebar_item.rs b/crates/collab_ui/src/collab_titlebar_item.rs index 17f4f06ff9de67d9c75ad57d204729e719938636..81e27361640807ab9647264c7bd3f3283b08d094 100644 --- a/crates/collab_ui/src/collab_titlebar_item.rs +++ b/crates/collab_ui/src/collab_titlebar_item.rs @@ -1,6 +1,6 @@ use crate::{ contact_notification::ContactNotification, contacts_popover, face_pile::FacePile, - toggle_deafen, toggle_mute, toggle_screen_sharing, ToggleDeafen, ToggleMute, + toggle_deafen, toggle_mute, toggle_screen_sharing, LeaveCall, ToggleDeafen, ToggleMute, ToggleScreenSharing, }; use call::{ActiveCall, ParticipantLocation, Room}; @@ -85,7 +85,7 @@ impl View for CollabTitlebarItem { { right_container .add_children(self.render_in_call_share_unshare_button(&workspace, &theme, cx)); - + right_container.add_child(self.render_leave_call(&theme, cx)); left_container .add_child(self.render_current_user(&workspace, &theme, &user, peer_id, cx)); left_container.add_children(self.render_collaborators(&workspace, &theme, &room, cx)); @@ -544,6 +544,43 @@ impl CollabTitlebarItem { .aligned() .into_any() } + fn render_leave_call(&self, theme: &Theme, cx: &mut ViewContext) -> AnyElement { + let icon = "icons/radix/exit.svg"; + let tooltip = "Leave call"; + + let titlebar = &theme.workspace.titlebar; + MouseEventHandler::::new(0, cx, |state, _| { + let style = titlebar + .toggle_speakers_button + .in_state(false) + .style_for(state); + Svg::new(icon) + .with_color(style.color) + .constrained() + .with_width(style.icon_width) + .aligned() + .constrained() + .with_width(style.button_width) + .with_height(style.button_width) + .contained() + .with_style(style.container) + }) + .with_cursor_style(CursorStyle::PointingHand) + .on_click(MouseButton::Left, move |_, _, cx| { + ActiveCall::global(cx) + .update(cx, |call, cx| call.hang_up(cx)) + .detach_and_log_err(cx); + }) + .with_tooltip::( + 0, + tooltip.into(), + Some(Box::new(LeaveCall)), + theme.tooltip.clone(), + cx, + ) + .aligned() + .into_any() + } fn render_in_call_share_unshare_button( &self, workspace: &ViewHandle, diff --git a/crates/collab_ui/src/collab_ui.rs b/crates/collab_ui/src/collab_ui.rs index 38a39762f4c4e34317d1c78ad041b9d988cef75d..a809b9c7e6d54b2504aa1f4a95e7257396e930c4 100644 --- a/crates/collab_ui/src/collab_ui.rs +++ b/crates/collab_ui/src/collab_ui.rs @@ -22,6 +22,7 @@ actions!( ToggleScreenSharing, ToggleMute, ToggleDeafen, + LeaveCall, ShareMicrophone ] );