Skip to content

Commit 35c7014

Browse files
committed
refactor(ui): keep Home attention boundary private
1 parent 64413e1 commit 35c7014

4 files changed

Lines changed: 23 additions & 21 deletions

File tree

‎ui/src/components/app-sidebar-render.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,14 @@ export function renderAppSidebarHomeRow(host: AppSidebarRenderHost) {
161161
const mainRow = host.mainSessionRow(agentId);
162162
const attention = host.resolveHomeSessionAttention(mainKey, mainRow);
163163
const attentionLabel = sessionAttentionSubtitle(attention);
164-
const outboxCount = host.outboxCountForSessionKey(mainKey);
164+
const outboxCount = host.outboxCountForSession(mainKey);
165165
const active =
166166
isSessionRouteId(host.activeRouteId) &&
167167
areUiSessionKeysEquivalent(host.getRouteSessionKey(), mainKey);
168168
const hasComposerDraft = !active && host.hasSessionDraft(mainKey);
169169
const running = mainRow?.hasActiveRun === true;
170170
const unread = mainRow?.unread === true && !active;
171-
// Home shares the sidebar's leading-slot contract: run state rings its icon
172-
// instead of drifting to the row edge, which stays reserved for counts.
171+
// Home rings run state around its leading icon; the trailing slot stays reserved for counts.
173172
const homeGlyph = renderSessionGlyph({
174173
content:
175174
attention.kind === "none"

‎ui/src/components/app-sidebar-session-navigation-logic.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
22
import type { GatewaySessionRow, SessionsListResult } from "../api/types.ts";
3-
import { SIDEBAR_NAV_ROUTES } from "../app-navigation.ts";
4-
import type { NavigationRouteId } from "../app-navigation.ts";
3+
import { SIDEBAR_NAV_ROUTES, type NavigationRouteId } from "../app-navigation.ts";
54
import type { RouteId } from "../app-route-paths.ts";
65
import type { ApplicationContext } from "../app/context.ts";
76
import { t } from "../i18n/index.ts";
@@ -49,6 +48,7 @@ import {
4948
} from "./app-sidebar-session-types.ts";
5049
import type { SidebarWorkboardBoard } from "./app-sidebar-workboard.ts";
5150
import { resolveCloudWorkerStopAction } from "./cloud-worker-stop.ts";
51+
import type { SessionAttentionController } from "./session-attention-controller.ts";
5252
import {
5353
listSessionCreators,
5454
type SessionCreatedActor,
@@ -57,6 +57,20 @@ import {
5757

5858
type SessionRow = SessionsListResult["sessions"][number];
5959

60+
export function resolveSidebarHomeAttention(
61+
attention: SessionAttentionController,
62+
sessionKey: string,
63+
row: GatewaySessionRow | null,
64+
) {
65+
const known = attention
66+
.knownSessionAttention()
67+
.find((entry) => areUiSessionKeysEquivalent(entry.sessionKey, sessionKey));
68+
return (
69+
known?.attention ??
70+
(row ? attention.resolveSessionAttention(row) : SIDEBAR_SESSION_NO_ATTENTION)
71+
);
72+
}
73+
6074
export function compareSidebarSessionRowsByMode(input: {
6175
a: SessionRow;
6276
b: SessionRow;

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
partitionSidebarVisibleSections,
4343
promoteSidebarSessionCreatedOrder,
4444
resolveSidebarAgentChipSubtitle,
45+
resolveSidebarHomeAttention,
4546
resolveSidebarAgentResumeKey,
4647
resolveSidebarMainSessionKey,
4748
toggleSidebarSessionSelection,
@@ -50,13 +51,12 @@ import {
5051
} from "./app-sidebar-session-navigation-logic.ts";
5152
import { SessionPullRequestIndicatorsController } from "./app-sidebar-session-pr-indicators.ts";
5253
import { projectSessionTree } from "./app-sidebar-session-tree.ts";
54+
import { loadStoredHiddenSessionCatalogIds } from "./app-sidebar-session-types.ts";
5355
import {
54-
loadStoredHiddenSessionCatalogIds,
5556
loadStoredSidebarSessionStatusFilter,
5657
loadStoredSidebarSessionsGrouping,
5758
loadStoredSidebarSessionsShowCron,
5859
loadStoredSidebarSessionsShowSystem,
59-
SIDEBAR_SESSION_NO_ATTENTION,
6060
type SidebarRecentSession,
6161
type SidebarSessionSortMode,
6262
type SidebarSessionStatusFilter,
@@ -273,10 +273,6 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
273273
);
274274
}
275275

276-
outboxCountForSessionKey(sessionKey: string): number {
277-
return this.outboxCountForSession(sessionKey);
278-
}
279-
280276
getSessionNavigationState(): SidebarSessionNavigationState {
281277
const routeSessionKey = this.getRouteSessionKey();
282278
return buildSidebarSessionNavigationState({
@@ -292,7 +288,7 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
292288
highlightCurrentSession: isSessionRouteId(this.activeRouteId),
293289
runtimeSampledAtByRow: this.runtimeSampledAtByRow,
294290
loadingChildSessionKeys: this.sessionData.loadingChildSessionKeys,
295-
outboxCountForSessionKey: (sessionKey) => this.outboxCountForSessionKey(sessionKey),
291+
outboxCountForSessionKey: (sessionKey) => this.outboxCountForSession(sessionKey),
296292
hasSessionDraft: (sessionKey) => this.hasSessionDraft(sessionKey),
297293
resolveAttention: (row) => this.attention.resolveSessionAttention(row),
298294
resolveAgentStatusNote: (row) => this.attention.resolveSessionAgentStatus(row)?.note,
@@ -727,13 +723,7 @@ export class AppSidebarSessionNavigationElement extends AppSidebarBase {
727723
}
728724

729725
resolveHomeSessionAttention(sessionKey: string, row: GatewaySessionRow | null) {
730-
const known = this.attention
731-
.knownSessionAttention()
732-
.find((entry) => areUiSessionKeysEquivalent(entry.sessionKey, sessionKey));
733-
return (
734-
known?.attention ??
735-
(row ? this.attention.resolveSessionAttention(row) : SIDEBAR_SESSION_NO_ATTENTION)
736-
);
726+
return resolveSidebarHomeAttention(this.attention, sessionKey, row);
737727
}
738728

739729
/** Gateway row backing the identity card (unread/running state), if loaded. */

‎ui/src/styles/layout.css‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,8 +3151,7 @@ wa-dropdown-item.session-menu__item::part(submenu-icon) {
31513151
stroke-linejoin: round;
31523152
}
31533153

3154-
/* Home carries outbox and draft counts at the row's edge; run/unread state
3155-
rings the leading icon instead (see .session-glyph). */
3154+
/* Home keeps outbox/draft counts at the edge; run/unread rings the leading icon. */
31563155
.nav-item__state {
31573156
flex: none;
31583157
margin-left: auto;

0 commit comments

Comments
 (0)