Hide chat panel button when not in a call (#22200)

cc @nathansobo 

Release Notes:

- Hide chat panel button by default when not in a call
This commit is contained in:
Cole Miller 2024-12-19 14:32:45 -05:00 committed by GitHub
parent 2094d50514
commit 6231072d85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 86 additions and 8 deletions

View file

@ -1,4 +1,4 @@
use crate::{collab_panel, ChatPanelSettings};
use crate::{collab_panel, ChatPanelButton, ChatPanelSettings};
use anyhow::Result;
use call::{room, ActiveCall};
use channel::{ChannelChat, ChannelChatEvent, ChannelMessage, ChannelMessageId, ChannelStore};
@ -1135,7 +1135,14 @@ impl Panel for ChatPanel {
}
fn icon(&self, cx: &WindowContext) -> Option<ui::IconName> {
Some(ui::IconName::MessageBubbles).filter(|_| ChatPanelSettings::get_global(cx).button)
match ChatPanelSettings::get_global(cx).button {
ChatPanelButton::Never => None,
ChatPanelButton::Always => Some(ui::IconName::MessageBubbles),
ChatPanelButton::WhenInCall => ActiveCall::global(cx)
.read(cx)
.room()
.map(|_| ui::IconName::MessageBubbles),
}
}
fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {