Skip to content

Commit a2ca2ac

Browse files
committed
fix(ui): use shared Activity tabs
1 parent 7ab5d99 commit a2ca2ac

2 files changed

Lines changed: 23 additions & 55 deletions

File tree

‎ui/src/pages/activity/activity-page.ts‎

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
type ApplicationGatewaySnapshot,
1616
} from "../../app/context.ts";
1717
import { loadSettings } from "../../app/settings.ts";
18+
import { renderHubTabs } from "../../components/hub-tabs.ts";
1819
import { renderSettingsWorkspace } from "../../components/settings-workspace.ts";
1920
import { t } from "../../i18n/index.ts";
2021
import { isMissingOperatorReadScopeError } from "../../lib/gateway-errors.ts";
@@ -358,38 +359,29 @@ class ActivityPage extends OpenClawLightDomElement {
358359
});
359360
const mode = this.routeData?.mode ?? "live";
360361
const body = html`
361-
<div
362-
class="activity-mode-tabs"
363-
role="tablist"
364-
aria-label=${t("activity.runInspector.activityView")}
365-
>
366-
<button
367-
type="button"
368-
role="tab"
369-
aria-selected=${mode === "live" ? "true" : "false"}
370-
aria-controls="activity-live-panel"
371-
@click=${() => this.selectMode("live")}
372-
>
373-
${t("activity.runInspector.liveMode")}
374-
</button>
375-
<button
376-
type="button"
377-
role="tab"
378-
aria-selected=${mode === "run" ? "true" : "false"}
379-
aria-controls="activity-run-panel"
380-
@click=${() => this.selectMode("run")}
381-
>
382-
${t("activity.runInspector.mode")}
383-
</button>
362+
${renderHubTabs({
363+
id: "activity-mode",
364+
active: mode,
365+
tabs: [
366+
{ value: "live", label: t("activity.runInspector.liveMode") },
367+
{ value: "run", label: t("activity.runInspector.mode") },
368+
],
369+
ariaLabel: t("activity.runInspector.activityView"),
370+
panelId: "activity-mode-panel",
371+
className: "activity-mode-tabs",
372+
variant: "sub",
373+
onSelect: (selected) => this.selectMode(selected),
374+
})}
375+
<div id="activity-mode-panel">
376+
${mode === "run"
377+
? renderRunInspector({
378+
basePath: this.context.basePath,
379+
state: this.runInspector,
380+
onRetry: () =>
381+
this.syncRunInspector(this.context.gateway, this.context.gateway.snapshot, true),
382+
})
383+
: html`<div id="activity-live-panel">${liveActivity}</div>`}
384384
</div>
385-
${mode === "run"
386-
? renderRunInspector({
387-
basePath: this.context.basePath,
388-
state: this.runInspector,
389-
onRetry: () =>
390-
this.syncRunInspector(this.context.gateway, this.context.gateway.snapshot, true),
391-
})
392-
: html`<div id="activity-live-panel">${liveActivity}</div>`}
393385
`;
394386
return html`
395387
<section class="content-header">

‎ui/src/pages/activity/run-inspector.css‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
11
.activity-mode-tabs {
2-
display: inline-flex;
3-
width: fit-content;
4-
gap: var(--space-1);
52
margin-bottom: var(--space-3);
6-
padding: 3px;
7-
border: 1px solid var(--border);
8-
border-radius: var(--radius-md);
9-
background: var(--bg-elevated);
10-
}
11-
12-
.activity-mode-tabs button {
13-
border: 0;
14-
border-radius: var(--radius-sm);
15-
padding: var(--space-2) var(--space-3);
16-
color: var(--muted);
17-
background: transparent;
18-
font: inherit;
19-
cursor: pointer;
20-
}
21-
22-
.activity-mode-tabs button[aria-selected="true"] {
23-
color: var(--text);
24-
background: var(--bg);
25-
box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 10%, transparent);
263
}
274

28-
.activity-mode-tabs button:focus-visible,
295
.run-inspector button:focus-visible {
306
outline: 2px solid var(--focus);
317
outline-offset: 2px;

0 commit comments

Comments
 (0)