Skip to content

Commit 8600ae9

Browse files
committed
fix(ui): move sidebar section chevrons after labels, show counts only when collapsed
1 parent c23dc14 commit 8600ae9

4 files changed

Lines changed: 20 additions & 23 deletions

File tree

‎ui/src/components/app-sidebar-session-catalogs.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,21 @@ export function renderSessionCatalogGroups(params: SessionCatalogGroupsParams) {
200200
title=${hasError ? errorHelp : nothing}
201201
@click=${() => params.onToggleSection(sectionId)}
202202
>
203+
<span class="sidebar-recent-sessions__label-text">${catalog.label}</span>
203204
<span class="sidebar-session-group-toggle__icon" aria-hidden="true"
204205
>${collapsed ? icons.chevronRight : icons.chevronDown}</span
205206
>
206-
<span class="sidebar-recent-sessions__label-text">${catalog.label}</span>
207207
${renderCatalogHeaderStatus(hasActiveRun, hasUnread)}
208-
<span
209-
class="sidebar-session-group-count ${hasError
210-
? "sidebar-session-group-count--error"
211-
: ""}"
212-
data-session-catalog-error=${hasError ? catalog.id : nothing}
213-
aria-hidden="true"
214-
>${hasError ? icons.alertTriangle : rows.length}</span
215-
>
208+
${hasError || (collapsed && rows.length > 0)
209+
? html`<span
210+
class="sidebar-session-group-count ${hasError
211+
? "sidebar-session-group-count--error"
212+
: ""}"
213+
data-session-catalog-error=${hasError ? catalog.id : nothing}
214+
aria-hidden="true"
215+
>${hasError ? icons.alertTriangle : rows.length}</span
216+
>`
217+
: nothing}
216218
</button>
217219
<button
218220
type="button"

‎ui/src/components/app-sidebar-session-list.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ export abstract class AppSidebarSessionListElement extends AppSidebarMenusElemen
361361
aria-label=${label}
362362
@click=${() => this.toggleSessionSection(section.id)}
363363
>
364+
<span class="sidebar-recent-sessions__label-text">${label}</span>
364365
<span class="sidebar-session-group-toggle__icon" aria-hidden="true"
365366
>${collapsed ? icons.chevronRight : icons.chevronDown}</span
366367
>
367-
<span class="sidebar-recent-sessions__label-text">${label}</span>
368-
${section.work && totalRowCount === 0
369-
? nothing
370-
: html`<span class="sidebar-session-group-count">${totalRowCount}</span>`}
368+
${collapsed && totalRowCount > 0
369+
? html`<span class="sidebar-session-group-count">${totalRowCount}</span>`
370+
: nothing}
371371
${collapsedRunningDot
372372
? html`<span
373373
class="session-run-spinner sidebar-session-group-running"

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ suite("Codex native session catalog", () => {
272272
expect(await section.getByText("Worktree fix session", { exact: true }).count()).toBe(1);
273273
const toggle = section.locator(".sidebar-session-group-toggle");
274274
expect(await toggle.getAttribute("title")).toBeNull();
275-
await expect
276-
.poll(() => section.locator(".sidebar-session-group-count").textContent())
277-
.toBe("4");
275+
// Counts only render while a section is collapsed.
276+
expect(await section.locator(".sidebar-session-group-count").count()).toBe(0);
278277

279278
const groupingToggle = section.locator('[data-session-catalog-grouping-toggle="codex"]');
280279
await groupingToggle.click();

‎ui/src/styles/layout.css‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,9 @@ html.openclaw-native-macos
12661266
align-items: center;
12671267
gap: 8px;
12681268
min-height: 24px;
1269-
padding: 0 10px;
1269+
/* 9px left matches .sidebar-recent-session__link text inset so zone labels
1270+
and session titles share one left edge. */
1271+
padding: 0 10px 0 9px;
12701272
color: color-mix(in srgb, var(--muted) 72%, var(--text) 28%);
12711273
}
12721274

@@ -1285,10 +1287,6 @@ html.openclaw-native-macos
12851287
background: var(--sidebar-bg);
12861288
}
12871289

1288-
.sidebar-recent-sessions__head .sidebar-recent-sessions__label-text {
1289-
flex: 1 1 auto;
1290-
}
1291-
12921290
.sidebar-session-group-toggle {
12931291
display: flex;
12941292
align-items: center;
@@ -1317,13 +1315,11 @@ html.openclaw-native-macos
13171315
}
13181316

13191317
.sidebar-session-group-count {
1320-
width: 26px;
13211318
flex: 0 0 auto;
13221319
color: var(--muted);
13231320
font-size: 10px;
13241321
font-variant-numeric: tabular-nums;
13251322
opacity: 0.7;
1326-
text-align: center;
13271323
}
13281324

13291325
.sidebar-session-group-count--error {

0 commit comments

Comments
 (0)