Add title to assistant panel and move + to right

Nathan Sobo created

Change summary

crates/ai/src/assistant.rs        | 14 +++++++++++++-
crates/theme/src/theme.rs         |  1 +
styles/src/styleTree/assistant.ts |  6 +++++-
3 files changed, 19 insertions(+), 2 deletions(-)

Detailed changes

crates/ai/src/assistant.rs 🔗

@@ -418,13 +418,25 @@ impl View for AssistantPanel {
                 .aligned()
                 .into_any()
         } else {
+            let title = self.active_conversation_editor().map(|editor| {
+                Label::new(editor.read(cx).title(cx), style.title.text.clone())
+                    .contained()
+                    .with_style(style.title.container)
+                    .aligned()
+            });
+
             Flex::column()
                 .with_child(
                     Flex::row()
                         .with_child(
                             Self::render_hamburger_button(&style.hamburger_button).aligned(),
                         )
-                        .with_child(Self::render_plus_button(&style.plus_button).aligned())
+                        .with_children(title)
+                        .with_child(
+                            Self::render_plus_button(&style.plus_button)
+                                .aligned()
+                                .flex_float(),
+                        )
                         .contained()
                         .with_style(theme.workspace.tab_bar.container)
                         .expanded()

crates/theme/src/theme.rs 🔗

@@ -996,6 +996,7 @@ pub struct AssistantStyle {
     pub container: ContainerStyle,
     pub hamburger_button: IconStyle,
     pub plus_button: IconStyle,
+    pub title: ContainedText,
     pub message_header: ContainerStyle,
     pub sent_at: ContainedText,
     pub user_sender: Interactive<ContainedText>,

styles/src/styleTree/assistant.ts 🔗

@@ -37,9 +37,13 @@ export default function assistant(colorScheme: ColorScheme) {
             },
           },
           container: {
-            margin: { left: 8 },
+            margin: { right: 8 },
           }
         },
+        title: {
+          margin: { left: 8 },
+          ...text(layer, "sans", "default", { size: "sm" })
+        },
         savedConversation: {
           background: background(layer, "on"),
           hover: {