Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions crates/client/src/zed_urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! zed.dev in development).

use gpui::App;
use release_channel::ReleaseChannel;
use settings::Settings;

use crate::ClientSettings;
Expand All @@ -13,6 +14,21 @@ fn server_url(cx: &App) -> &str {
&ClientSettings::get_global(cx).server_url
}

fn docs_url(cx: &App) -> String {
let server_url = server_url(cx);
match ReleaseChannel::try_global(cx).unwrap_or_default() {
ReleaseChannel::Stable => {
format!("{server_url}/docs")
}
ReleaseChannel::Preview => {
format!("{server_url}/docs/preview")
}
ReleaseChannel::Dev | ReleaseChannel::Nightly => {
format!("{server_url}/docs/nightly")
}
}
}

/// Returns the URL to the account page on zed.dev.
pub fn account_url(cx: &App) -> String {
format!("{server_url}/account", server_url = server_url(cx))
Expand All @@ -39,21 +55,18 @@ pub fn terms_of_service(cx: &App) -> String {
/// Returns the URL to Zed AI's privacy and security docs.
pub fn ai_privacy_and_security(cx: &App) -> String {
format!(
"{server_url}/docs/ai/privacy-and-security",
server_url = server_url(cx)
"{docs_url}/ai/privacy-and-security",
docs_url = docs_url(cx)
)
}

/// Returns the URL to Zed's edit prediction documentation.
pub fn edit_prediction_docs(cx: &App) -> String {
format!(
"{server_url}/docs/ai/edit-prediction",
server_url = server_url(cx)
)
format!("{docs_url}/ai/edit-prediction", docs_url = docs_url(cx))
}

pub fn skills_docs(cx: &App) -> String {
format!("{server_url}/docs/ai/skills", server_url = server_url(cx))
format!("{docs_url}/ai/skills", docs_url = docs_url(cx))
}

/// Returns the URL to Zed's ACP registry blog post.
Expand Down
Loading