Initialize toggle chat panel action

Max Brunsfeld created

Change summary

crates/collab_ui2/src/chat_panel.rs | 13 ++++++++++---
crates/collab_ui2/src/collab_ui.rs  |  2 +-
2 files changed, 11 insertions(+), 4 deletions(-)

Detailed changes

crates/collab_ui2/src/chat_panel.rs 🔗

@@ -36,6 +36,15 @@ mod message_editor;
 const MESSAGE_LOADING_THRESHOLD: usize = 50;
 const CHAT_PANEL_KEY: &'static str = "ChatPanel";
 
+pub fn init(cx: &mut AppContext) {
+    cx.observe_new_views(|workspace: &mut Workspace, _| {
+        workspace.register_action(|workspace, _: &ToggleFocus, cx| {
+            workspace.toggle_panel_focus::<ChatPanel>(cx);
+        });
+    })
+    .detach();
+}
+
 pub struct ChatPanel {
     client: Arc<Client>,
     channel_store: Model<ChannelStore>,
@@ -259,12 +268,10 @@ impl ChatPanel {
                     .justify_between()
                     .z_index(1)
                     .bg(cx.theme().colors().background)
-                    .border()
-                    .border_color(gpui::red())
                     .child(Label::new(
                         self.active_chat
                             .as_ref()
-                            .and_then(|c| Some(c.0.read(cx).channel(cx)?.name.clone()))
+                            .and_then(|c| Some(format!("#{}", c.0.read(cx).channel(cx)?.name)))
                             .unwrap_or_default(),
                     ))
                     .child(

crates/collab_ui2/src/collab_ui.rs 🔗

@@ -35,7 +35,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
     collab_titlebar_item::init(cx);
     collab_panel::init(cx);
     channel_view::init(cx);
-    // chat_panel::init(cx);
+    chat_panel::init(cx);
     notifications::init(&app_state, cx);
 
     // cx.add_global_action(toggle_screen_sharing);