title_bar: Adjust tooltip for mute/deafen buttons (#21931)

Piotr Osiewicz created

Closes #21929 

Release Notes:

- N/A

Change summary

crates/title_bar/src/collab.rs | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)

Detailed changes

crates/title_bar/src/collab.rs 🔗

@@ -362,14 +362,20 @@ impl TitleBar {
                     },
                 )
                 .tooltip(move |cx| {
-                    Tooltip::text(
-                        if is_muted {
-                            "Unmute microphone"
+                    if is_muted {
+                        if is_deafened {
+                            Tooltip::with_meta(
+                                "Unmute microphone",
+                                None,
+                                "Audio will be unmuted",
+                                cx,
+                            )
                         } else {
-                            "Mute microphone"
-                        },
-                        cx,
-                    )
+                            Tooltip::text("Unmute microphone", cx)
+                        }
+                    } else {
+                        Tooltip::text("Mute microphone", cx)
+                    }
                 })
                 .style(ButtonStyle::Subtle)
                 .icon_size(IconSize::Small)
@@ -395,7 +401,12 @@ impl TitleBar {
                 .icon_size(IconSize::Small)
                 .selected(is_deafened)
                 .tooltip(move |cx| {
-                    Tooltip::with_meta("Deafen Audio", None, "Mic will be muted", cx)
+                    let (label, details) = if is_deafened {
+                        ("Unmute Audio", "Mic will be unmuted")
+                    } else {
+                        ("Mute Audio", "Mic will be muted")
+                    };
+                    Tooltip::with_meta(label, None, details, cx)
                 })
                 .on_click(move |_, cx| toggle_deafen(&Default::default(), cx))
                 .into_any_element(),