Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add title to assistant panel and move + to right

Nathan Sobod78fbbc63e3c
diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rs
index e8faa48000a..d81434082df 100644
--- a/crates/ai/src/assistant.rs
+++ b/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()
diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs
index d76c3432d13..72976ad82bc 100644
--- a/crates/theme/src/theme.rs
+++ b/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>,
diff --git a/styles/src/styleTree/assistant.ts b/styles/src/styleTree/assistant.ts
index 94547bd154a..14bb836ee85 100644
--- a/styles/src/styleTree/assistant.ts
+++ b/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: {