Start plugging selected states into collab ui

This commit is contained in:
Nate Butler 2023-11-30 09:35:37 -05:00
parent 82b3efa16c
commit daf6201deb

View file

@ -103,17 +103,18 @@ impl Render for CollabTitlebarItem {
.update(cx, |this, cx| this.call_state().remote_participants(cx)) .update(cx, |this, cx| this.call_state().remote_participants(cx))
.log_err() .log_err()
.flatten(); .flatten();
let mic_icon = if self let is_muted = self
.workspace .workspace
.update(cx, |this, cx| this.call_state().is_muted(cx)) .update(cx, |this, cx| this.call_state().is_muted(cx))
.log_err() .log_err()
.flatten() .flatten()
.unwrap_or_default() .unwrap_or_default();
{ let is_deafened = self
ui::Icon::MicMute .workspace
} else { .update(cx, |this, cx| this.call_state().is_deafened(cx))
ui::Icon::Mic .log_err()
}; .flatten()
.unwrap_or_default();
let speakers_icon = if self let speakers_icon = if self
.workspace .workspace
.update(cx, |this, cx| this.call_state().is_deafened(cx)) .update(cx, |this, cx| this.call_state().is_deafened(cx))
@ -269,8 +270,16 @@ impl Render for CollabTitlebarItem {
h_stack() h_stack()
.gap_1() .gap_1()
.child( .child(
IconButton::new("mute-microphone", mic_icon) IconButton::new(
"mute-microphone",
if is_muted.clone() {
ui::Icon::MicMute
} else {
ui::Icon::Mic
},
)
.style(ButtonStyle2::Subtle) .style(ButtonStyle2::Subtle)
.selected(is_muted.clone())
.on_click({ .on_click({
let workspace = workspace.clone(); let workspace = workspace.clone();
move |_, cx| { move |_, cx| {
@ -285,6 +294,15 @@ impl Render for CollabTitlebarItem {
.child( .child(
IconButton::new("mute-sound", speakers_icon) IconButton::new("mute-sound", speakers_icon)
.style(ButtonStyle2::Subtle) .style(ButtonStyle2::Subtle)
.selected(is_deafened.clone())
.tooltip(move |cx| {
Tooltip::with_meta(
"Deafen Audio",
None,
"Mic will be muted",
cx,
)
})
.on_click({ .on_click({
let workspace = workspace.clone(); let workspace = workspace.clone();
move |_, cx| { move |_, cx| {