agent: Update callout URLs (#29897)
This PR updates the Agent callout URLs to go to the account page. Release Notes: - N/A
This commit is contained in:
parent
3e2abbf53b
commit
55eb0710ed
1 changed files with 13 additions and 14 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use client::zed_urls;
|
||||||
use component::{empty_example, example_group_with_title, single_example};
|
use component::{empty_example, example_group_with_title, single_example};
|
||||||
use gpui::{AnyElement, App, IntoElement, RenderOnce, Window};
|
use gpui::{AnyElement, App, IntoElement, RenderOnce, Window};
|
||||||
use language_model::RequestUsage;
|
use language_model::RequestUsage;
|
||||||
|
@ -17,7 +18,7 @@ impl UsageCallout {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RenderOnce for UsageCallout {
|
impl RenderOnce for UsageCallout {
|
||||||
fn render(self, _window: &mut Window, _cx: &mut App) -> impl IntoElement {
|
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||||
let (is_limit_reached, is_approaching_limit, remaining) = match self.usage.limit {
|
let (is_limit_reached, is_approaching_limit, remaining) = match self.usage.limit {
|
||||||
UsageLimit::Limited(limit) => {
|
UsageLimit::Limited(limit) => {
|
||||||
let percentage = self.usage.amount as f32 / limit as f32;
|
let percentage = self.usage.amount as f32 / limit as f32;
|
||||||
|
@ -43,40 +44,38 @@ impl RenderOnce for UsageCallout {
|
||||||
"Upgrade to continue, wait for the next reset, or switch to API key."
|
"Upgrade to continue, wait for the next reset, or switch to API key."
|
||||||
.to_string(),
|
.to_string(),
|
||||||
"Upgrade",
|
"Upgrade",
|
||||||
"https://zed.dev/pricing",
|
zed_urls::account_url(cx),
|
||||||
),
|
),
|
||||||
Plan::ZedProTrial => (
|
Plan::ZedProTrial => (
|
||||||
"Out of trial prompts",
|
"Out of trial prompts",
|
||||||
"Upgrade to Zed Pro to continue, or switch to API key.".to_string(),
|
"Upgrade to Zed Pro to continue, or switch to API key.".to_string(),
|
||||||
"Upgrade",
|
"Upgrade",
|
||||||
"https://zed.dev/pricing",
|
zed_urls::account_url(cx),
|
||||||
),
|
),
|
||||||
Plan::ZedPro => (
|
Plan::ZedPro => (
|
||||||
"Out of included prompts",
|
"Out of included prompts",
|
||||||
"Enable usage based billing to continue.".to_string(),
|
"Enable usage-based billing to continue.".to_string(),
|
||||||
"Manage",
|
"Manage",
|
||||||
"https://zed.dev/account",
|
zed_urls::account_url(cx),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
match self.plan {
|
match self.plan {
|
||||||
Plan::Free => (
|
Plan::Free => (
|
||||||
"Reaching Free tier limit soon",
|
"Reaching free plan limit soon",
|
||||||
format!(
|
format!(
|
||||||
"{} remaining - Upgrade to increase limit, or switch providers",
|
"{remaining} remaining - Upgrade to increase limit, or switch providers",
|
||||||
remaining
|
|
||||||
),
|
),
|
||||||
"Upgrade",
|
"Upgrade",
|
||||||
"https://zed.dev/pricing",
|
zed_urls::account_url(cx),
|
||||||
),
|
),
|
||||||
Plan::ZedProTrial => (
|
Plan::ZedProTrial => (
|
||||||
"Reaching Trial limit soon",
|
"Reaching trial limit soon",
|
||||||
format!(
|
format!(
|
||||||
"{} remaining - Upgrade to increase limit, or switch providers",
|
"{remaining} remaining - Upgrade to increase limit, or switch providers",
|
||||||
remaining
|
|
||||||
),
|
),
|
||||||
"Upgrade",
|
"Upgrade",
|
||||||
"https://zed.dev/pricing",
|
zed_urls::account_url(cx),
|
||||||
),
|
),
|
||||||
_ => return div().into_any_element(),
|
_ => return div().into_any_element(),
|
||||||
}
|
}
|
||||||
|
@ -98,7 +97,7 @@ impl RenderOnce for UsageCallout {
|
||||||
icon,
|
icon,
|
||||||
button_text,
|
button_text,
|
||||||
Box::new(move |_, _, cx| {
|
Box::new(move |_, _, cx| {
|
||||||
cx.open_url(url);
|
cx.open_url(&url);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue