Skip to content

Commit 2249469

Browse files
jasonkeungoz-agent
andauthored
Add docs link for agent API keys (#12024)
## Description Adds a `Learn more` link to the agent API key helper text in the create API key modal. The link points to the docs page anchor that will explain personal vs. agent API keys after warpdotdev/docs#143 lands. ## Linked Issue No linked issue; requested from Slack. - [ ] The linked issue is labeled `ready-to-spec` or `ready-to-implement`. - [ ] Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes). ## Testing - `cargo fmt --manifest-path /workspace/warp/app/Cargo.toml -- /workspace/warp/app/src/settings_view/platform/create_api_key_modal.rs` - `cargo check --manifest-path /workspace/warp/Cargo.toml -p warp --lib` - [ ] I have manually tested my changes locally with `./script/run` ### Screenshots / Videos Not included; this is a text/link-only modal change and was validated with a targeted compile check in the sandbox. ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-NONE _Conversation: https://staging.warp.dev/conversation/51bd7b68-6b31-4e28-ac1a-c9876a736b8b_ _Run: https://oz.staging.warp.dev/runs/019e84f7-7104-7aa2-94e5-f832e226eb54_ _This PR was generated with [Oz](https://warp.dev/oz)._ Co-authored-by: Oz <oz-agent@warp.dev>
1 parent 1a3bdee commit 2249469

1 file changed

Lines changed: 33 additions & 11 deletions

File tree

app/src/settings_view/platform/create_api_key_modal.rs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
use chrono::Utc;
2+
use markdown_parser::{FormattedText, FormattedTextFragment, FormattedTextLine};
23
use pathfinder_geometry::vector::vec2f;
34
use warp_core::features::FeatureFlag;
45
use warp_server_client::auth::AgentIdentity;
56
use warpui::elements::{
67
Border, ChildAnchor, ChildView, ConstrainedBox, Container, CornerRadius, CrossAxisAlignment,
7-
Empty, Expanded, Fill, Flex, MainAxisAlignment, MainAxisSize, MouseStateHandle,
8-
OffsetPositioning, Padding, ParentElement, PositionedElementAnchor,
9-
PositionedElementOffsetBounds, Radius, SavePosition, Stack, Text,
8+
Empty, Expanded, Fill, Flex, FormattedTextElement, HighlightedHyperlink, MainAxisAlignment,
9+
MainAxisSize, MouseStateHandle, OffsetPositioning, Padding, ParentElement,
10+
PositionedElementAnchor, PositionedElementOffsetBounds, Radius, SavePosition, Stack, Text,
1011
};
1112
use warpui::ui_components::button::ButtonVariant;
1213
use warpui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
@@ -29,6 +30,8 @@ use crate::view_components::{Dropdown as DropdownView, DropdownItem};
2930
use crate::workspaces::user_workspaces::UserWorkspaces;
3031

3132
const OZ_AGENTS_URL: &str = "https://oz.warp.dev/agents?new=true";
33+
const API_KEY_DOCS_URL: &str =
34+
"https://docs.warp.dev/reference/cli/api-keys/#personal-vs-agent-keys";
3235

3336
const LABEL_FONT_SIZE: f32 = 14.;
3437
const INPUT_WIDTH: f32 = 428.; // 460px - (2 * 16px) padding
@@ -603,14 +606,33 @@ impl View for CreateApiKeyModal {
603606
RequestState::Succeeded => self.render_success_content(app),
604607
_ => {
605608
let selected_key_type = self.api_key_type_control.as_ref(app).selected_option();
606-
607-
let description_text = Text::new(
608-
selected_key_type.description(),
609-
appearance.ui_font_family(),
610-
LABEL_FONT_SIZE,
611-
)
612-
.with_color(theme.nonactive_ui_text_color().into())
613-
.finish();
609+
let description_text = if selected_key_type == ApiKeyType::Agent {
610+
FormattedTextElement::new(
611+
FormattedText::new([FormattedTextLine::Line(vec![
612+
FormattedTextFragment::plain_text(selected_key_type.description()),
613+
FormattedTextFragment::plain_text(" "),
614+
FormattedTextFragment::hyperlink("Learn more", API_KEY_DOCS_URL),
615+
])]),
616+
LABEL_FONT_SIZE,
617+
appearance.ui_font_family(),
618+
appearance.ui_font_family(),
619+
theme.nonactive_ui_text_color().into(),
620+
HighlightedHyperlink::default(),
621+
)
622+
.with_hyperlink_font_color(theme.accent().into_solid())
623+
.register_default_click_handlers(|url, _, ctx| {
624+
ctx.open_url(&url.url);
625+
})
626+
.finish()
627+
} else {
628+
Text::new(
629+
selected_key_type.description(),
630+
appearance.ui_font_family(),
631+
LABEL_FONT_SIZE,
632+
)
633+
.with_color(theme.nonactive_ui_text_color().into())
634+
.finish()
635+
};
614636

615637
let name_label = Text::new("Name", appearance.ui_font_family(), LABEL_FONT_SIZE)
616638
.with_color(theme.active_ui_text_color().into())

0 commit comments

Comments
 (0)