From 56f7f18033039b789aabb5f6b661b4fb77a2b4a6 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 6 Feb 2024 10:18:17 -0500 Subject: [PATCH] Hide the chat message editor when there is no active chat (#7441) This PR makes it so the chat message editor is hidden when not in an active chat. Release Notes: - Changed the chat message editor to be hidden when not in an active chat. --- crates/collab_ui/src/chat_panel.rs | 41 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index 88ee461dee537e42c07bfd718da53868e9209713..804bd3acf8831834c1a255982409b0ecb6af3ec2 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -589,25 +589,28 @@ impl Render for ChatPanel { ) } })) - .child( - h_flex() - .when(!self.is_scrolled_to_bottom, |el| { - el.border_t_1().border_color(cx.theme().colors().border) - }) - .p_2() - .map(|el| { - if self.active_chat.is_some() { - el.child(self.message_editor.clone()) - } else { - el.child( - div() - .rounded_md() - .h_6() - .w_full() - .bg(cx.theme().colors().editor_background), - ) - } - }), + .children( + Some( + h_flex() + .when(!self.is_scrolled_to_bottom, |el| { + el.border_t_1().border_color(cx.theme().colors().border) + }) + .p_2() + .map(|el| { + if self.active_chat.is_some() { + el.child(self.message_editor.clone()) + } else { + el.child( + div() + .rounded_md() + .h_6() + .w_full() + .bg(cx.theme().colors().editor_background), + ) + } + }), + ) + .filter(|_| self.active_chat.is_some()), ) .into_any() }