Add stray UI polish to the SSH flow (#17798)

Some super subtle refinement opportunities I spotted while playing
around with this flow. There are mostly copywriting tweaks and some UI
tweaks here and there (including editing the modal horizontal padding).

--- 

Release Notes:

- N/A
This commit is contained in:
Danilo Leal 2024-09-13 16:05:34 -04:00 committed by GitHub
parent c71f052276
commit e145c13f73
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 21 deletions

View file

@ -929,7 +929,7 @@ impl DevServerProjects {
.on_click( .on_click(
cx.listener(move |this, _, cx| this.delete_ssh_server(ix, cx)), cx.listener(move |this, _, cx| this.delete_ssh_server(ix, cx)),
) )
.tooltip(|cx| Tooltip::text("Remove dev server", cx)) .tooltip(|cx| Tooltip::text("Remove Dev Server", cx))
})), })),
), ),
) )
@ -1162,9 +1162,10 @@ impl DevServerProjects {
}) })
}); });
const MANUAL_SETUP_MESSAGE: &str = "Click create to generate a token for this server. The next step will provide instructions for setting zed up on that machine."; const MANUAL_SETUP_MESSAGE: &str =
"Generate a token for this server and follow the steps to set Zed up on that machine.";
const SSH_SETUP_MESSAGE: &str = const SSH_SETUP_MESSAGE: &str =
"Enter the command you use to ssh into this server.\nFor example: `ssh me@my.server` or `ssh me@secret-box:2222`."; "Enter the command you use to SSH into this server.\nFor example: `ssh me@my.server` or `ssh me@secret-box:2222`.";
Modal::new("create-dev-server", Some(self.scroll_handle.clone())) Modal::new("create-dev-server", Some(self.scroll_handle.clone()))
.header( .header(
@ -1191,6 +1192,7 @@ impl DevServerProjects {
.child( .child(
v_flex() v_flex()
.w_full() .w_full()
.px_2()
.gap_y(Spacing::Large.rems(cx)) .gap_y(Spacing::Large.rems(cx))
.when(ssh_prompt.is_none(), |el| { .when(ssh_prompt.is_none(), |el| {
el.child( el.child(
@ -1346,9 +1348,9 @@ impl DevServerProjects {
) -> Div { ) -> Div {
self.markdown.update(cx, |markdown, cx| { self.markdown.update(cx, |markdown, cx| {
if kind == NewServerKind::Manual { if kind == NewServerKind::Manual {
markdown.reset(format!("Please log into '{}'. If you don't yet have zed installed, run:\n```\ncurl https://zed.dev/install.sh | bash\n```\nThen to start zed in headless mode:\n```\nzed --dev-server-token {}\n```", dev_server_name, access_token), cx); markdown.reset(format!("Please log into '{}'. If you don't yet have Zed installed, run:\n```\ncurl https://zed.dev/install.sh | bash\n```\nThen, to start Zed in headless mode:\n```\nzed --dev-server-token {}\n```", dev_server_name, access_token), cx);
} else { } else {
markdown.reset("Please wait while we connect over SSH.\n\nIf you run into problems, please [file a bug](https://github.com/zed-industries/zed), and in the meantime try using manual setup.".to_string(), cx); markdown.reset("Please wait while we connect over SSH.\n\nIf you run into problems, please [file a bug](https://github.com/zed-industries/zed), and in the meantime try using the manual setup.".to_string(), cx);
} }
}); });
@ -1420,15 +1422,14 @@ impl DevServerProjects {
) )
.when(is_signed_out, |modal| { .when(is_signed_out, |modal| {
modal modal
.section(Section::new().child(v_flex().mb_4().child(Label::new( .section(Section::new().child(div().child(Label::new(
"You are not currently signed in to Zed. Currently the remote development features are only available to signed in users. Please sign in to continue.", "To continue with the remote development features, you need to sign in to Zed.",
)))) ))))
.footer( .footer(
ModalFooter::new().end_slot( ModalFooter::new().end_slot(
Button::new("sign_in", "Sign in") Button::new("sign_in", "Sign in with GitHub")
.icon(IconName::Github) .icon(IconName::Github)
.icon_position(IconPosition::Start) .icon_position(IconPosition::Start)
.style(ButtonStyle::Filled)
.full_width() .full_width()
.on_click(cx.listener(|_, _, cx| { .on_click(cx.listener(|_, _, cx| {
let client = Client::global(cx).clone(); let client = Client::global(cx).clone();
@ -1447,17 +1448,15 @@ impl DevServerProjects {
.when(!is_signed_out, |modal| { .when(!is_signed_out, |modal| {
modal.section( modal.section(
Section::new().child( Section::new().child(
div().mb_4().child( div().child(
List::new() List::new()
.empty_message("No dev servers registered.") .empty_message("No dev servers registered yet.")
.header(Some( .header(Some(
ListHeader::new("Connections").end_slot( ListHeader::new("Connections").end_slot(
Button::new("register-dev-server-button", "Connect") Button::new("register-dev-server-button", "Connect New Server")
.icon(IconName::Plus) .icon(IconName::Plus)
.icon_position(IconPosition::Start) .icon_position(IconPosition::Start)
.tooltip(|cx| { .icon_color(Color::Muted)
Tooltip::text("Connect to a new server", cx)
})
.on_click(cx.listener(|this, _, cx| { .on_click(cx.listener(|this, _, cx| {
this.mode = Mode::CreateDevServer( this.mode = Mode::CreateDevServer(
CreateDevServer { CreateDevServer {
@ -1524,6 +1523,7 @@ impl Render for DevServerProjects {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement { fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
div() div()
.track_focus(&self.focus_handle) .track_focus(&self.focus_handle)
.p_2()
.elevation_3(cx) .elevation_3(cx)
.key_context("DevServerModal") .key_context("DevServerModal")
.on_action(cx.listener(Self::cancel)) .on_action(cx.listener(Self::cancel))
@ -1590,7 +1590,7 @@ pub fn reconnect_to_dev_server(
cx: &mut WindowContext, cx: &mut WindowContext,
) -> Task<Result<()>> { ) -> Task<Result<()>> {
let Some(ssh_connection_string) = dev_server.ssh_connection_string else { let Some(ssh_connection_string) = dev_server.ssh_connection_string else {
return Task::ready(Err(anyhow!("can't reconnect, no ssh_connection_string"))); return Task::ready(Err(anyhow!("Can't reconnect, no ssh_connection_string")));
}; };
let dev_server_store = dev_server_projects::Store::global(cx); let dev_server_store = dev_server_projects::Store::global(cx);
let get_access_token = dev_server_store.update(cx, |store, cx| { let get_access_token = dev_server_store.update(cx, |store, cx| {

View file

@ -1,6 +1,6 @@
use crate::{ use crate::{
h_flex, rems_from_px, v_flex, Clickable, Color, Headline, HeadlineSize, IconButton, h_flex, v_flex, Clickable, Color, Headline, HeadlineSize, IconButton, IconButtonShape,
IconButtonShape, IconName, Label, LabelCommon, LabelSize, Spacing, IconName, Label, LabelCommon, LabelSize, Spacing,
}; };
use gpui::{prelude::FluentBuilder, *}; use gpui::{prelude::FluentBuilder, *};
use smallvec::SmallVec; use smallvec::SmallVec;
@ -210,7 +210,7 @@ impl ParentElement for ModalRow {
impl RenderOnce for ModalRow { impl RenderOnce for ModalRow {
fn render(self, _cx: &mut WindowContext) -> impl IntoElement { fn render(self, _cx: &mut WindowContext) -> impl IntoElement {
h_flex().w_full().px_2().py_1().children(self.children) h_flex().w_full().py_1().children(self.children)
} }
} }
@ -326,7 +326,6 @@ impl RenderOnce for Section {
.border_color(cx.theme().colors().border) .border_color(cx.theme().colors().border)
.bg(section_bg) .bg(section_bg)
.py(Spacing::Medium.rems(cx)) .py(Spacing::Medium.rems(cx))
.px(Spacing::Large.rems(cx) - rems_from_px(1.0))
.gap_y(Spacing::Small.rems(cx)) .gap_y(Spacing::Small.rems(cx))
.child(div().flex().flex_1().size_full().children(self.children)), .child(div().flex().flex_1().size_full().children(self.children)),
) )
@ -334,7 +333,7 @@ impl RenderOnce for Section {
v_flex() v_flex()
.w_full() .w_full()
.gap_y(Spacing::Small.rems(cx)) .gap_y(Spacing::Small.rems(cx))
.px(Spacing::Large.rems(cx) + Spacing::Large.rems(cx)) .px(Spacing::Medium.rems(cx) + Spacing::Medium.rems(cx))
.children(self.children) .children(self.children)
}; };