1//! Contains helper functions for constructing URLs to various Zed-related pages.
2//!
3//! These URLs will adapt to the configured server URL in order to construct
4//! links appropriate for the environment (e.g., by linking to a local copy of
5//! zed.dev in development).
6
7use gpui::App;
8use settings::Settings;
9
10use crate::ClientSettings;
11
12fn server_url(cx: &App) -> &str {
13 &ClientSettings::get_global(cx).server_url
14}
15
16/// Returns the URL to the account page on zed.dev.
17pub fn account_url(cx: &App) -> String {
18 format!("{server_url}/account", server_url = server_url(cx))
19}
20
21/// Returns the URL to the start trial page on zed.dev.
22pub fn start_trial_url(cx: &App) -> String {
23 format!(
24 "{server_url}/account/start-trial",
25 server_url = server_url(cx)
26 )
27}
28
29/// Returns the URL to the upgrade page on zed.dev.
30pub fn upgrade_to_zed_pro_url(cx: &App) -> String {
31 format!("{server_url}/account/upgrade", server_url = server_url(cx))
32}
33
34/// Returns the URL to Zed's terms of service.
35pub fn terms_of_service(cx: &App) -> String {
36 format!("{server_url}/terms-of-service", server_url = server_url(cx))
37}
38
39/// Returns the URL to Zed AI's privacy and security docs.
40pub fn ai_privacy_and_security(cx: &App) -> String {
41 format!(
42 "{server_url}/docs/ai/privacy-and-security",
43 server_url = server_url(cx)
44 )
45}
46
47/// Returns the URL to Zed AI's external agents documentation.
48pub fn external_agents_docs(cx: &App) -> String {
49 format!(
50 "{server_url}/docs/ai/external-agents",
51 server_url = server_url(cx)
52 )
53}