Respect the setting to show/hide the assistant and chat panels (#3909)

Marshall Bowers created

This PR makes it so we respect the setting to show/hide the assistant
and chat panels.

Resolves https://github.com/zed-industries/community/issues/2370.

Release Notes:

- Fixed an issue where the settings to show/hide certain panels were not
respected.

Change summary

crates/assistant/src/assistant_panel.rs | 4 ++--
crates/collab_ui/src/chat_panel.rs      | 8 ++++++--
2 files changed, 8 insertions(+), 4 deletions(-)

Detailed changes

crates/assistant/src/assistant_panel.rs 🔗

@@ -1286,8 +1286,8 @@ impl Panel for AssistantPanel {
         }
     }
 
-    fn icon(&self, _cx: &WindowContext) -> Option<Icon> {
-        Some(Icon::Ai)
+    fn icon(&self, cx: &WindowContext) -> Option<Icon> {
+        Some(Icon::Ai).filter(|_| AssistantSettings::get_global(cx).button)
     }
 
     fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {

crates/collab_ui/src/chat_panel.rs 🔗

@@ -607,8 +607,12 @@ impl Panel for ChatPanel {
         "ChatPanel"
     }
 
-    fn icon(&self, _cx: &WindowContext) -> Option<ui::Icon> {
-        Some(ui::Icon::MessageBubbles)
+    fn icon(&self, cx: &WindowContext) -> Option<ui::Icon> {
+        if !is_channels_feature_enabled(cx) {
+            return None;
+        }
+
+        Some(ui::Icon::MessageBubbles).filter(|_| ChatPanelSettings::get_global(cx).button)
     }
 
     fn icon_tooltip(&self, _cx: &WindowContext) -> Option<&'static str> {