Skip to content

Commit b181d78

Browse files
fix(ui): clarify settings reconnect state (#131207)
* fix(ui): clarify settings reconnect alert * fix(ui): pin reconnect alert to settings top * fix(ui): restore settings title spacing * test(ui): tolerate fractional layout pixels
1 parent 599b46c commit b181d78

6 files changed

Lines changed: 106 additions & 25 deletions

File tree

‎ui/src/app/app-shell-view.ts‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,20 @@ export function renderApplicationShell(host: ShellViewHost) {
602602
.tabIndex=${-1}
603603
?inert=${pageActionsBlocked || (mobileNavLayout && navDrawerOpen)}
604604
>
605+
${pageActionsBlocked && gatewaySnapshot.phase !== "reload-required"
606+
? html`<div class="connection-action-block" role="status" aria-live="polite">
607+
<span class="connection-action-block__icon" aria-hidden="true"
608+
>${icons.globeOff}</span
609+
>
610+
<span class="connection-action-block__text">
611+
${t(
612+
settingsTakeover
613+
? "connection.settingsChangesUnavailable"
614+
: "connection.actionsUnavailable",
615+
)}
616+
</span>
617+
</div>`
618+
: nothing}
605619
${renderFloatingUpdateCard({
606620
navigationSurfaceHidden,
607621
mobileNavLayout,
@@ -624,11 +638,6 @@ export function renderApplicationShell(host: ShellViewHost) {
624638
onNavigate: (routeId) => host.navigate(routeId),
625639
onOpenApprovals: () => host.openApprovals(),
626640
})}
627-
${pageActionsBlocked && gatewaySnapshot.phase !== "reload-required"
628-
? html`<div class="connection-action-block" role="status" aria-live="polite">
629-
${t("connection.actionsUnavailable")}
630-
</div>`
631-
: nothing}
632641
<openclaw-router-outlet
633642
?inert=${pageActionsBlocked}
634643
aria-disabled=${pageActionsBlocked ? "true" : nothing}

‎ui/src/components/icons.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ export const icons = {
246246
/>
247247
<path d="M12 9v4" />
248248
<path d="M12 17h.01" />`),
249+
globeOff: strokeIcon(svg` <path
250+
d="M10.114 4.462A14.5 14.5 0 0 1 12 2a10 10 0 0 1 9.313 13.643"
251+
/>
252+
<path d="M15.557 15.556A14.5 14.5 0 0 1 12 22 10 10 0 0 1 4.929 4.929" />
253+
<path d="M15.892 10.234A14.5 14.5 0 0 0 12 2a10 10 0 0 0-3.643.687" />
254+
<path d="M17.656 12H22" />
255+
<path d="M19.071 19.071A10 10 0 0 1 12 22 14.5 14.5 0 0 1 8.44 8.45" />
256+
<path d="M2 12h10" />
257+
<path d="m2 2 20 20" />`),
249258
hand: strokeIcon(svg` <path d="M18 11V6a2 2 0 0 0-4 0v5" />
250259
<path d="M14 10V4a2 2 0 0 0-4 0v6" />
251260
<path d="M10 10.5V6a2 2 0 0 0-4 0v8" />

‎ui/src/e2e/login-gate.e2e.test.ts‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,43 @@ suite.define(() => {
255255
try {
256256
await page.goto(new URL("settings/connection", suite.server.baseUrl).href);
257257
await page.locator("openclaw-app-shell").waitFor();
258+
await page.locator("openclaw-connection-page .content-header").waitFor();
258259
await gateway.deferNext("connect");
259260
await gateway.closeLatest(1012, "test reconnect");
260261

261-
await page.getByText("Actions are unavailable while the Gateway reconnects.").waitFor();
262+
const notice = page.locator('.connection-action-block[role="status"]');
263+
await notice.waitFor();
264+
expect((await notice.textContent())?.trim()).toBe(
265+
"Changes to settings are disabled while the Gateway is reconnecting.",
266+
);
267+
expect(await notice.locator("svg").count()).toBe(1);
262268
const outlet = page.locator("openclaw-router-outlet");
263269
expect(await outlet.getAttribute("inert")).not.toBeNull();
264270
expect(await outlet.getAttribute("aria-disabled")).toBe("true");
271+
const bounds = await page.evaluate(() => {
272+
const noticeRect = document
273+
.querySelector(".connection-action-block")
274+
?.getBoundingClientRect();
275+
const navRect = document.querySelector(".shell-nav")?.getBoundingClientRect();
276+
const mainRect = document.querySelector("#control-ui-main")?.getBoundingClientRect();
277+
const headerRect = document
278+
.querySelector("openclaw-connection-page .content-header")
279+
?.getBoundingClientRect();
280+
return {
281+
headerTop: headerRect?.top,
282+
noticeBottom: noticeRect?.bottom,
283+
noticeTop: noticeRect?.top,
284+
noticeLeft: noticeRect?.left,
285+
noticeRight: noticeRect?.right,
286+
mainTop: mainRect?.top,
287+
navRight: navRect?.right,
288+
mainRight: mainRect?.right,
289+
};
290+
});
291+
expect(bounds.noticeTop).toBe(bounds.mainTop);
292+
expect((bounds.headerTop ?? 0) - (bounds.noticeBottom ?? 0)).toBeCloseTo(44, 3);
293+
expect(bounds.noticeLeft).toBe(bounds.navRight);
294+
expect(bounds.noticeRight).toBe(bounds.mainRight);
265295
await mkdir(RECOVERY_ARTIFACT_DIR, { recursive: true });
266296
await page.screenshot({
267297
path: path.join(RECOVERY_ARTIFACT_DIR, "02-reconnecting-actions-blocked.png"),

‎ui/src/i18n/locales/en.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4304,6 +4304,8 @@ export const en: TranslationMap = {
43044304
restarting: "Restarting…",
43054305
retryNow: "Retry now",
43064306
actionsUnavailable: "Actions are unavailable while the Gateway reconnects.",
4307+
settingsChangesUnavailable:
4308+
"Changes to settings are disabled while the Gateway is reconnecting.",
43074309
sessionOperationCompletedPreviousConnection:
43084310
"The session operation completed on the previous connection. Check the current session list before continuing.",
43094311
sessionOperationCompletedPreviousConnectionWithRefreshError:

‎ui/src/pages/chat/components/chat-composer-view.ts‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
2-
import { html, nothing, svg, type TemplateResult } from "lit";
2+
import { html, nothing, type TemplateResult } from "lit";
33
import { ifDefined } from "lit/directives/if-defined.js";
44
import { ref } from "lit/directives/ref.js";
55
import type { GatewaySessionRow } from "../../../api/types.ts";
6-
import { strokeIcon } from "../../../components/icons-tools.ts";
76
import { icons } from "../../../components/icons.ts";
87
import { renderSessionProgressCard } from "../../../components/session-progress-card.ts";
98
import { t } from "../../../i18n/index.ts";
@@ -88,16 +87,6 @@ type ChatComposerViewContext = {
8887
slashMenuAnnouncementId: string;
8988
};
9089

91-
const globeOffIcon = strokeIcon(svg` <path
92-
d="M10.114 4.462A14.5 14.5 0 0 1 12 2a10 10 0 0 1 9.313 13.643"
93-
/>
94-
<path d="M15.557 15.556A14.5 14.5 0 0 1 12 22 10 10 0 0 1 4.929 4.929" />
95-
<path d="M15.892 10.234A14.5 14.5 0 0 0 12 2a10 10 0 0 0-3.643.687" />
96-
<path d="M17.656 12H22" />
97-
<path d="M19.071 19.071A10 10 0 0 1 12 22 14.5 14.5 0 0 1 8.44 8.45" />
98-
<path d="M2 12h10" />
99-
<path d="m2 2 20 20" />`);
100-
10190
export function renderChatComposerView(context: ChatComposerViewContext) {
10291
const {
10392
props,
@@ -222,7 +211,7 @@ export function renderChatComposerView(context: ChatComposerViewContext) {
222211
: state.dictationError
223212
? { text: state.dictationError, tone: "danger" as const, icon: icons.alertTriangle }
224213
: offlineText
225-
? { text: offlineText, tone: "warn" as const, icon: globeOffIcon }
214+
? { text: offlineText, tone: "warn" as const, icon: icons.globeOff }
226215
: null;
227216
const composerUnderlaps =
228217
showComposerInput && primaryComposerStatus

‎ui/src/styles/layout.css‎

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,26 @@ html.openclaw-native-web-chrome .shell-chrome-controls {
283283
}
284284

285285
.shell--settings:not(.shell--mobile-nav) {
286+
--settings-content-block-start-padding: 44px;
287+
--settings-content-inline-padding: clamp(28px, 5vw, 72px);
286288
grid-template-columns: var(--shell-settings-nav-width) minmax(0, 1fr);
287289
grid-template-rows: 0 1fr;
288290
--shell-nav-width: var(--shell-settings-nav-width);
289291
}
290292

291293
.shell--settings:not(.shell--mobile-nav) .content {
292-
padding: 44px clamp(28px, 5vw, 72px) 72px;
294+
padding: var(--settings-content-block-start-padding) var(--settings-content-inline-padding) 72px;
295+
}
296+
297+
.shell--settings.shell--mobile-nav {
298+
--settings-content-block-start-padding: 4px;
299+
--settings-content-inline-padding: 4px;
300+
}
301+
302+
.shell--settings .connection-action-block {
303+
margin-inline: calc(0px - var(--settings-content-inline-padding));
304+
border-inline: 0;
305+
border-radius: 0;
293306
}
294307

295308
.shell--settings:not(.shell--mobile-nav) .content--custodian {
@@ -4053,13 +4066,42 @@ wa-dropdown.sidebar-identity-menu::part(menu) {
40534066
margin-top: 20px;
40544067
}
40554068

4069+
.shell--settings .content:has(> .connection-action-block) {
4070+
padding-top: 0;
4071+
}
4072+
4073+
.shell--settings .content:has(> .connection-action-block) > openclaw-router-outlet {
4074+
display: block;
4075+
margin-top: 0;
4076+
padding-top: var(--settings-content-block-start-padding);
4077+
}
4078+
40564079
.connection-action-block {
4057-
padding: 10px 12px;
4058-
border: 1px solid var(--border);
4080+
display: flex;
4081+
align-items: center;
4082+
gap: 8px;
4083+
min-height: 44px;
4084+
padding: 8px 14px;
4085+
border: 1px solid color-mix(in srgb, var(--warn) 12%, transparent);
40594086
border-radius: var(--radius-md);
4060-
background: var(--secondary);
4061-
color: var(--muted);
4062-
font-size: 13px;
4087+
background: color-mix(in srgb, var(--warn) 7%, var(--secondary));
4088+
color: color-mix(in srgb, var(--warn) 72%, var(--text));
4089+
font-size: var(--control-ui-text-sm);
4090+
line-height: 1.35;
4091+
}
4092+
4093+
.connection-action-block__icon {
4094+
display: inline-flex;
4095+
flex: 0 0 auto;
4096+
}
4097+
4098+
.connection-action-block__icon svg {
4099+
width: 16px;
4100+
height: 16px;
4101+
}
4102+
4103+
.connection-action-block__text {
4104+
min-width: 0;
40634105
}
40644106

40654107
.content--chat {

0 commit comments

Comments
 (0)