From c47305dd7b03879cc4c2575cdacf9cc29ff892bb Mon Sep 17 00:00:00 2001 From: Devzeth <47153906+devzeth@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:22:05 +0100 Subject: [PATCH] title_bar: Fix the order of the collab buttons (#25775) My previous #24761 and #25192 PR's changed the order of the buttons in the title_bar for collab, the logic is kept the same but the order is now as it was previously. Release Notes: - N/A Co-authored-by: Marshall Bowers --- crates/title_bar/src/collab.rs | 104 ++++++++++++++++----------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/crates/title_bar/src/collab.rs b/crates/title_bar/src/collab.rs index 3eaa5fcc6b8706956afd09b4043f706691a98f8b..24ca5ee8a253ce708893283d52708630e250696c 100644 --- a/crates/title_bar/src/collab.rs +++ b/crates/title_bar/src/collab.rs @@ -350,6 +350,44 @@ impl TitleBar { .into_any_element(), ); + if can_use_microphone { + children.push( + IconButton::new( + "mute-microphone", + if is_muted { + ui::IconName::MicMute + } else { + ui::IconName::Mic + }, + ) + .tooltip(move |window, cx| { + if is_muted { + if is_deafened { + Tooltip::with_meta( + "Unmute Microphone", + None, + "Audio will be unmuted", + window, + cx, + ) + } else { + Tooltip::simple("Unmute Microphone", cx) + } + } else { + Tooltip::simple("Mute Microphone", cx) + } + }) + .style(ButtonStyle::Subtle) + .icon_size(IconSize::Small) + .toggle_state(is_muted) + .selected_style(ButtonStyle::Tinted(TintColor::Error)) + .on_click(move |_, _window, cx| { + toggle_mute(&Default::default(), cx); + }) + .into_any_element(), + ); + } + children.push( IconButton::new( "mute-sound", @@ -386,61 +424,23 @@ impl TitleBar { .into_any_element(), ); - if can_use_microphone { + if can_use_microphone && screen_sharing_supported { children.push( - IconButton::new( - "mute-microphone", - if is_muted { - ui::IconName::MicMute + IconButton::new("screen-share", ui::IconName::Screen) + .style(ButtonStyle::Subtle) + .icon_size(IconSize::Small) + .toggle_state(is_screen_sharing) + .selected_style(ButtonStyle::Tinted(TintColor::Accent)) + .tooltip(Tooltip::text(if is_screen_sharing { + "Stop Sharing Screen" } else { - ui::IconName::Mic - }, - ) - .tooltip(move |window, cx| { - if is_muted { - if is_deafened { - Tooltip::with_meta( - "Unmute Microphone", - None, - "Audio will be unmuted", - window, - cx, - ) - } else { - Tooltip::simple("Unmute Microphone", cx) - } - } else { - Tooltip::simple("Mute Microphone", cx) - } - }) - .style(ButtonStyle::Subtle) - .icon_size(IconSize::Small) - .toggle_state(is_muted) - .selected_style(ButtonStyle::Tinted(TintColor::Error)) - .on_click(move |_, _window, cx| { - toggle_mute(&Default::default(), cx); - }) - .into_any_element(), + "Share Screen" + })) + .on_click(move |_, window, cx| { + toggle_screen_sharing(&Default::default(), window, cx) + }) + .into_any_element(), ); - - if screen_sharing_supported { - children.push( - IconButton::new("screen-share", ui::IconName::Screen) - .style(ButtonStyle::Subtle) - .icon_size(IconSize::Small) - .toggle_state(is_screen_sharing) - .selected_style(ButtonStyle::Tinted(TintColor::Accent)) - .tooltip(Tooltip::text(if is_screen_sharing { - "Stop Sharing Screen" - } else { - "Share Screen" - })) - .on_click(move |_, window, cx| { - toggle_screen_sharing(&Default::default(), window, cx) - }) - .into_any_element(), - ); - } } children.push(div().pr_2().into_any_element());