Skip to content

Commit ff0d1f1

Browse files
fix(console): split the app menu into 「设计布局」 (design mode) and 「编辑应用」 (Studio) (#36789)
<!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8PanmkK2ui9up8s9dwHt89v)_ Fixes #36758 Clause-②: yes (widening) — two new language-pack keys, `topbar.designLayout` and `topbar.viewInStudio`, in every shipped locale Metadata-protocol: none ## 维护者速读 - 管理员点开左上角应用名,下拉里原来的「编辑应用」拆成两行:「设计布局」进入页面上的设计模式(顶部横条也改叫「设计布局」),「编辑应用」直接打开本应用在 Studio 里的软件包;已安装的应用这一行显示「在 Studio 中查看」。 - 属于「设计模式」专题:原来「编辑应用」实际只能改菜单和页面布局,桌面上又没有任何地方能从正在用的应用进入 Studio。 - 只有能编辑元数据的管理员看得到这两行,各自沿用原来的显示条件;出错最多是入口文案或跳转位置不对,撤回这个 PR 即恢复原样。 - 无 ## What changes The sidebar's app-name menu (from 768 px up) had one row under the app list, 「编辑应用」 / "Edit app", and it entered the design mode, which edits only the app's layout (its menu, header pins, page arrangement). It now has two rows, as ruled on the card (15:59Z 「编辑布局+编辑应用两行」, wording 「设计布局 编辑应用」): - **「设计布局」 / "Design layout"** enters the design mode, on its existing gate (`useEnterDesignMode`, unchanged). Icon: the design-mode bar's pencil-ruler. - **「编辑应用」 / "Edit app"** opens this app's package in Studio. Its target and posture are `useAppStudioEntry`'s, the derivation the app switcher's Studio row and the top bar's pencil already read, so the three cannot disagree (an object page opens that object in the Data pillar, a dashboard, page or report its design surface). An installed (read-only) package's app reads **「在 Studio 中查看」 / "View in Studio"** behind an eye. Its gate is the Studio entry's own (`useStudioEntryGate`: a workspace admin holding `manage_metadata`, a package Studio lists; the console's own apps get none). No new gate. - The design-mode bar's title `designMode.title` becomes 「设计布局」 / "Design layout" in every locale, and so do the strings that name the mode: `designMode.leaveUnsaved`, `designMode.menu.newItemSavesAll`, the report builder's `addsToMenu` (zh), `appMenuEmptyDescription`, and Studio's two `engine.studio.data.appMenu.failed*` lines (en, zh). - `ShellPageActions.tsx` imports `appStudioRoutePath` from `utils/appRoute.js` instead of the `utils` barrel: the sidebar's suites stub the barrel partially, and the menu now reads this hook. - Docs: `content/docs/ui/actions.mdx` (the path to 「Header buttons」 now goes through 「Design layout」) and the app-shell README's reverse-bridge section. Out of scope, per the card: dashboard and report editing (#36692, the dashboard/report split) and record tabs in this mode (#36737, folding record tabs into design mode). ## Why The door's name promised the whole app and delivered the layout, and on desktop no surface opened the running app in Studio (`AppSwitcher`'s Studio row only draws where `AppHeader` does: phone, docs, design mode). ## Tests - `SidebarAppMenu-36112.test.tsx`: both rows, their order in one group with 「Add app」, the design-layout door turning the mode on, the Studio row's target on an object route (`/studio/com.acme.crm/data?surface=object:crm_lead`) and on a dashboard route (`…/interfaces?surface=dashboard:pipeline`), the read-only posture's 「View in Studio」 behind an eye, the Studio row drawn without a design-mode shell, and the member / non-author / Setup controls. A words block reads the built-in packs: zh-Hans `topbar.designLayout` = `designMode.title` = 「设计布局」, `topbar.editApp` = 「编辑应用」, `topbar.viewInStudio` = 「在 Studio 中查看」; every pack names the door as its bar. - `designMode-36362`, `DesignModeMenu-36363`, `UnifiedSidebar.hiddenCollapse-35062`: the renamed bar title, leave prompt and door. - `de-quote-pairing-3876`: the de pack's paired-quote count 133 → 134 (the new „Layout gestalten“ span). Local runs at `7274e5e9f` minus the changeset-only last commit (code unchanged since): <details><summary>Local readings</summary> - `pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/` → Test Files 158 passed (158), Tests 1324 passed (1324) - `pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/designMode-36362.test.tsx packages/app-shell/src/layout/__tests__/DesignModeMenu-36363.test.tsx packages/app-shell/src/console/` → Test Files 300 passed (300), Tests 2529 passed (2529) - `pnpm --dir ui exec vitest run packages/i18n/` → Test Files 107 passed (107), Tests 2006 passed, 13 skipped - `pnpm --filter @object-ui/app-shell type-check`, `pnpm --filter @object-ui/i18n type-check` → exit 0 - `pnpm check:nul-bytes`, `check:doc-authoring`, `check:role-word`, `check:closed-ceremony-text`, `check:published-readme-links`, `check-empty-changeset`, `check-changeset-no-major` → exit 0 - `node scripts/pm/overlap-check.mjs` → VERDICT clean (origin/main and #36525) - The rest of the derived gate families (`dispatch-gates.mjs --commands`) are left to this PR's CI. </details> ## Acceptance notes - **Deviation from the card body, accepted by the seat:** the card said to rename `topbar.editApp` to a layout wording. That key also names the top bar's Studio pencil (`AppHeader`), so renaming it would have mislabelled Studio. Instead `topbar.editApp` keeps 「编辑应用」 and now names the Studio entry everywhere; two keys were added, `topbar.designLayout` (the door) and `topbar.viewInStudio` (the read-only Studio row). Hence `Clause-②: yes (widening)`. - The Studio row is drawn while the design mode is on, as the app switcher's is; leaving for Studio with staged changes asks first through the shell's unsaved-edits guard. - Translations other than zh-Hans / zh-Hant / en were written for this PR (ar, de, es, fr, ja, ko, pt-BR, ru) and have not been reviewed by a native speaker. ## Verification Browser, showcase stack (`objectstack dev --seed-admin --fresh`, console on Vite), admin, 1440 × 900, zh-CN. Frames are attached to the card thread from `/mnt/project-files/issue-36758/`: 1. Showcase (installed, read-only) app menu: 功能展示 · 系统设置 | 设计布局 · 在 Studio 中查看 · 添加应用. 2. 「在 Studio 中查看」 lands on `/studio/com.example.showcase/interfaces?surface=page:showcase_capability_map` (the page on screen). 3. 「设计布局」 turns the mode on; the bar reads 设计布局 · 取消 · 保存. 4. A self-built app (new in Studio, 客户回访 with one object) menu: 设计布局 · 编辑应用 · 添加应用. 5. 「编辑应用」 lands on `/studio/com.default.kehu-hui-fang/data?surface=object:kehu_hui_fang_hui_fang_jilu`. Two-minute check: sign in as an admin, open any app built in Studio, click the app name at the top of the sidebar, and choose 「编辑应用」: Studio opens on that app's package. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. (lint left to CI) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbWTEmq1ogAGwhMbGtf)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01JQwxbWTEmq1ogAGwhMbGtf <!-- signed: repo:objectstack#1 · os-warren · session_01JQwxbWTEmq1ogAGwhMbGtf --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2f8e8ba commit ff0d1f1

27 files changed

Lines changed: 283 additions & 89 deletions
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): the app-name menu offers 「Design layout」 for the design mode and 「Edit app」 for Studio
7+
8+
Clause-②: yes (widening)
9+
Metadata-protocol: none
10+
11+
The app-name menu's 「Edit app」 entered the design mode, which edits only the app's layout (its menu, header pins and page arrangement), and no desktop surface opened the app itself in Studio. The menu now has two entries under the list of apps, in one group with 「Add app」:
12+
13+
- 「Design layout」 (zh 「设计布局」) turns the design mode on, on the same condition as before. The mode's bar now reads 「Design layout」 too, and so do the strings that name the mode (the leave prompt, the menu editor's notes).
14+
- 「Edit app」 (zh 「编辑应用」) opens this app's package in Studio, on the app switcher's Studio target: an object page opens that object in the Data pillar, a dashboard, page or report its design surface. An installed (read-only) package's app reads 「View in Studio」 (zh 「在 Studio 中查看」) behind an eye instead, and opens Studio's browse-only posture. It is offered on the Studio entry's own condition: a workspace admin holding `manage_metadata`, on an app whose package Studio lists (the console's own Setup, Studio and Account apps get none).
15+
16+
Two locale keys are added in every built-in pack, `topbar.designLayout` and `topbar.viewInStudio`; `topbar.editApp` keeps its words and now names the Studio entry wherever it is drawn.

‎content/docs/ui/actions.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ ObjectSchema.create({
413413
built-in the scope does not have and a built-in in `more`. `os validate`, `os build` and `os lint` also
414414
refuse a name that is no action of the object, or one the scope does not place.
415415
- An administrator sets the same arms in the running app: the app name at the top of
416-
the sidebar, then 「Edit app」 in its menu, then 「Header buttons」 at the end of the
416+
the sidebar, then 「Design layout」 in its menu, then 「Header buttons」 at the end of the
417417
page header. Only the arm changed is saved. For
418418
an installed object it is saved as this environment's customization, the
419419
`object_extension` of the base's paired `.custom` package, whose arm replaces the

‎ui/packages/app-shell/README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,12 @@ for admins and only when the app has an owning package (`_packageId`), and
642642
package writability stays a server-side concern — a read-only package opens in
643643
Studio as browse-only. For a read-only package the button draws an eye with the
644644
words "Open {app} in Studio" (ADR-0146 D5) instead of the pencil.
645+
From 768 px up, where no top bar is drawn, the sidebar's app menu carries the
646+
same entry on the same target and posture (`useAppStudioEntry`): "Edit app"
647+
behind a pencil, or "View in Studio" behind an eye for a read-only package.
648+
Beside it, "Design layout" turns on the shell's design mode, which edits the
649+
app's layout (its menu, header pins and page arrangement) in place; the mode's
650+
bar carries the same name.
645651

646652
The way back is the 「‹ Back to app」 link at the left end of Studio's top bar
647653
(`StudioBackToApp`), followed by the app's name and the "Studio" mark. Entered

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export function AppNoAccessEmptyState({ app, setupPath, reason = 'no-navigation'
143143
defaultValue: '{{app}} has nothing in its menu yet',
144144
})}
145145
description={t('empty.appMenuEmptyDescription', {
146-
defaultValue: 'Create objects for this app in Studio and they join its menu, or add entries in design mode.',
146+
defaultValue: 'Create objects for this app in Studio and they join its menu, or add entries in Design layout.',
147147
})}
148148
action={
149149
<Button asChild variant="outline">

‎ui/packages/app-shell/src/layout/ConsoleLayout.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function ConsoleLayout({
216216
const { apps: metadataApps } = useMetadata();
217217
const appBasePath = `/apps/${appAddressSegment(metadataApps, activeApp) ?? activeAppName}`;
218218
// objectstack#36362 — the app's design mode, held here so it stays on from
219-
// page to page of the app; never on a phone, which has no 「Edit app」.
219+
// page to page of the app; never on a phone, which has no 「Design layout」.
220220
const designMode = useDesignModeController({ appName: activeAppName, appBasePath, enabled: !phone });
221221
// objectstack#30043 — the page in view, handed to the dock as its
222222
// `context.surface` (cloud#1610's shape): the object of a list, the object

‎ui/packages/app-shell/src/layout/DesignModeBar.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
22

33
/**
4-
* The design mode's bar (objectstack#36362): 「Design mode」 at its left,
4+
* The design mode's bar (objectstack#36362): 「Design layout」 at its left
5+
* (objectstack#36758: the word its door in the app menu reads),
56
* 「Cancel」 and 「Save」 at its right, and nothing else (no app name, no
67
* explanation, no way to Studio). `ConsoleLayout` draws it in the app shell's
78
* top slot, across the whole window, while the mode is on (`designMode.tsx`).
@@ -14,7 +15,7 @@ import type { DesignModeValue } from './designMode.js';
1415

1516
export function DesignModeBar({ mode }: { mode: DesignModeValue }) {
1617
const { t } = useObjectTranslation();
17-
const title = t('designMode.title', { defaultValue: 'Design mode' });
18+
const title = t('designMode.title', { defaultValue: 'Design layout' });
1819
return (
1920
<div
2021
role="region"

‎ui/packages/app-shell/src/layout/ShellPageActions.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ import { cn, useSidebar } from '@object-ui/components';
4242
import { useObjectTranslation } from '@object-ui/i18n';
4343
import { useMetadata } from '../providers/MetadataProvider.js';
4444
import { useNavigationContext } from '../context/NavigationContext.js';
45-
import { matchAppBySegment, appStudioRoutePath } from '../utils/index.js';
45+
import { matchAppBySegment } from '../utils/index.js';
46+
// From its own module, not the barrel: the sidebar's app menu reads this hook
47+
// too (objectstack#36758), and the sidebar's suites stub the barrel.
48+
import { appStudioRoutePath } from '../utils/appRoute.js';
4649
import { useStudioEntryGate, type StudioEntry } from '../hooks/useStudioDesignGate.js';
4750
import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js';
4851
import {

‎ui/packages/app-shell/src/layout/SidebarAppMenu.tsx‎

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,19 @@
1010
* Studio, start from a template, the marketplace).
1111
*
1212
* objectstack#36485 — and the door into the design mode (`designMode.tsx`,
13-
* objectstack#36362): 「Edit app」 under the list, in one group with
14-
* 「Add app」, for the viewers the page header's 「Edit app」 was drawn for
15-
* (the header draws none any more). The sidebar's head is drawn from 768 px
16-
* up only, docked or floated over the content while the sidebar is
17-
* collapsed, so a phone gets no way in, as before.
13+
* objectstack#36362), under the list, in one group with 「Add app」, for the
14+
* viewers the page header's door was drawn for (the header draws none any
15+
* more). The sidebar's head is drawn from 768 px up only, docked or floated
16+
* over the content while the sidebar is collapsed, so a phone gets no way in,
17+
* as before.
18+
*
19+
* objectstack#36758 — the design mode edits the app's layout only (its menu,
20+
* header pins and page arrangement), so its door reads 「Design layout」, the
21+
* word its bar shows. 「Edit app」 beside it opens this app's package in
22+
* Studio: the app switcher's Studio row, on its target and posture
23+
* (`useAppStudioEntry`), so the two cannot disagree. An installed
24+
* (read-only) package's app reads 「View in Studio」 there, behind an eye.
25+
* Each row keeps its own gate.
1826
*
1927
* The list is `useLauncherApps`', the list Home's tiles and the phone's app
2028
* sheet draw, so every place offers the same apps. The phone keeps
@@ -35,7 +43,7 @@ import {
3543
DropdownMenuTrigger,
3644
Input,
3745
} from '@object-ui/components';
38-
import { Blocks, Check, ChevronDown, Plus } from 'lucide-react';
46+
import { Check, ChevronDown, Eye, Pencil, PencilRuler, Plus } from 'lucide-react';
3947
import { useObjectTranslation } from '@object-ui/i18n';
4048
import { useAuth } from '@object-ui/auth';
4149
import { useMetadata } from '../providers/MetadataProvider.js';
@@ -47,14 +55,16 @@ import { useStudioEntryGate } from '../hooks/useStudioDesignGate.js';
4755
import { useAddAppEntries, useMayAddApp } from '../hooks/useAddAppEntries.js';
4856
import { AppMark } from './AppMark.js';
4957
import { useDesignMode } from './designMode.js';
58+
import { useAppStudioEntry } from './ShellPageActions.js';
59+
import type { StudioEntry } from '../hooks/useStudioDesignGate.js';
5060
import { postureHasOrgWall, useTenancyPosture } from '../hooks/useTenancyPosture.js';
5161

5262
/** The app count above which the menu draws a search field over the list. */
5363
export const APP_MENU_SEARCH_FROM = 8;
5464

5565
/**
56-
* What 「Edit app」 does for this viewer, or `null` where it is not drawn: it
57-
* turns the shell's design mode on for the app on screen, in place.
66+
* What 「Design layout」 does for this viewer, or `null` where it is not
67+
* drawn: it turns the shell's design mode on for the app on screen, in place.
5868
*
5969
* Drawn on the page header's button's condition, unchanged: a workspace admin
6070
* holding `manage_metadata`, on an app whose package Studio lists
@@ -76,15 +86,39 @@ function useEnterDesignMode(apps: Parameters<typeof matchAppBySegment>[0], activ
7686
return designMode.enter;
7787
}
7888

79-
/** 「Edit app」: the door into the design mode. */
80-
function EditAppItem({ onEnter }: { onEnter: () => void }) {
89+
/** 「Design layout」: the door into the design mode, named as its bar is. */
90+
function DesignLayoutItem({ onEnter }: { onEnter: () => void }) {
8191
const { t } = useObjectTranslation();
8292
return (
83-
<DropdownMenuItem onSelect={onEnter} className="flex items-center gap-2.5 py-2" data-testid="sidebar-app-menu-edit-app">
93+
<DropdownMenuItem onSelect={onEnter} className="flex items-center gap-2.5 py-2" data-testid="sidebar-app-menu-design-layout">
8494
<span className="flex size-[22px] shrink-0 items-center justify-center text-muted-foreground" aria-hidden>
85-
<Blocks className="size-4" />
95+
<PencilRuler className="size-4" />
8696
</span>
87-
<span className="flex-1 truncate">{t('topbar.editApp', { defaultValue: 'Edit app' })}</span>
97+
<span className="flex-1 truncate">{t('topbar.designLayout', { defaultValue: 'Design layout' })}</span>
98+
</DropdownMenuItem>
99+
);
100+
}
101+
102+
/**
103+
* 「Edit app」: this app's package in Studio, where the app is built. An
104+
* installed (read-only) package opens in Studio's browse-only posture, so its
105+
* row reads 「View in Studio」 behind an eye, never a pencil.
106+
*/
107+
function StudioAppItem({ entry }: { entry: StudioEntry }) {
108+
const { t } = useObjectTranslation();
109+
const view = entry.posture === 'view';
110+
return (
111+
<DropdownMenuItem asChild className="flex items-center gap-2.5 py-2">
112+
<Link to={entry.path} data-testid={view ? 'sidebar-app-menu-view-in-studio' : 'sidebar-app-menu-edit-app'}>
113+
<span className="flex size-[22px] shrink-0 items-center justify-center text-muted-foreground" aria-hidden>
114+
{view ? <Eye className="size-4" /> : <Pencil className="size-4" />}
115+
</span>
116+
<span className="flex-1 truncate">
117+
{view
118+
? t('topbar.viewInStudio', { defaultValue: 'View in Studio' })
119+
: t('topbar.editApp', { defaultValue: 'Edit app' })}
120+
</span>
121+
</Link>
88122
</DropdownMenuItem>
89123
);
90124
}
@@ -131,6 +165,7 @@ export function SidebarAppMenu({ activeAppName, onAppChange }: SidebarAppMenuPro
131165
const { apps: launcherApps } = useLauncherApps(apps);
132166
const mayAddApp = useMayAddApp();
133167
const enterDesignMode = useEnterDesignMode(apps, activeAppName);
168+
const studioEntry = useAppStudioEntry(true, activeAppName).entry;
134169
const [query, setQuery] = React.useState('');
135170

136171
// The route may name an app the launcher does not offer (a direct URL to an
@@ -199,8 +234,9 @@ export function SidebarAppMenu({ activeAppName, onAppChange }: SidebarAppMenuPro
199234
</div>
200235
)}
201236
</div>
202-
{(enterDesignMode || mayAddApp) && <DropdownMenuSeparator />}
203-
{enterDesignMode && <EditAppItem onEnter={enterDesignMode} />}
237+
{(enterDesignMode || studioEntry || mayAddApp) && <DropdownMenuSeparator />}
238+
{enterDesignMode && <DesignLayoutItem onEnter={enterDesignMode} />}
239+
{studioEntry && <StudioAppItem entry={studioEntry} />}
204240
{mayAddApp && <AddAppSubmenu />}
205241
</DropdownMenuContent>
206242
</DropdownMenu>

‎ui/packages/app-shell/src/layout/__tests__/DesignModeMenu-36363.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ describe('the menu under the design mode (objectstack#36363)', () => {
626626
expect(order()).toEqual(['home', ['sales', ['accounts', 'leads']], ['insights', []]]);
627627

628628
fireEvent.click(screen.getByText('switch to hr'));
629-
expect(confirmSpy).toHaveBeenCalledWith('Leave design mode? Your unsaved changes will be lost.');
629+
expect(confirmSpy).toHaveBeenCalledWith('Leave Design layout? Your unsaved changes will be lost.');
630630
expect(switchedTo).toEqual([]);
631631
expect(screen.getByTestId('design-mode-bar')).toBeInTheDocument();
632632
expect(order()).toEqual(['home', ['sales', ['accounts', 'leads']], ['insights', []]]);

0 commit comments

Comments
 (0)