Skip to content

Commit 4187fe4

Browse files
Polish main sidebar layout
1 parent 6799b5b commit 4187fe4

45 files changed

Lines changed: 124 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ui/src/components/app-sidebar.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ const SIDEBAR_SESSION_SORT_OPTIONS = [
108108
labelKey: "chat.sidebar.sortCreated" | "chat.sidebar.sortUpdated";
109109
}>;
110110

111+
function formatSidebarTimestamp(timestampMs: number | null | undefined): string {
112+
const value = formatRelativeTimestamp(timestampMs, { fallback: "" });
113+
if (value === "just now") {
114+
return "now";
115+
}
116+
return value.endsWith(" ago") ? value.slice(0, -" ago".length) : value;
117+
}
118+
111119
function shouldHandleNavigationClick(event: MouseEvent): boolean {
112120
return (
113121
!event.defaultPrevented &&
@@ -319,7 +327,7 @@ export class AppSidebar extends LitElement {
319327
const toSidebarSession = (row: SessionsListResult["sessions"][number]) => ({
320328
key: row.key,
321329
label: resolveSessionDisplayName(row.key, row),
322-
meta: row.updatedAt ? formatRelativeTimestamp(row.updatedAt) : "",
330+
meta: formatSidebarTimestamp(row.updatedAt),
323331
href: `${pathForRoute("chat", context?.basePath ?? "")}${searchForSession(row.key)}`,
324332
active: row.key === navigation.activeRowKey,
325333
hasActiveRun: Boolean(row.hasActiveRun),
@@ -1370,6 +1378,7 @@ export class AppSidebar extends LitElement {
13701378
>${newSessionControl}</openclaw-tooltip
13711379
>`
13721380
: newSessionControl}
1381+
${this.renderSidebarNavigation()}
13731382
${this.collapsed
13741383
? nothing
13751384
: html`
@@ -1554,6 +1563,18 @@ export class AppSidebar extends LitElement {
15541563
`;
15551564
}
15561565

1566+
private renderSidebarNavigation() {
1567+
return html`
1568+
<nav class="sidebar-nav" @contextmenu=${this.openCustomizeMenuFromContext}>
1569+
${this.collapsed ? this.renderRoute("chat") : nothing}
1570+
<div class="nav-section__items">
1571+
${this.sidebarPinnedRoutes.map((routeId) => this.renderRoute(routeId))}
1572+
</div>
1573+
${this.renderMoreSection()}
1574+
</nav>
1575+
`;
1576+
}
1577+
15571578
private renderChatFallback() {
15581579
return html`
15591580
<a
@@ -1592,16 +1613,7 @@ export class AppSidebar extends LitElement {
15921613
alt="OpenClaw"
15931614
/>
15941615
<div class="sidebar-shell">
1595-
<div class="sidebar-shell__body">
1596-
<nav class="sidebar-nav" @contextmenu=${this.openCustomizeMenuFromContext}>
1597-
${this.collapsed ? this.renderRoute("chat") : nothing}
1598-
<div class="nav-section__items">
1599-
${this.sidebarPinnedRoutes.map((routeId) => this.renderRoute(routeId))}
1600-
</div>
1601-
${this.renderMoreSection()}
1602-
</nav>
1603-
${this.renderSessions()}
1604-
</div>
1616+
<div class="sidebar-shell__body">${this.renderSessions()}</div>
16051617
<div class="sidebar-shell__footer">
16061618
<div class="sidebar-footer-bar">
16071619
<openclaw-tooltip .content=${gatewayStatus}>
@@ -1637,9 +1649,7 @@ export class AppSidebar extends LitElement {
16371649
${icons.settings}
16381650
</a>
16391651
</openclaw-tooltip>
1640-
<openclaw-tooltip
1641-
.content=${t("chat.docsOpensInNewTab", { label: t("common.docs") })}
1642-
>
1652+
<openclaw-tooltip .content=${t("chat.docsTooltip")}>
16431653
<a
16441654
class="sidebar-footer-icon"
16451655
href="https://docs.openclaw.ai"

ui/src/e2e/sidebar-customization.e2e.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ describeControlUiE2e("Control UI sidebar customization mocked Gateway E2E", () =
101101
)
102102
.not.toContain("Workboard");
103103

104-
const customizeButton = sidebar.getByRole("button", { name: "Customize sidebar" });
104+
const customizeButton = sidebar.getByRole("button", { name: "Edit pinned items" });
105105
await customizeButton.click();
106-
const menu = sidebar.getByRole("menu", { name: "Customize sidebar" });
106+
const menu = sidebar.getByRole("menu", { name: "Edit pinned items" });
107107
await expect
108108
.poll(() => trimmedTextContents(menu.getByRole("menuitemcheckbox")))
109109
.not.toContain("Workboard");
@@ -133,7 +133,7 @@ describeControlUiE2e("Control UI sidebar customization mocked Gateway E2E", () =
133133
await captureUiProof(page, "03-persisted-customization.png");
134134

135135
await customizeButton.click();
136-
await menu.getByRole("menuitem", { name: "Reset to defaults" }).click();
136+
await menu.getByRole("menuitem", { name: "Reset pinned items" }).click();
137137
await expect.poll(() => trimmedTextContents(pinnedItems)).toEqual(["Overview"]);
138138

139139
const collapseButton = page.getByRole("button", { name: "Collapse sidebar" });

ui/src/i18n/.i18n/ar.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/de.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/es.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/fa.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/fr.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/hi.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/id.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/src/i18n/.i18n/it.meta.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)