From 30b16c65b554dfceea59ade0b2a1d60ceb021da5 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Mon, 10 Aug 2026 11:22:11 +0800 Subject: [PATCH] fix(settings): keep one restart button for the stale background server (#452) The in-place-update notice carried its own Restart server button while the Server section right below it carried an identical one, both calling restart_daemon. Move the notice into the Server section: the stale build line sits under the header and its explanation replaces the generic one, so the single button that ends every running pane is the only one on the page. Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> --- src/ui/settings.rs | 53 ++++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/src/ui/settings.rs b/src/ui/settings.rs index 4ce1f696..1b9db4c1 100644 --- a/src/ui/settings.rs +++ b/src/ui/settings.rs @@ -6075,37 +6075,7 @@ impl Tty7App { .into_any_element(), cx, ), - ) - // The other half of an in-place update: the app is new, the - // process serving every pane is not. Shown rather than - // prompted — restarting it ends the user's running work, - // which is not a thing to ask for on tty7's initiative. - .when_some(stale_daemon, |this, build| { - this.child( - v_flex() - .gap_1() - .child(div().text_sm().text_color(foreground).child(t_fmt( - L10nKey::SettingsDaemonStale, - &[("build", &build)], - ))) - .child( - div() - .text_xs() - .text_color(muted_fg) - .child(t(stale_daemon_note)), - ) - .child( - h_flex().child( - Button::new("restart-stale-daemon") - .label(t(L10nKey::SettingsRestartServer)) - .small() - .on_click(cx.listener(|this, _, window, cx| { - this.restart_daemon(window, cx) - })), - ), - ), - ) - }), + ), ) .child(self.settings_row( t(L10nKey::SettingsAppHttpProxy), @@ -6118,11 +6088,30 @@ impl Tty7App { .child( v_flex() .gap_2() + // The other half of an in-place update: the app is new, the + // process serving every pane is not. Said here rather than + // beside the update controls, so the one button that offers + // to pick the new build up stays the only one on the page. + .when_some(stale_daemon.as_deref(), |this, build| { + this.child( + div() + .text_sm() + .text_color(foreground) + .child(t_fmt(L10nKey::SettingsDaemonStale, &[("build", build)])), + ) + }) .child( div() .text_sm() .text_color(muted_fg) - .child(t(L10nKey::SettingsServerDesc)), + // A stale server has a more specific thing to say + // than the section's standing description, and it + // ends with the same button. + .child(t(if stale_daemon.is_some() { + stale_daemon_note + } else { + L10nKey::SettingsServerDesc + })), ) .child( h_flex().child(