Repository navigation
Commit 2924732
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_
Fixes #36485
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:系统管理员在任何应用里点左上角应用名,应用列表下面、和「添加应用」同一组多了「编辑应用」,点了直接进入设计模式;页头右上角不再有「编辑应用」和「在
Studio 中查看 某应用」两个按钮,只剩 AI
助手和帮助。自建应用和安装来的应用一样;侧栏收起时从左边缘滑出的菜单里也能点到;普通成员看不到,手机上没有入口。
- 为什么做:运行界面设计模式专题的一张子卡,按你「立卡」的那条建议,把设计入口集中到应用名菜单,页头只留每页自己的按钮。
- 出错会怎样:最坏是管理员在页头找不到「编辑应用」,要去应用名菜单里点;设计模式本身和保存都没改,撤回本 PR 即恢复原来的按钮。
- 要你做什么:无。
## What changes
- **App-name menu** (`SidebarAppMenu`): a new 「Edit app」 item
(`sidebar-app-menu-edit-app`, the `topbar.editApp` key every locale
already carries, no new i18n key) under the app list, in one group with
「Add app」 (one rule above the group, none between the two). Choosing it
calls the shell's `useDesignMode().enter` for the app on screen: no
navigation, no Studio.
- **Who sees it — the header button's condition, carried over unchanged,
no new judgement**: `useStudioEntryGate` (the gate `useAppStudioEntry`
reads) answers non-null, i.e. `useWorkspaceAdminStatus().isAdmin` AND
`useCanAuthorMetadata()` (the server-reported `manage_metadata`
capability) AND the app's package is one `GET /api/v1/packages` lists
(not a kernel package: Setup, Studio, Account get none); a read-only
package (`posture: 'view'`) only where the customization door takes the
caller (`!postureHasOrgWall(useTenancyPosture()) ||
user.isPlatformAdmin`), as #36363 set it. It reads the app's own Studio
path (`appStudioDesignPath`); the gate judges the package id only, so
the answer is the one the header got on every route.
- **While the mode is on** the item is not drawn (same as the header
button was). **Where no shell holds the mode** it is not drawn either
(the header used to fall back to a Studio link there; nothing in the
console renders the sidebar outside `ConsoleLayout`'s provider).
- **Collapsed sidebar**: the float from the left edge is the same panel
with the same head, so the item is there too (pinned and
browser-measured).
- **Phone**: the sidebar head with the app menu is drawn from 768 px up
only, so no entry, as before.
- **Page header** (`ShellPageActions`): `EditAppButton` is deleted: no
「Edit app」 and no 「Open {app} in Studio」 in the group on any route. The
group now reads no Studio gate at all (`useAppStudioEntry(false)`, app
only, for the help menu's package). `useAppStudioEntry` stays:
`AppHeader` (the top bar still drawn below 768 px and on docs pages)
reads it.
- **Installed apps today**: on `main` an installed (read-only) app
already enters the mode (#36363 landed), so in this PR an installed
app's menu item behaves exactly as a self-built one's. Its one exception
is the walled-deployment case above: there the item is absent (the
header showed the eye into Studio; that eye is gone with the header
buttons, so such a caller reaches Studio through the app switcher's row
or Studio's landing).
- **Onboarding**: there is no step pointing at 「Edit app」:
`chrome/OnboardingWalkthrough.tsx` is a stub that renders nothing, and
no other tour exists in the console.
## Tests
<details><summary>Pins added or rewritten (vitest, root ui/)</summary>
- `SidebarAppMenu-36112.test.tsx`, new top-level describe 「Edit app」 in
the app menu enters the design mode: placement under the list with one
rule before the group; choosing it turns the real
`useDesignModeController` on and the item is gone while on; a read-only
package's app has it and enters; walled + read-only gets none, walled +
writable keeps it; controls: a member, an admin without
`manage_metadata`, the Setup app (package not listed), no shell holding
the mode. The package list is the stubbed `fetch`; the file-level
`beforeEach` now stubs it for every test, since the menu reads the gate
for admins.
- `ShellPageActions-36111.test.tsx`: the group's order is comments then
help; the old 「Edit app」 / eye / design-mode-button describes are
replaced by one asserting neither entry (test id and accessible name)
for writable and read-only packages, with and without a design-mode
shell, walled, and for a member.
- `UnifiedSidebar.hiddenCollapse-35062.test.tsx`, new top-level
describe: sidebar collapsed at 1024 px, floated by a press on the left
edge, the real Radix app menu opened from inside the float offers 「Edit
app」, and choosing it turns the mode on.
</details>
<details><summary>Runs at f7d907a</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/layout/__tests__/` plus
`ObjectView.shellPageActions-36111`, `RecordDetailView.topBar-27524`,
`PageView.consoleHeader-36111` (lock VERDICT command-exit 0): Test Files
157 passed (157), Tests 1255 passed (1255). Run at 2b4666e plus the
test edits; the float pin and typing commit followed, re-run: the two
harness files 36/36.
- `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit`
and `tsconfig.test.json`): VERDICT command-exit 0.
- eslint on the five changed source and test files: 0 errors.
</details>
<details><summary>Ablation (one-shot, not kept)</summary>
- Menu item: `node scripts/ablation-replace.mjs --file
ui/packages/app-shell/src/layout/SidebarAppMenu.tsx --anchor
'{enterDesignMode && EDIT_APP_ITEM_ELEMENT}' --delete -- vitest …`
(anchor 1 → 0, blob 367de8d → 71946a69): 5 failed | 31 passed: every
positive pin in both harnesses red, every control green; restored blob
367de8d = HEAD.
- Header: `ShellPageActions.tsx` swapped for its base-commit text under
an EXIT trap: 3 failed | 5 passed (the order pin and both no-entry pins
red; the member control and the scope pins green); restored blob
2e64064 = HEAD, `git status` clean.
</details>
## Acceptance notes
- Browser, own stack (CRM example on its own port, `--fresh`; Console
dev server pointed at it), 1440 px. HotCRM is not in this container: the
CRM example's `com.example.crm` is a code package served read-only, so
it stands in for the installed app; a writable app was made for the
self-built case (`POST /api/v1/packages` `com.acme.mine` plus app
`my_sales` saved into it).
- Admin, read-only CRM app and writable My Sales app: header group
children = help only, no 「in Studio」 text anywhere on the leads list,
the accounts list and the pipeline dashboard; menu reads `CRM · Setup ·
(My Sales) · Edit app · Add app`; choosing 「Edit app」 draws the
design-mode bar; reopening the menu in the mode shows no 「Edit app」;
collapsed sidebar, floated from the edge: item present, choosing it
draws the bar.
- Member (created by the admin, no CRM permissions): menu reads `CRM`,
no 「Edit app」.
- 390 px: no app menu trigger and no 「Edit app」 anywhere.
- Not measured in the browser: a report route and a custom page route
(the CRM example has neither in its menu); the group is the same
component on every route and `PageView.consoleHeader-36111` /
`ObjectView.shellPageActions-36111` / `RecordDetailView.topBar-27524`
stayed green.
- Screenshots (before = the two files at the base commit, served by the
same dev server), in `/mnt/project-files/objectstack-seat2/`:
- header before / after: `36485-before-crm-readonly-header.png`,
`36485-before-selfbuilt-writable-header.png` /
`36485-after-crm-readonly-header.png`,
`36485-after-selfbuilt-writable-header.png`
- app menu before / after: `36485-before-crm-readonly-app-menu.png` /
`36485-after-crm-readonly-app-menu.png`,
`36485-after-selfbuilt-writable-app-menu.png`
- in the mode: `36485-after-*-design-mode-on.png`,
`36485-after-*-app-menu-in-mode.png`; float:
`36485-after-*-float-app-menu.png`,
`36485-after-*-float-design-mode-on.png`; member:
`36485-after-member-app-menu.png`
- The top bar still drawn from 640 to 767 px and on an app's docs pages
keeps its Studio pencil / eye (`AppHeader`, outside this card's file
surface): it opens Studio, not the mode. Left as is; named in the report
for the seat.
- `designMode.tsx`'s docblock still says the mode is entered from the
page header's 「Edit app」 (`ShellPageActions`); the file is read-only
here (open PR #36606 edits it). `ui/packages/app-shell/README.md`'s "App
→ Studio reverse bridge" describes the top bar only and does not mention
the mode's door; also outside the file surface. Both named in the
report.
- ADR-0146 D5 says the app bar entry draws as 「Open {app} in Studio」;
the page header's copy of it is gone. The sentence goes to the seat's
ADR-revision card, not this PR.
## Verification
Read first:
1. `ui/packages/app-shell/src/layout/SidebarAppMenu.tsx`,
`useEnterDesignMode`: the gate carried over from the header; the risk is
a viewer who saw the header button and now sees no menu item, or the
reverse.
2. `ui/packages/app-shell/src/layout/ShellPageActions.tsx`,
`ShellPageActionsGroup`: the group no longer reads the gate.
3. `UnifiedSidebar.hiddenCollapse-35062.test.tsx`, the new last
describe: the float path.
Two-minute check: as an admin, open any app page at desktop width, click
the app name at the top left: 「Edit app」 sits under the app list above
「Add app」; click it and the blue Design mode bar appears; the page
header's top-right has only the AI and help buttons.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRB34k9WUWeGpRnVNm -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3110de5 commit 2924732
6 files changed
Lines changed: 332 additions & 224 deletions
File tree
- .changeset
- ui/packages/app-shell/src/layout
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
| |||
184 | 180 | | |
185 | 181 | | |
186 | 182 | | |
187 | | - | |
188 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
189 | 186 | | |
190 | 187 | | |
191 | 188 | | |
| |||
205 | 202 | | |
206 | 203 | | |
207 | 204 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | 205 | | |
290 | 206 | | |
291 | 207 | | |
| |||
300 | 216 | | |
301 | 217 | | |
302 | 218 | | |
303 | | - | |
304 | | - | |
| 219 | + | |
| 220 | + | |
305 | 221 | | |
306 | 222 | | |
307 | | - | |
308 | 223 | | |
309 | 224 | | |
310 | 225 | | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | 226 | | |
315 | 227 | | |
316 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
| |||
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
31 | | - | |
| 38 | + | |
32 | 39 | | |
33 | | - | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | | - | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| 47 | + | |
40 | 48 | | |
41 | 49 | | |
42 | 50 | | |
43 | 51 | | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
46 | 56 | | |
| |||
93 | 103 | | |
94 | 104 | | |
95 | 105 | | |
96 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
97 | 144 | | |
98 | 145 | | |
99 | 146 | | |
100 | 147 | | |
101 | 148 | | |
102 | | - | |
103 | 149 | | |
104 | 150 | | |
105 | 151 | | |
| |||
135 | 181 | | |
136 | 182 | | |
137 | 183 | | |
| 184 | + | |
138 | 185 | | |
139 | 186 | | |
140 | 187 | | |
| |||
203 | 250 | | |
204 | 251 | | |
205 | 252 | | |
| 253 | + | |
| 254 | + | |
206 | 255 | | |
207 | 256 | | |
208 | 257 | | |
| |||
0 commit comments