Skip to content

Commit cbd582f

Browse files
feat(console): from 768 px up an app draws no top bar; the app menu, search, bell and account move to the sidebar (#36112 PR A) (#36187)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuRPbvLUvEMeWbp9r3931xQ9)_ repo:objectstack#1 · os-sales · session_01L6bhgVKUaox9fRxbdYMLvf Part of #36112 (PR A of two: everything leaves the desktop top bar; the sidebar's docking model is PR B, after the maintainer's ruling on the fold) Clause-②: no Metadata-protocol: none Seat claim: [#36112 claim](#36112 (comment)) (split A/B; F3–F6 as proposed). ## 维护者速读 - **电脑宽度(768 px 起)应用页不再有顶栏**,页面从窗口最上沿开始。手机照旧有顶栏和底栏。 - 顶栏上的东西各自搬家: - **侧边栏第一行**:应用图标和名字,点开是「切换应用」菜单(当前应用打勾;服务器给这个人 Setup 时 Setup 也在里面;超过 8 个应用出现搜索框;工作区管理员且有建模权限的人在最下面看到「添加应用」:用 AI 搭建或在 Studio 新建、从模板开始、应用市场)。旁边是收起按钮。菜单里没有「回首页」「所有应用」「在 Studio 中编辑」(「编辑应用」在页面右上角的按钮组里,#36111)。 - **侧边栏第二行**:搜索(⌘K)和通知铃铛。 - **侧边栏底部**:账户菜单(头像、名字;封闭组织下第二行是组织名),里面的项目和原来头像菜单完全一样;预览版/测试版部署多一行阶段标记。 - **内容区顶部**:模拟登录、读取频率、存储用量这些常驻横幅,以及「连接断开」提示,宽度跟内容一样。 - **页面头部**:侧边栏收起时,页面头部最左边出现展开按钮;没有页面头部的页面(比如搜索结果)展开按钮在内容左上角。 - 右上角按钮组(#36111)现在**一直打开**,`os:shell:page-actions` 开关删掉了。 - ⌘⇧H 回首页照旧,在任何宽度都有效(由应用布局装,不再依赖顶栏)。电脑上没有点击回首页的入口(F3,席位已认可)。 - **不变**:侧边栏 1416 px 以下自动收起、「保持展开」的选择都照旧(这部分归 PR B,等裁定)。`/home`、组织页、Studio 落地页的顶栏不动。 - **文档页按现状保留顶栏**:应用的文档页(`/apps/<app>/docs…`)本来就不挂侧边栏(#35424),本 PR 不动它,所有宽度照旧有顶栏。卡上「不做的」写了「不接入文档页(第三阶段)」,所以这在本卡范围内,到第三阶段接文档页时一起定。 - **新手引导**:`chrome/OnboardingWalkthrough.tsx` 在 main 上是关掉的空组件(直接返回 null),没有任何一步指向顶栏,所以没有要改的引导步骤。 ## What changes **New modules** (`@object-ui/app-shell`) - `layout/SidebarAppMenu.tsx` — the sidebar's first row from 768 px up: `AppMark` + name opening a menu that only switches apps. Rows are `useLauncherApps`' list (the one Home's tiles and the phone sheet draw), the current one checked; a search field past `APP_MENU_SEARCH_FROM = 8`; 「Add app」 (sub-menu) only for a workspace admin who may author metadata, on a deployment with AI authoring or a marketplace. The sub-menu is a separate component, so nobody else pays the agent-catalog read behind 「Build with AI」. - `layout/AccountMenu.tsx` — the avatar menu's body lifted out of `AppHeader` verbatim, with two triggers: `avatar` (the phone's and `/home`'s bar) and `sidebar` (the sidebar foot: avatar, name, walled organization; stage chip row on preview/beta). - `layout/InboxBell.tsx` — the bell and its popover, shared by the bar and the sidebar head. - `layout/chromeBannerHost.tsx` — `ChromeBannerSlot` / `ChromeBannerHost`: the shell's standing banners (`ConsoleShell`) portal into the content area's banner box from 768 px up; inline otherwise. - `layout/ConnectionBanner.tsx` — the lost-connection notice (offline / reconnecting / disconnected / error; silent when connected). - `chrome/goHomeShortcut.ts` — `useGoHomeShortcut`, moved out of `AppHeader`; `ConsoleLayout` installs it at every width. **Changed** - `ConsoleLayout`: `showHeader` only on a phone or an app docs page (docs pages stay as today; they are the epic's phase 3); banner host + connection notice at the top of `console-banners`; `ShellSidebarExpandFallback` at the top of the route slot. - `UnifiedSidebar`: desktop head (app menu + collapse; search + bell), foot (keep-open + account menu); the hidden-sidebar edge zone spans the full height (no bar above it). The app switch goes through `confirmUnsavedLeave`. - `ShellPageActions` / `shellPageActionsSlot`: the group is always on (switch removed); a new expand-button slot that `PageHeader`, `RecordDetailView`'s navigation row read while the sidebar is collapsed, and a corner fallback for routes with no shell header. - `consoleSidebarRail.sidebarTrigger()` skips triggers inside `[inert]` (the hidden panel's own collapse button). - `AppHeader`: uses `AccountMenu` / `InboxBell`; drops the go-home listener (now the layout's). - i18n, 11 locales: `sidebar.collapse`, `sidebar.expand`, `layout.appSwitcher.addApp` (zh-Hant regenerated). - Docs: `frontend/app-shell.mdx` (when the Console draws the bar), `ai/connect-mcp.mdx` (where the account menu is). **Tests** - New: `ConsoleLayout.noTopBar-36112` (no `header` at 768/1024/1280/1440, phone keeps it, docs page keeps it, banners drawn once in the content area, connection notice, expand button in the page header and the corner fallback), `SidebarAppMenu-36112` (rows, checked app, Setup only when served, no home/All apps/Studio entry, switch, search past 8, 「Add app」 gates). - Rewritten for the bar's absence on a desktop: `AppHeader.homeMark-12605` and `AppHeader.unsavedEditsLeave-13231` (the chord is the layout's; a CONTROL pins that the bar alone installs nothing), `AppHeader.phoneTargets-29075` (the account menu's own module), `ConsoleLayout.appBrandingLogo-10827` (the logo is on the sidebar's app menu row on a desktop, the pill on a phone), `ConsoleLayout.skipToContent-13130`, `ConsoleLayout.robotTogglesDrawer-34608`, `ConsoleLayout.previewFrameDock-26470`, `ConsoleLayout.phoneRecordOneBar-28483`, `UnifiedSidebar.hiddenCollapse-35062`, `consoleTopBar.height-12639`, `ShellPageActions-36111` (switch test removed), `RecordDetailView.topBar-27524`, `KeyboardShortcutsDialog.wiredOnly-11674` (go-home row now listed inside an app, with its probe), `unsavedEditsLeave.census-13253`. ## Verification - `tsc --noEmit` (app-shell) clean; `eslint --quiet` on every changed file clean. - Vitest: the whole `layout/` folder, the 145 app-shell test files that reach the changed modules, the tests of #36113/#36150 merged since, and `@object-ui/i18n` (key parity, zh-Hant generated) — all green locally. The full app-shell suite runs in CI. - Screenshots: in the project's evidence folder `build-seat1/36112/` (posted as a comment once taken). --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgVKUaox9fRxbdYMLvf)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgVKUaox9fRxbdYMLvf <!-- signed: repo:objectstack#1 · os-sales · session_01L6bhgVKUaox9fRxbdYMLvf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent fa30414 commit cbd582f

45 files changed

Lines changed: 1648 additions & 564 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): from 768 px up an app draws no top bar; what it carried moves to the sidebar and the content area
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
Part of objectstack#36112 (epic #36107). An app page from 768 px up now starts at the window's top:
12+
13+
- **Sidebar head.** The first row is the app's glyph and name, which open a menu that only switches apps (the viewer's apps with the current one checked, Setup among them for the viewers the server serves it to, a search field past eight apps, and 「Add app」 for a workspace admin who may author: build with AI or in Studio, start from a template, the marketplace), with the collapse button beside it. The second row is search (`⌘K`) and the notification bell.
14+
- **Sidebar foot.** The account menu: avatar, name and, in a walled organization, the organization's name; the same entries the avatar menu had (profile, connect an AI assistant, organizations, hidden apps, theme, language, notifications, log out), plus the stage chip on a preview or beta deployment.
15+
- **Content area.** The impersonation, read-rate and storage banners and a lost-connection notice sit at the top of the content, its width.
16+
- **Page header.** While the sidebar is collapsed the page header draws the expand button first; a route with no shell header gets it at the content's top-left corner. The page's button group (#36111) is always on; the `os:shell:page-actions` storage switch is gone.
17+
- `⌘⇧H` goes home from any app page at every width (the app layout installs it, not the bar).
18+
19+
Unchanged: a phone keeps its top bar and bottom bar; an app's docs pages, which mount no sidebar, keep the bar at every width; `/home`, the organization pages and Studio keep their bar; the sidebar's fold below 1416 px and its keep-open choice are as before.
20+
21+
New strings in all 11 locales: `sidebar.collapse`, `sidebar.expand`, `layout.appSwitcher.addApp`.

‎content/docs/ai/connect-mcp.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ Clients that read an `mcpServers` map connect the same way. With an API key:
137137
Mint a key from the **Connect an AI Assistant** page in the Console. One page, two
138138
doors — which one you have depends on your permissions:
139139

140-
- **Any signed-in user** — open the avatar menu (top right) → **Connect an AI
141-
Assistant**. It opens the page in the Account app, whose sidebar lists it
140+
- **Any signed-in user** — open the account menu (your name at the foot of the
141+
sidebar; on a phone, the avatar at the top right) → **Connect an AI Assistant**. It opens the page in the Account app, whose sidebar lists it
142142
under **AI Assistant**.
143143
Direct link: `/_console/apps/com.objectstack.account/page/connect_agent`.
144144
- **Platform admins** — **Setup → Overview → Connect an AI Assistant**, at

‎content/docs/frontend/app-shell.mdx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,13 @@ of its own to it, in particular **no sidebar toggle**. If you want one, render i
7474

7575
Pass `showHeader={false}` to draw no header at all, for a page that draws its own top bar:
7676
the shell then renders no `<header>` element and does not mount `navbar`. It defaults to
77-
`true`, and leaving `navbar` out alone still draws the (empty) bar. The Console uses it on
78-
a phone (below 768 px): a record page's own top bar, with its back link to the object's
79-
list, is the page's only bar there, and every other route keeps the app bar.
77+
`true`, and leaving `navbar` out alone still draws the (empty) bar. The Console draws the
78+
app bar only on a phone (below 768 px) and on an app's docs pages, which mount no sidebar.
79+
From 768 px up an app page starts at the window's top: the sidebar's head carries the app
80+
menu, search and the notification bell, its foot the account menu, the content area the
81+
standing banners, and the page header its own buttons (objectstack#36112). On a phone a
82+
record page's own top bar, with its back link to the object's list, is the page's only bar,
83+
and every other route keeps the app bar.
8084

8185
### Content Area
8286

‎ui/packages/app-shell/src/chrome/KeyboardShortcutsDialog.wiredOnly-11674.test.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import '@objectstack/lint';
3838
import { describe, it, expect, vi, afterEach } from 'vitest';
3939
import React, { useState } from 'react';
4040
import { render, screen, fireEvent, cleanup, waitFor, act } from '@testing-library/react';
41-
import { MemoryRouter } from 'react-router-dom';
41+
import { MemoryRouter, useLocation } from 'react-router-dom';
4242
import { useSidebar } from '@object-ui/components';
4343

4444
vi.mock('@object-ui/i18n', async (importOriginal) => ({
@@ -98,9 +98,11 @@ function Probe() {
9898
const sidebar = useSidebar();
9999
const palette = useCommandPalette();
100100
const sidebarOpen = sidebar.isMobile ? sidebar.openMobile : sidebar.open;
101+
const location = useLocation();
101102
return (
102103
<output
103104
data-testid="probe"
105+
data-path={location.pathname}
104106
data-sidebar-open={String(sidebarOpen)}
105107
data-palette-open={String(palette.open)}
106108
/>
@@ -179,6 +181,14 @@ const FIRES: Record<string, (event: KeyboardEventInit) => Promise<void>> = {
179181
fireEvent.keyDown(document.activeElement ?? document.body, event);
180182
await waitFor(() => expect(dialogShown()).toBe(false));
181183
},
184+
// objectstack#36112 — the app layout installs the home chord, at every
185+
// width, so the dialog lists it inside an app.
186+
'go-home': async (event) => {
187+
mountConsole('/apps/crm');
188+
expect(probe()).toHaveAttribute('data-path', '/apps/crm');
189+
fireEvent.keyDown(document.body, { ...event, key: String(event.key).toUpperCase() });
190+
await waitFor(() => expect(probe()).toHaveAttribute('data-path', '/home'));
191+
},
182192
'toggle-sidebar': async (event) => {
183193
clearSidebarCookie();
184194
mountConsole('/apps/crm');
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* `⌘⇧H` / `Ctrl+Shift+H` — home from any app page. The app layout installs
5+
* it (`ConsoleLayout`), at every width, so it does not depend on a top bar
6+
* being drawn.
7+
* @module
8+
*/
9+
10+
import { useEffect } from 'react';
11+
import { useNavigate } from 'react-router-dom';
12+
import { GO_HOME_SHORTCUT, useAdvertiseShortcut, type ShortcutChord } from './advertisedShortcuts.js';
13+
import { confirmUnsavedLeave } from './unsavedEdits.js';
14+
15+
/**
16+
* Whether a keydown is `chord`: ⌘ or Ctrl exactly when the chord has `mod`
17+
* (the advertised chords accept either), Shift exactly when it has `shift`,
18+
* never Alt, and the key compared case-blind (Shift makes it upper case).
19+
*/
20+
function matchesShortcutChord(
21+
e: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey'>,
22+
chord: ShortcutChord,
23+
): boolean {
24+
if (e.altKey) return false;
25+
if (Boolean(chord.mod) !== (e.metaKey || e.ctrlKey)) return false;
26+
if (Boolean(chord.shift) !== e.shiftKey) return false;
27+
return e.key.toLowerCase() === chord.key;
28+
}
29+
30+
/**
31+
* A keydown aimed at something the user types into: a text field, a select,
32+
* a content-editable region (rich-text and code editors), or an ARIA textbox.
33+
* The home chord leaves those alone, so an editor that binds the same keys
34+
* keeps them (objectui#12605).
35+
*/
36+
function isTypingTarget(target: EventTarget | null): boolean {
37+
if (!(target instanceof Element)) return false;
38+
if (target instanceof HTMLElement && target.isContentEditable) return true;
39+
return target.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"]') !== null;
40+
}
41+
42+
/**
43+
* `⌘⇧H` / `Ctrl+Shift+H` goes home from any app page, as a PUSH so the
44+
* browser's Back returns to the page (objectui#12605). Advertised beside the
45+
* listener, under the same gate, so the keyboard-shortcuts dialog lists it
46+
* exactly where it fires (objectui#11674).
47+
*/
48+
export function useGoHomeShortcut(enabled: boolean, homePath: string): void {
49+
const navigate = useNavigate();
50+
useEffect(() => {
51+
if (!enabled) return undefined;
52+
const onKeyDown = (e: KeyboardEvent) => {
53+
if (e.defaultPrevented || e.isComposing) return;
54+
if (!matchesShortcutChord(e, GO_HOME_SHORTCUT.chord)) return;
55+
if (isTypingTarget(e.target)) return;
56+
e.preventDefault();
57+
// A page holding unsaved edits is asked first (objectui#13231).
58+
confirmUnsavedLeave(() => navigate(homePath));
59+
};
60+
document.addEventListener('keydown', onKeyDown);
61+
return () => document.removeEventListener('keydown', onKeyDown);
62+
}, [enabled, homePath, navigate]);
63+
useAdvertiseShortcut(GO_HOME_SHORTCUT, enabled);
64+
}
65+

‎ui/packages/app-shell/src/chrome/unsavedEditsLeave.census-13253.test.ts‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ describe('every shell departure in the four files goes through confirmUnsavedLea
8484
expect(bareCalls(code('chrome/CommandPalette.tsx'), 'onAppChange')).toEqual([]);
8585
});
8686

87-
it('UnifiedSidebar: onAppChange is declared but never read, so it is not a departure', () => {
88-
// The prop's one appearance is its declaration on the props interface; the
89-
// component destructures `activeAppName` only. A sidebar that starts
90-
// reading it must wrap it, and this assertion makes that a visible change.
87+
it('UnifiedSidebar: its one read of onAppChange, the app menu\'s switch, goes through the seam (objectstack#36112)', () => {
88+
// Declared on the props interface, destructured, and read once: the app
89+
// menu in the sidebar's head hands it on wrapped (that line names it
90+
// twice, the menu's prop and the call). A second read must be wrapped
91+
// too, and this count makes it a visible change.
9192
const sidebar = code('layout/UnifiedSidebar.tsx');
92-
expect(sidebar.match(/\bonAppChange\b/g) ?? []).toHaveLength(1);
93+
expect(sidebar.match(/\bonAppChange\b/g) ?? []).toHaveLength(4);
9394
expect(sidebar).toMatch(/onAppChange\?: \(name: string\) => void;/);
95+
expect(sidebar).toMatch(/onAppChange=\{\(segment\) => confirmUnsavedLeave\(\(\) => onAppChange\?\.\(segment\)\)\}/);
9496
});
9597

9698
it('CONTROL: the census sees a bare call, and does not count a wrapped one or a commented one', () => {

‎ui/packages/app-shell/src/console/ConsoleShell.tsx‎

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import { ConsoleElementApiOpen } from './ConsoleElementApiOpen.js';
6262
import { ImpersonationBanner } from '../layout/ImpersonationBanner.js';
6363
import { ReadRateBanner } from '../layout/ReadRateBanner.js';
6464
import { StorageUsageBanner } from '../layout/StorageUsageBanner.js';
65+
import { ChromeBannerSlot } from '../layout/chromeBannerHost.js';
6566
import { getRuntimeConfig } from '../runtime-config.js';
6667

6768
// The console's every pre-React / pre-auth gate (Suspense fallback, adapter
@@ -204,31 +205,36 @@ function ConsoleShellProviders({ children }: { children: ReactNode }) {
204205
<LastAppProvider>
205206
<ListPreferencesProvider>
206207
<RecordPreferencesProvider>
207-
{/* objectui#4467 — the impersonation indicator. Above the
208-
routes, so it is chrome for EVERY console page (home has
209-
its own layout and would otherwise carry no indicator),
210-
and in flow rather than overlaid, so it never covers the
211-
header it warns about. Renders null on every ordinary
212-
session. */}
213-
<ImpersonationBanner />
214-
{/* objectui#9954 — the environment admin's read-rate report.
215-
Beside the impersonation indicator for the same reason it
216-
is here: chrome for EVERY console page, including `/home`,
217-
which has its own layout and would otherwise carry no
218-
report. Renders null unless the control plane's verdict is
219-
`anomalous`, so an ordinary session and an unmeasured
220-
environment both see nothing — and a non-admin session
221-
never even issues the request, nor does any session on a
222-
runtime whose config does not serve `storageUsage`
223-
(objectui#11002). */}
224-
<ReadRateBanner />
225-
{/* objectui#10439 — the environment admin's storage-capacity
226-
banner, beside the read-rate report and behind the same
227-
two gates (the admin, and the runtime serving
228-
`storageUsage`); the two read one `/usage/storage` response.
229-
Renders null unless the runtime's own verdict says `warn`
230-
(80% and up) or `blocked` (uploads and imports refused). */}
231-
<StorageUsageBanner />
208+
{/* objectstack#36112 — inside an app from 768 px up the three
209+
are drawn at the top of the content area instead
210+
(`ChromeBannerSlot`); everywhere else, here. */}
211+
<ChromeBannerSlot>
212+
{/* objectui#4467 — the impersonation indicator. Above the
213+
routes, so it is chrome for EVERY console page (home has
214+
its own layout and would otherwise carry no indicator),
215+
and in flow rather than overlaid, so it never covers the
216+
header it warns about. Renders null on every ordinary
217+
session. */}
218+
<ImpersonationBanner />
219+
{/* objectui#9954 — the environment admin's read-rate report.
220+
Beside the impersonation indicator for the same reason it
221+
is here: chrome for EVERY console page, including `/home`,
222+
which has its own layout and would otherwise carry no
223+
report. Renders null unless the control plane's verdict is
224+
`anomalous`, so an ordinary session and an unmeasured
225+
environment both see nothing — and a non-admin session
226+
never even issues the request, nor does any session on a
227+
runtime whose config does not serve `storageUsage`
228+
(objectui#11002). */}
229+
<ReadRateBanner />
230+
{/* objectui#10439 — the environment admin's storage-capacity
231+
banner, beside the read-rate report and behind the same
232+
two gates (the admin, and the runtime serving
233+
`storageUsage`); the two read one `/usage/storage` response.
234+
Renders null unless the runtime's own verdict says `warn`
235+
(80% and up) or `blocked` (uploads and imports refused). */}
236+
<StorageUsageBanner />
237+
</ChromeBannerSlot>
232238
<Suspense fallback={<LoadingFallback />}>{children}</Suspense>
233239
{/* ADR-0069 — full-screen gate (expired password / required MFA) above all routes */}
234240
<RemediationOverlay />

0 commit comments

Comments
 (0)