assistant2: Add button to open the prompt library (#23500)

This PR adds a button to open the prompt library from the configuration
view in Assistant2.

<img width="1309" alt="Screenshot 2025-01-22 at 5 38 08 PM"
src="https://github.com/user-attachments/assets/d514abca-53bc-4cde-bead-ab68a1994fb5"
/>

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-01-22 17:53:54 -05:00 committed by GitHub
parent 51fcb710d7
commit a1077c6fff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 76 additions and 11 deletions

View file

@ -1,9 +1,10 @@
use std::sync::Arc;
use collections::HashMap;
use gpui::{AnyView, AppContext, EventEmitter, FocusHandle, FocusableView, Subscription};
use gpui::{Action, AnyView, AppContext, EventEmitter, FocusHandle, FocusableView, Subscription};
use language_model::{LanguageModelProvider, LanguageModelProviderId, LanguageModelRegistry};
use ui::{prelude::*, ElevationIndex};
use zed_actions::assistant::DeployPromptLibrary;
pub struct AssistantConfiguration {
focus_handle: FocusHandle,
@ -143,6 +144,19 @@ impl Render for AssistantConfiguration {
.bg(cx.theme().colors().editor_background)
.size_full()
.overflow_y_scroll()
.child(
h_flex().p(DynamicSpacing::Base16.rems(cx)).child(
Button::new("open-prompt-library", "Open Prompt Library")
.style(ButtonStyle::Filled)
.full_width()
.icon(IconName::Book)
.icon_size(IconSize::Small)
.icon_position(IconPosition::Start)
.on_click(|_event, cx| {
cx.dispatch_action(DeployPromptLibrary.boxed_clone())
}),
),
)
.child(
v_flex()
.p(DynamicSpacing::Base16.rems(cx))