@@ -65,6 +65,12 @@ pub fn init(cx: &mut App) {
65
65
panel. update ( cx, |panel, cx| panel. open_history ( window, cx) ) ;
66
66
}
67
67
} )
68
+ . register_action ( |workspace, _: & OpenConfiguration , window, cx| {
69
+ if let Some ( panel) = workspace. panel :: < AssistantPanel > ( cx) {
70
+ workspace. focus_panel :: < AssistantPanel > ( window, cx) ;
71
+ panel. update ( cx, |panel, cx| panel. open_configuration ( window, cx) ) ;
72
+ }
73
+ } )
68
74
. register_action ( |workspace, _: & NewPromptEditor , window, cx| {
69
75
if let Some ( panel) = workspace. panel :: < AssistantPanel > ( cx) {
70
76
workspace. focus_panel :: < AssistantPanel > ( window, cx) ;
@@ -113,7 +119,7 @@ pub struct AssistantPanel {
113
119
active_view : ActiveView ,
114
120
history_store : Entity < HistoryStore > ,
115
121
history : Entity < ThreadHistory > ,
116
- new_item_context_menu_handle : PopoverMenuHandle < ContextMenu > ,
122
+ assistant_dropdown_menu_handle : PopoverMenuHandle < ContextMenu > ,
117
123
width : Option < Pixels > ,
118
124
height : Option < Pixels > ,
119
125
}
@@ -213,7 +219,7 @@ impl AssistantPanel {
213
219
. unwrap ( ) ,
214
220
history_store : history_store. clone ( ) ,
215
221
history : cx. new ( |cx| ThreadHistory :: new ( weak_self, history_store, cx) ) ,
216
- new_item_context_menu_handle : PopoverMenuHandle :: default ( ) ,
222
+ assistant_dropdown_menu_handle : PopoverMenuHandle :: default ( ) ,
217
223
width : None ,
218
224
height : None ,
219
225
}
@@ -659,8 +665,9 @@ impl Panel for AssistantPanel {
659
665
}
660
666
661
667
impl AssistantPanel {
662
- fn render_toolbar ( & self , cx : & mut Context < Self > ) -> impl IntoElement {
668
+ fn render_toolbar ( & self , _window : & mut Window , cx : & mut Context < Self > ) -> impl IntoElement {
663
669
let thread = self . thread . read ( cx) ;
670
+ let focus_handle = self . focus_handle ( cx) ;
664
671
665
672
let title = match self . active_view {
666
673
ActiveView :: Thread => {
@@ -680,7 +687,7 @@ impl AssistantPanel {
680
687
} )
681
688
. unwrap_or_else ( || SharedString :: from ( "Loading Summary…" ) ) ,
682
689
ActiveView :: History => "History" . into ( ) ,
683
- ActiveView :: Configuration => "Assistant Settings" . into ( ) ,
690
+ ActiveView :: Configuration => "Settings" . into ( ) ,
684
691
} ;
685
692
686
693
h_flex ( )
@@ -720,57 +727,47 @@ impl AssistantPanel {
720
727
. border_color ( cx. theme ( ) . colors ( ) . border )
721
728
. gap ( DynamicSpacing :: Base02 . rems ( cx) )
722
729
. child (
723
- PopoverMenu :: new ( "assistant-toolbar-new-popover-menu" )
730
+ IconButton :: new ( "new" , IconName :: Plus )
731
+ . icon_size ( IconSize :: Small )
732
+ . style ( ButtonStyle :: Subtle )
733
+ . tooltip ( move |window, cx| {
734
+ Tooltip :: for_action_in (
735
+ "New Thread" ,
736
+ & NewThread ,
737
+ & focus_handle,
738
+ window,
739
+ cx,
740
+ )
741
+ } )
742
+ . on_click ( move |_event, window, cx| {
743
+ window. dispatch_action ( NewThread . boxed_clone ( ) , cx) ;
744
+ } ) ,
745
+ )
746
+ . child (
747
+ PopoverMenu :: new ( "assistant-menu" )
724
748
. trigger_with_tooltip (
725
- IconButton :: new ( "new" , IconName :: Plus )
749
+ IconButton :: new ( "new" , IconName :: Ellipsis )
726
750
. icon_size ( IconSize :: Small )
727
751
. style ( ButtonStyle :: Subtle ) ,
728
- Tooltip :: text ( "New… " ) ,
752
+ Tooltip :: text ( "Toggle Assistant Menu " ) ,
729
753
)
730
754
. anchor ( Corner :: TopRight )
731
- . with_handle ( self . new_item_context_menu_handle . clone ( ) )
755
+ . with_handle ( self . assistant_dropdown_menu_handle . clone ( ) )
732
756
. menu ( move |window, cx| {
733
757
Some ( ContextMenu :: build (
734
758
window,
735
759
cx,
736
760
|menu, _window, _cx| {
737
- menu. action ( "New Thread" , NewThread . boxed_clone ( ) )
738
- . action (
739
- "New Prompt Editor" ,
740
- NewPromptEditor . boxed_clone ( ) ,
741
- )
761
+ menu. action (
762
+ "New Prompt Editor" ,
763
+ NewPromptEditor . boxed_clone ( ) ,
764
+ )
765
+ . separator ( )
766
+ . action ( "History" , OpenHistory . boxed_clone ( ) )
767
+ . action ( "Settings" , OpenConfiguration . boxed_clone ( ) )
742
768
} ,
743
769
) )
744
770
} ) ,
745
- )
746
- . child (
747
- IconButton :: new ( "open-history" , IconName :: HistoryRerun )
748
- . icon_size ( IconSize :: Small )
749
- . style ( ButtonStyle :: Subtle )
750
- . tooltip ( {
751
- let focus_handle = self . focus_handle ( cx) ;
752
- move |window, cx| {
753
- Tooltip :: for_action_in (
754
- "History" ,
755
- & OpenHistory ,
756
- & focus_handle,
757
- window,
758
- cx,
759
- )
760
- }
761
- } )
762
- . on_click ( move |_event, window, cx| {
763
- window. dispatch_action ( OpenHistory . boxed_clone ( ) , cx) ;
764
- } ) ,
765
- )
766
- . child (
767
- IconButton :: new ( "configure-assistant" , IconName :: Settings )
768
- . icon_size ( IconSize :: Small )
769
- . style ( ButtonStyle :: Subtle )
770
- . tooltip ( Tooltip :: text ( "Assistant Settings" ) )
771
- . on_click ( move |_event, window, cx| {
772
- window. dispatch_action ( OpenConfiguration . boxed_clone ( ) , cx) ;
773
- } ) ,
774
771
) ,
775
772
) ,
776
773
)
@@ -1103,9 +1100,12 @@ impl Render for AssistantPanel {
1103
1100
. on_action ( cx. listener ( |this, _: & OpenHistory , window, cx| {
1104
1101
this. open_history ( window, cx) ;
1105
1102
} ) )
1103
+ . on_action ( cx. listener ( |this, _: & OpenConfiguration , window, cx| {
1104
+ this. open_configuration ( window, cx) ;
1105
+ } ) )
1106
1106
. on_action ( cx. listener ( Self :: open_active_thread_as_markdown) )
1107
1107
. on_action ( cx. listener ( Self :: deploy_prompt_library) )
1108
- . child ( self . render_toolbar ( cx) )
1108
+ . child ( self . render_toolbar ( window , cx) )
1109
1109
. map ( |parent| match self . active_view {
1110
1110
ActiveView :: Thread => parent
1111
1111
. child ( self . render_active_thread_or_empty_state ( window, cx) )
0 commit comments