Skip to content

Commit 87a66dd

Browse files
authored
fix(ui): unify sidebar thread density (#115646)
1 parent a2c88e2 commit 87a66dd

2 files changed

Lines changed: 122 additions & 30 deletions

File tree

‎ui/src/e2e/codex-sessions.e2e.test.ts‎

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ suite("Codex native session catalog", () => {
262262
});
263263

264264
it("groups sessions by host and hides empty offline nodes", async () => {
265-
const page = await browser.newPage({ viewport: { height: 1100, width: 1440 } });
265+
const page = await browser.newPage({
266+
deviceScaleFactor: 2,
267+
viewport: { height: 1100, width: 1440 },
268+
});
266269
await page.addInitScript((key) => localStorage.removeItem(key), catalogGroupingStorageKey);
267270
await page.addInitScript(
268271
(key) => localStorage.removeItem(key),
@@ -271,6 +274,31 @@ suite("Codex native session catalog", () => {
271274
await installMockGateway(page, {
272275
featureMethods: ["chat.metadata", "chat.startup", "sessions.catalog.list"],
273276
methodResponses: {
277+
"sessions.list": {
278+
count: 1,
279+
defaults: {
280+
contextTokens: null,
281+
model: "gpt-5.5",
282+
modelProvider: "openai",
283+
},
284+
path: "",
285+
sessions: [
286+
{
287+
contextTokens: null,
288+
displayName: "Research thread",
289+
hasActiveRun: false,
290+
key: "agent:main:research",
291+
kind: "direct",
292+
label: "Research thread",
293+
model: "gpt-5.5",
294+
modelProvider: "openai",
295+
status: "done",
296+
totalTokens: 0,
297+
updatedAt: Date.parse("2026-07-29T06:00:00.000Z"),
298+
},
299+
],
300+
ts: Date.parse("2026-07-29T06:00:00.000Z"),
301+
},
274302
"sessions.catalog.list": {
275303
catalogs: [
276304
{
@@ -356,6 +384,10 @@ suite("Codex native session catalog", () => {
356384

357385
try {
358386
await page.goto(`${server.baseUrl}chat`);
387+
await page.evaluate(() => {
388+
document.documentElement.setAttribute("data-theme", "openknot");
389+
document.documentElement.setAttribute("data-theme-mode", "dark");
390+
});
359391
await expandCodingSection(page);
360392
const section = page.locator('[data-session-section="catalog:codex"]');
361393
await section.waitFor({ state: "visible" });
@@ -375,6 +407,87 @@ suite("Codex native session catalog", () => {
375407
expect(
376408
await openclawProject.locator(".sidebar-session-catalog-project__count").textContent(),
377409
).toBe("2");
410+
const projectRows = section.locator(".sidebar-recent-session--catalog-project-child");
411+
await expect.poll(() => projectRows.count()).toBe(3);
412+
const threadRows = page.locator(
413+
'[data-session-section="ungrouped"] .sidebar-recent-session, [data-session-section="catalog:codex"] .sidebar-recent-session--catalog-project-child',
414+
);
415+
await expect.poll(() => threadRows.count()).toBe(4);
416+
const threadRowMetrics = await threadRows.evaluateAll((rows) =>
417+
rows.map((row) => {
418+
const link = row.querySelector(".sidebar-recent-session__link");
419+
const name = row.querySelector(".sidebar-recent-session__name");
420+
const rowStyle = getComputedStyle(row);
421+
const linkStyle = link ? getComputedStyle(link) : null;
422+
const nameStyle = name ? getComputedStyle(name) : null;
423+
return {
424+
height: row.getBoundingClientRect().height,
425+
minHeight: rowStyle.minHeight,
426+
nameFontSize: nameStyle?.fontSize ?? "",
427+
paddingBottom: linkStyle?.paddingBottom ?? "",
428+
paddingTop: linkStyle?.paddingTop ?? "",
429+
};
430+
}),
431+
);
432+
expect(threadRowMetrics).toEqual([
433+
{
434+
height: 30,
435+
minHeight: "30px",
436+
nameFontSize: "13px",
437+
paddingBottom: "3px",
438+
paddingTop: "3px",
439+
},
440+
{
441+
height: 30,
442+
minHeight: "30px",
443+
nameFontSize: "13px",
444+
paddingBottom: "3px",
445+
paddingTop: "3px",
446+
},
447+
{
448+
height: 30,
449+
minHeight: "30px",
450+
nameFontSize: "13px",
451+
paddingBottom: "3px",
452+
paddingTop: "3px",
453+
},
454+
{
455+
height: 30,
456+
minHeight: "30px",
457+
nameFontSize: "13px",
458+
paddingBottom: "3px",
459+
paddingTop: "3px",
460+
},
461+
]);
462+
const projectLabelTone = await openclawProject
463+
.locator(".sidebar-session-catalog-project__label")
464+
.evaluate((label) => {
465+
const probe = document.createElement("span");
466+
document.body.append(probe);
467+
const resolveColor = (value: string) => {
468+
probe.style.color = value;
469+
return getComputedStyle(probe).color;
470+
};
471+
const channels = (value: string) => {
472+
const values =
473+
value
474+
.match(/[\d.]+/g)
475+
?.slice(0, 3)
476+
.map(Number) ?? [];
477+
return value.startsWith("color(srgb") ? values.map((channel) => channel * 255) : values;
478+
};
479+
const distance = (left: number[], right: number[]) =>
480+
Math.hypot(...left.map((channel, index) => channel - (right[index] ?? 0)));
481+
const labelColor = channels(getComputedStyle(label).color);
482+
const textColor = channels(resolveColor("var(--text)"));
483+
const mutedColor = channels(resolveColor("var(--muted)"));
484+
probe.remove();
485+
return {
486+
distanceToMuted: distance(labelColor, mutedColor),
487+
distanceToText: distance(labelColor, textColor),
488+
};
489+
});
490+
expect(projectLabelTone.distanceToText).toBeLessThan(projectLabelTone.distanceToMuted);
378491
expect(
379492
await section
380493
.locator('[data-session-catalog-project="/Users/dev/other"]')

‎ui/src/styles/layout.css‎

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ html.openclaw-native-macos
17261726
border: 0;
17271727
border-radius: var(--radius-sm);
17281728
background: transparent;
1729-
color: color-mix(in srgb, var(--muted) 90%, var(--text) 10%);
1729+
color: color-mix(in srgb, var(--muted) 35%, var(--text) 65%);
17301730
font: inherit;
17311731
cursor: pointer;
17321732
text-align: left;
@@ -1768,21 +1768,16 @@ html.openclaw-native-macos
17681768
.sidebar-session-catalog-project__count {
17691769
width: 20px;
17701770
flex: 0 0 20px;
1771-
color: var(--muted);
1772-
font-size: 9px;
1771+
color: color-mix(in srgb, var(--muted) 55%, var(--text) 45%);
1772+
font-size: 10px;
17731773
font-variant-numeric: tabular-nums;
1774-
opacity: 0.58;
17751774
text-align: center;
17761775
}
17771776

17781777
.sidebar-session-catalog-host__sessions .sidebar-recent-session__link {
17791778
padding-left: 18px;
17801779
}
17811780

1782-
.sidebar-recent-session--catalog-project-child .sidebar-recent-session__name {
1783-
font-size: 10px;
1784-
}
1785-
17861781
.sidebar-session-pagination {
17871782
display: flex;
17881783
justify-content: center;
@@ -1844,13 +1839,13 @@ html.openclaw-native-macos
18441839
opacity: 0.45;
18451840
}
18461841

1847-
/* Rows and row links are anchors (for middle-click/new-tab), but read as app
1848-
controls: override the UA link pointer back to the default arrow. */
1842+
/* Every sidebar session source renders a thread. Keep density and text styling
1843+
here so gateway threads and native coding catalogs cannot drift apart. */
18491844
.sidebar-recent-session {
18501845
display: flex;
18511846
align-items: center;
18521847
min-width: 0;
1853-
min-height: 34px;
1848+
min-height: 30px;
18541849
padding-right: 4px;
18551850
border-radius: var(--radius-md);
18561851
color: var(--muted);
@@ -1888,7 +1883,7 @@ html.openclaw-native-macos
18881883
gap: 8px;
18891884
flex: 1 1 auto;
18901885
min-width: 0;
1891-
padding: 5px 4px 5px 9px;
1886+
padding: 3px 4px 3px 9px;
18921887
color: inherit;
18931888
cursor: default;
18941889
text-decoration: none;
@@ -3398,22 +3393,6 @@ openclaw-tooltip.sidebar-hover-tooltip {
33983393
background: var(--danger);
33993394
}
34003395

3401-
/* Groups zone: quiet compact rows. Coding zone: muted until expanded. */
3402-
.sidebar-recent-sessions__group--zone-groups .sidebar-recent-session__link {
3403-
padding-top: 3px;
3404-
padding-bottom: 3px;
3405-
}
3406-
3407-
.sidebar-recent-sessions__group--zone-groups .sidebar-recent-session__name {
3408-
font-size: 12.5px;
3409-
color: var(--text);
3410-
}
3411-
3412-
.sidebar-recent-sessions__group--zone-coding .sidebar-recent-session__name,
3413-
.sidebar-recent-sessions__group--zone-coding .sidebar-recent-session__subtitle {
3414-
color: var(--muted);
3415-
}
3416-
34173396
.sidebar-session-group-running {
34183397
flex: none;
34193398
margin-left: 4px;
@@ -4082,7 +4061,7 @@ html:not(.openclaw-native-macos):not(.openclaw-native-nav):not(.openclaw-native-
40824061
text-overflow: ellipsis;
40834062
white-space: nowrap;
40844063
font-size: 11px;
4085-
color: var(--muted);
4064+
color: color-mix(in srgb, var(--muted) 55%, var(--text) 45%);
40864065
}
40874066

40884067
.sidebar-session-attention__icon {

0 commit comments

Comments
 (0)