diff --git a/pebrel_app/src/gpui_shell/settings_pane.rs b/pebrel_app/src/gpui_shell/settings_pane.rs index 73e5e462a..28747706f 100644 --- a/pebrel_app/src/gpui_shell/settings_pane.rs +++ b/pebrel_app/src/gpui_shell/settings_pane.rs @@ -1589,7 +1589,7 @@ impl SettingsPane { 1 => self.section_appearance(window, cx), 2 => self.section_profiles(window, cx), 3 => self.section_providers(window, cx), - 4 => self.section_ssh(window, cx), + 4 => self.section_ssh(cx), 5 => self.section_network(cx), 6 => self.section_interaction(cx), 7 => self.section_keymap(cx), @@ -1826,7 +1826,7 @@ impl Render for SettingsPane { .when(!form_page && !application_page, |content| { content.pt(px(28.0)).pb(px(30.0)) }) - .when(mobile_page || self.active_section == 3, |content| content.p_0()) + .when(self.active_section == 3, |content| content.p_0()) .overflow_y_scrollbar() // Scrollable wraps the content in a block; the full-width flex // column keeps cards aligned when the window is resized. @@ -1846,7 +1846,7 @@ impl Render for SettingsPane { .pt(px(design::CONTENT_PAD_TOP)) .pb(px(design::CONTENT_PAD_BOTTOM)) }) - .when(matches!(self.active_section, 4 | 9 | 10 | MOBILE_SECTION | PLUGINS_SECTION), |content| { + .when(self.active_section == PLUGINS_SECTION, |content| { content.items_center() }) .when(application_page, |content| content.max_w(px(960.0))) diff --git a/pebrel_app/src/gpui_shell/settings_pane/agents.rs b/pebrel_app/src/gpui_shell/settings_pane/agents.rs index 1ed8c5fb4..97c2beecd 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/agents.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/agents.rs @@ -131,7 +131,6 @@ impl SettingsPane { } v_flex() .w_full() - .max_w(px(720.0)) .gap_4() .child( h_flex() diff --git a/pebrel_app/src/gpui_shell/settings_pane/agents/tests.rs b/pebrel_app/src/gpui_shell/settings_pane/agents/tests.rs index 5f10945e5..18b6f0082 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/agents/tests.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/agents/tests.rs @@ -63,7 +63,7 @@ fn fixture( } #[gpui::test] -fn agents_content_is_centered_and_paths_leave_room_for_hook_status(cx: &mut TestAppContext) { +fn agents_fill_settings_column_and_paths_leave_room_for_hook_status(cx: &mut TestAppContext) { let (pane, window, reply, _) = fixture(cx); drop(reply); pane.update(window, |pane, cx| { @@ -83,9 +83,8 @@ fn agents_content_is_centered_and_paths_leave_room_for_hook_status(cx: &mut Test let row = window.debug_bounds("agent-hook-row-0").unwrap(); let path = window.debug_bounds("agent-cli-path-0").unwrap(); let status = window.debug_bounds("agent-hook-status-0").unwrap(); - let center = px((width + SETTINGS_NAV_WIDTH) / 2.0); - assert!((f32::from(row.center().x - center)).abs() <= 2.0); - assert!(row.size.width <= px(720.0)); + assert!((f32::from(row.left()) - (SETTINGS_NAV_WIDTH + 20.0)).abs() <= 2.0); + assert!((f32::from(row.right()) - (width - 20.0)).abs() <= 2.0); assert!(path.size.width > px(0.0)); assert!(path.right() <= status.left()); assert!(status.right() + px(40.0) <= row.right()); diff --git a/pebrel_app/src/gpui_shell/settings_pane/backup/setup.rs b/pebrel_app/src/gpui_shell/settings_pane/backup/setup.rs index c11b9a4fe..e30fc4b42 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/backup/setup.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/backup/setup.rs @@ -61,6 +61,8 @@ impl SettingsPane { Message::CloudScope, ]; let compact = window.viewport_size().width < px(960.0); + // 宽窗下单列存储选项会被拉成整行长条,改为两列。 + let cols = if compact { 1 } else { 2 }; let progress = div() .debug_selector(|| "backup-wizard-progress".into()) .grid() @@ -168,7 +170,7 @@ impl SettingsPane { .child(caption(l.text(lead), cx).max_w(px(520.0))), ); body = match step { - 1 => body.child(v_flex().w_full().flex_shrink_0().gap_2().children( + 1 => body.child(div().grid().grid_cols(cols).flex_shrink_0().gap_2().children( PROVIDERS.into_iter().enumerate().map( |(i, (protocol, nutstore, title, hint, icon))| { Button::new(("backup-provider", i)) diff --git a/pebrel_app/src/gpui_shell/settings_pane/backup/tests.rs b/pebrel_app/src/gpui_shell/settings_pane/backup/tests.rs index 4f368a701..d156652af 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/backup/tests.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/backup/tests.rs @@ -85,10 +85,15 @@ fn backup_wizard_requires_connection_and_matching_passwords(cx: &mut gpui::TestA cx.simulate_resize(gpui::size(px(width), px(1400.0))); draw(cx); let wizard = cx.debug_bounds("backup-wizard").unwrap(); - assert!(wizard.right() <= px(width)); - assert!(wizard.size.width <= px(700.0)); - let center = px((width + SETTINGS_NAV_WIDTH) / 2.0); - assert!(f32::from(wizard.center().x - center).abs() <= 2.0); + assert!((f32::from(wizard.left()) - (SETTINGS_NAV_WIDTH + 20.0)).abs() <= 2.0); + assert!((f32::from(wizard.right()) - (width - 20.0)).abs() <= 2.0); + let first = cx.debug_bounds("backup-provider-0").unwrap(); + let second = cx.debug_bounds("backup-provider-1").unwrap(); + if width >= 960.0 { + assert_eq!(second.top(), first.top(), "wide windows show storage in two columns"); + } else { + assert!(first.bottom() <= second.top()); + } assert!(cx.debug_bounds("backup-content-0").is_none()); } click(cx, "backup-provider-4"); @@ -404,7 +409,7 @@ fn backup_provider_rows_contain_titles_and_wrapped_hints(cx: &mut gpui::TestAppC ); } } - let mut previous_bottom = None; + let mut rows: Vec> = Vec::new(); let mut wrapped = false; for (row_selector, title_selector, hint_selector) in [ ("backup-provider-0", "backup-provider-title-0", "backup-provider-hint-0"), @@ -432,10 +437,14 @@ fn backup_provider_rows_contain_titles_and_wrapped_hints(cx: &mut gpui::TestAppC hint.left() >= row.left() && hint.right() <= row.right(), "hint exceeds row width" ); - if let Some(bottom) = previous_bottom { - assert!(bottom + px(4.0) <= row.top(), "provider rows overlap"); + for other in &rows { + assert!( + other.right() + px(4.0) <= row.left() + || other.bottom() + px(4.0) <= row.top(), + "provider rows overlap: {other:?}, {row:?}" + ); } - previous_bottom = Some(row.bottom()); + rows.push(row); wrapped |= hint.size.height > px(30.0); } if width == 600.0 { diff --git a/pebrel_app/src/gpui_shell/settings_pane/backup/view.rs b/pebrel_app/src/gpui_shell/settings_pane/backup/view.rs index 88503eebf..e48892110 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/backup/view.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/backup/view.rs @@ -56,7 +56,6 @@ impl SettingsPane { v_flex() .w_full() .flex_shrink_0() - .max_w(px(700.0)) .gap(px(super::super::design::GROUP_GAP)) .text_size(px(14.0)) .child( diff --git a/pebrel_app/src/gpui_shell/settings_pane/mobile/view.rs b/pebrel_app/src/gpui_shell/settings_pane/mobile/view.rs index cab5ff495..45e6b7b57 100644 --- a/pebrel_app/src/gpui_shell/settings_pane/mobile/view.rs +++ b/pebrel_app/src/gpui_shell/settings_pane/mobile/view.rs @@ -132,16 +132,12 @@ impl SettingsPane { .set_focused(self.mobile.port_input.read(cx).focus_handle(cx).is_focused(window)); let language = crate::gpui_shell::config::ui_language(cx); let phase = self.mobile.phase(); - // 原型的 812 包含两侧 56px 留白;窄窗收紧页边,不缩小二维码或按钮。 + // 窄窗把配对卡改为上下排列,不缩小二维码或按钮。 let narrow = f32::from(window.viewport_size().width) < 1000.0; let mut page = v_flex() .id("mobile-settings") .debug_selector(|| "mobile-settings".into()) .w_full() - .max_w(px(812.0)) - .px(px(if narrow { 24.0 } else { 56.0 })) - .pt(px(44.0)) - .pb(px(140.0)) .text_size(px(14.0)) .line_height(px(21.0)) .child( @@ -183,7 +179,7 @@ impl SettingsPane { if phase == Phase::Paired { page = page.child(self.mobile_connections(cx)).child(self.mobile_permissions(cx)); } - div().w_full().flex().justify_center().child(page) + div().w_full().child(page) } fn mobile_off(&self, cx: &Context) -> gpui::Stateful { diff --git a/pebrel_app/src/gpui_shell/ssh_settings/library.rs b/pebrel_app/src/gpui_shell/ssh_settings/library.rs index 2230eb29b..371d91194 100644 --- a/pebrel_app/src/gpui_shell/ssh_settings/library.rs +++ b/pebrel_app/src/gpui_shell/ssh_settings/library.rs @@ -680,11 +680,7 @@ impl SettingsPane { .into_any_element() } - pub(in crate::gpui_shell) fn section_ssh( - &mut self, - window: &Window, - cx: &mut Context, - ) -> gpui::Div { + pub(in crate::gpui_shell) fn section_ssh(&mut self, cx: &mut Context) -> gpui::Div { let language = crate::gpui_shell::config::ui_language(cx); let controls = self.library_controls(cx); let header = self.library_header(cx); @@ -768,10 +764,6 @@ impl SettingsPane { .flex_col() .gap(px(14.0)) .w_full() - .max_w(px(1000.0)) - .px(px(if f32::from(window.viewport_size().width) < 1000.0 { 12.0 } else { 36.0 })) - .pt(px(16.0)) - .pb(px(110.0)) .child(header) .child(div().mt(px(10.0)).child(controls)) .children(