assistant2: Hide the status bar icon when disabled via the settings (#22981)

Marshall Bowers created

This PR makes it so the status bar icon for Assistant2 is hidden when it
is disabled via the settings.

Release Notes:

- N/A

Change summary

crates/assistant2/src/assistant_panel.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Detailed changes

crates/assistant2/src/assistant_panel.rs 🔗

@@ -279,7 +279,12 @@ impl Panel for AssistantPanel {
         Some(proto::PanelId::AssistantPanel)
     }
 
-    fn icon(&self, _cx: &WindowContext) -> Option<IconName> {
+    fn icon(&self, cx: &WindowContext) -> Option<IconName> {
+        let settings = AssistantSettings::get_global(cx);
+        if !settings.enabled || !settings.button {
+            return None;
+        }
+
         Some(IconName::ZedAssistant2)
     }