assistant: Show regenerate button only on hover (#15972)

Bennet Bo Fenner and Thorsten created

https://github.com/user-attachments/assets/92006a45-5b4e-4ec4-a056-9ef7dd76394d



Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>

Change summary

crates/assistant/src/assistant_panel.rs | 10 +++-------
crates/workspace/src/toolbar.rs         |  1 +
2 files changed, 4 insertions(+), 7 deletions(-)

Detailed changes

crates/assistant/src/assistant_panel.rs 🔗

@@ -255,7 +255,7 @@ impl PickerDelegate for SavedContextPickerDelegate {
                     .gap_2()
                     .child(
                         h_flex().flex_1().overflow_x_hidden().child(
-                            Label::new(context.summary.clone().unwrap_or("New Context".into()))
+                            Label::new(context.summary.clone().unwrap_or(DEFAULT_TAB_TITLE.into()))
                                 .size(LabelSize::Small),
                         ),
                     )
@@ -940,12 +940,7 @@ impl AssistantPanel {
         cx: &mut ViewContext<Self>,
     ) {
         context_editor.update(cx, |context_editor, cx| {
-            let new_summary = context_editor
-                .context
-                .read(cx)
-                .summary()
-                .map(|s| s.text.clone())
-                .unwrap_or_else(|| context_editor.title(cx).to_string());
+            let new_summary = context_editor.title(cx).to_string();
             self.model_summary_editor.update(cx, |summary_editor, cx| {
                 if summary_editor.text(cx) != new_summary {
                     summary_editor.set_text(new_summary, cx);
@@ -3106,6 +3101,7 @@ impl Render for ContextEditorToolbarItem {
                 left_side
                     .child(
                         IconButton::new("regenerate-context", IconName::ArrowCircle)
+                            .visible_on_hover("toolbar")
                             .tooltip(|cx| Tooltip::text("Regenerate Summary", cx))
                             .on_click(cx.listener(move |_, _, cx| {
                                 cx.emit(ContextEditorToolbarItemEvent::RegenerateSummary)

crates/workspace/src/toolbar.rs 🔗

@@ -96,6 +96,7 @@ impl Render for Toolbar {
         let has_right_items = self.right_items().count() > 0;
 
         v_flex()
+            .group("toolbar")
             .p(Spacing::Large.rems(cx))
             .when(has_left_items || has_right_items, |this| {
                 this.gap(Spacing::Large.rems(cx))