Repository navigation
Commit 93bd459
feat(console): an app's docs pages draw in the app shell from 768 px up (#37193)
repo:objectstack#4 · os-justin · session_01QSeKYnagJvGbCtNg2PhvgW
Part of #37150 — this PR carries Change items 1, 3 and 4 (an app's docs
pages, `/apps/APP/docs…`, in the app shell from 768 px up; every old
docs URL pinned; phone unchanged). Item 2 (the standalone `/docs` portal
in the same appearance) is carried by #37197: the maintainer ruled B, an
app-less shell variant (#37150 comment 7151721568), design first.
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
电脑上从应用里打开文档(应用内的文档首页、书、文章)时,顶栏没有了,左侧是和其它应用页面一样的侧栏,侧栏正文换成文档目录;手机不变,独立的文档门户这次没改。
- 属于「去掉顶栏和平台首页那一层」专题的第三阶段:让读者在应用和它的手册之间来回时看到同一种外壳。
- 出错时读者在电脑上看文档会找不到目录或返回应用的入口;改动只在前端,直接撤回这个改动即可恢复原样。
- 不需要你再定什么:独立文档门户的外壳已按你选的 B 方案定下(不属于任何应用的外壳变体,#37150 评论 7151721568),由
#37197 承接,先出设计图给你看,批准后再做。#37197 设计图里唯一会牵动本 PR 的问题是「全部文档」放在侧栏哪里(本 PR
目前放在底部)。
## What changes
- `ConsoleLayout` (app shell): the `isAppDocsPath` exception now holds
on a phone only. From 768 px up an app's docs pages mount
`UnifiedSidebar` (head: app-name menu, collapse, search, bell; foot:
account) and draw no top bar, like every other desktop app page. The
connection banner shows there too, since no bar carries it any more.
- `UnifiedSidebar` takes `docsNav`: on an app's docs route its body is
an empty target (`SidebarDocsNavTarget`) in place of the app's menu and
recents (the one-navigation rule of the earlier docs work holds: a
reader has one navigation, the docs').
- New `layout/sidebarDocsNavSlot.tsx`: a provider (mounted by
`ConsoleLayout`), the sidebar's target element, and `SidebarDocsNav`, a
portal the docs page draws its column through, so the column keeps the
page's router and data context. Exported from `@object-ui/app-shell`
with the two existing page-header slot hooks.
- Console docs pages: `DocShell` draws the column into the sidebar when
the slot exists (the reader's own column, else `AppDocsNav`: every book
of the app, 「← Back to APP」 and 「All documentation」) and draws the page
header's button group and expand button at the page's top. `DocPage`
stops drawing its in-page column when the sidebar carries it.
`usePackageDocsNavBooks` is the reader's former inline memo, lifted so
the non-reader pages share it.
- `ConsoleBootShell`: the boot fallback matches (sidebar, no bar on an
app's docs page from 768 px up; unchanged on a phone).
- Unchanged: every route and URL shape (ADR-0046 section 6), the `/docs`
portal frame (`DocsPortalRoute`, `DefaultHomeLayout variant="docs"`),
the phone.
## Tests
- `ConsoleLayout.phoneRecordOneBar-28483.test.tsx`: the route
exception's removal: at 768 and 1440 px, `/apps/crm/docs`,
`/apps/crm/docs/`, a book, a flat permalink and an article mount the
sidebar with `docsNav` and no top bar; PHONE CONTROL at 390 px keeps no
sidebar and the app bar; control: other app routes keep the app menu.
- `UnifiedSidebar.footerSlot-36739.test.tsx`: the page's column lands in
the sidebar body, the app menu is gone, head and foot stay; control
without `docsNav`.
- `ConsoleBootShell-35981.test.tsx`: the boot fallback at 768/1440 vs
375 px.
- `docs-portal.test.tsx` (objectstack#37150 block): the reader's one
column is in the sidebar; the page header carries the shell's group; old
URL forms in the shell: reader, book, flat permalink, docs index, book
NAME, book NAME/DOC, doc-name-that-is-also-a-book-name, canonical
SLUG/DOC each land on the same canonical URL and article as before;
non-reader pages; CONTROL without the shell (phone, `/docs`): the page
draws its own column and back link. The `/docs` URL forms keep their
existing pins in the same file (unchanged frame).
<details><summary>Test runs (head fd2011e)</summary>
All through `scripts/pm/os-verify-lock.sh`, `--maxWorkers=2`, at
fd2011e unless noted.
- The four pinned files (`ConsoleLayout.phoneRecordOneBar-28483`,
`ConsoleLayout.noTopBar-36112`, `UnifiedSidebar.footerSlot-36739`,
`ConsoleBootShell-35981`): `Test Files 2 passed`, `Tests 23 passed` for
the two ConsoleLayout files at fd2011e; the sidebar and boot files
`Test Files 3 passed (3)`, `Tests 27 passed (27)` at 827b3c7
(unchanged since).
- `docs-portal.test.tsx`: `Test Files 1 passed (1)`, `Tests 62 passed
(62)` at 827b3c7; the objectstack#37150 block with the added URL pins
`Tests 13 passed | 53 skipped (66)` at 2ec4312.
- Narrowed suite: every app-shell test that names `ConsoleLayout`,
`UnifiedSidebar`, `ConsoleBootShell`, `consoleRoutePaths`,
`sidebarDocsNavSlot` or `isAppDocsPath` (128 files) and every console
test that names a docs page (13 files), at 2ec4312: app-shell `Test
Files 1 failed | 127 passed (128)`, the one red was
`ConsoleLayout.noTopBar-36112`'s control pinning the old docs-page bar,
corrected in fd2011e and green above; console `Test Files 13 passed
(13)`, `Tests 122 passed (122)`.
- `type-check` (`@object-ui/app-shell`, `@object-ui/console`) after
rebuilding the app-shell dependency closure: VERDICT command-exit 0.
- Full app-shell and console suites: declared to CI (`Test UI`); the
local full run was stopped after 38 minutes holding the shared lock.
</details>
<details><summary>Ablations (one-shot, restored byte-identical to
HEAD)</summary>
Both through `scripts/ablation-replace.mjs` (anchor hit 1 -> 0 on disk,
restored blob == HEAD, `git diff HEAD` empty). The tests import these
sources directly (relative import; `@object-ui/app-shell` aliased to
`src` in the console's vite config), so no `dist/` is involved.
1. `ConsoleLayout.tsx`: `phoneDocsPage ? undefined : (` -> `docsPage ?
undefined : (` (the sidebar exception back at every width). Expected
red; observed: `× at 768 px and 1440 px a docs index, a book, a flat
permalink and an article draw the sidebar …`, `Tests 1 failed | 14
passed (15)`; the PHONE CONTROL stayed green.
2. `DocPage.tsx`: `const pageNav = sidebarNav ? null : docsNav;` ->
`const pageNav = docsNav;` (the reader draws its in-page column in the
shell too). Expected red; observed `Tests 9 failed | 4 passed | 53
skipped (66)`: the one-column test and all eight URL-form pins (two
columns).
</details>
## Acceptance notes
- **Item 2 is not in this PR; it is carried by #37197.** `ConsoleLayout`
is app-scoped by construction and `/docs` names no app. The maintainer
ruled option B, an app-less shell variant (「B:做一个不属于任何应用的外壳变体(推荐)」,
#37150 comment 7151721568), and asked to see the design first. #37197
carries it: stage 1 mockups, then the build after approval and after
this PR lands.
- With the sidebar collapsed, the docs page's header row draws the
shell's expand button; it registers with the shell's header registry, so
the content-corner fallback does not draw a second one.
- Screenshots were taken at the implementation commits (096ac67),
before the `origin/main` merge; the merge's only overlap with this
surface is `ui/packages/app-shell/src/index.ts`, merged clean, and no
implementation file changed after.
## Verification
Read first (by risk):
1. `ui/packages/app-shell/src/layout/ConsoleLayout.tsx`: the
`phoneDocsPage` hunk (sidebar mount and `showHeader`), the branch the
shell's look hangs on.
2. `ui/apps/console/src/pages/DocShell.tsx`: the sidebar portal and the
page-header row.
3. `ui/packages/app-shell/src/layout/UnifiedSidebar.tsx`: the `docsNav`
body swap.
Two-minute check: in the showcase app (`pnpm dev`), open the Showcase
app's documentation from its menu at 1440 px: no top bar, the sidebar
head reads 「Showcase」, the sidebar body is the docs column with 「← Back
to Showcase」 first and 「All documentation」 last; narrow the window to
390 px and the app bar and the in-page column are back.
Desktop, an app's docs reader (no top bar, sidebar body = docs column):

Desktop, an app's docs index:

Desktop, a flat doc permalink (lands on the same reader):

Desktop, the `/docs` portal entry (unchanged by this PR; item 2):

Phone control, 390 px (unchanged: app bar, in-page column):

Screenshots live on the assets-only branch
`claude/issue-37150-screenshots` (never merged).
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent bc3ec37 commit 93bd459
15 files changed
Lines changed: 503 additions & 78 deletions
File tree
- .changeset
- ui
- apps/console/src/pages
- packages/app-shell/src
- console
- __tests__
- layout
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
| 252 | + | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
263 | 260 | | |
264 | 261 | | |
265 | 262 | | |
| |||
397 | 394 | | |
398 | 395 | | |
399 | 396 | | |
| 397 | + | |
| 398 | + | |
400 | 399 | | |
401 | | - | |
| 400 | + | |
402 | 401 | | |
403 | | - | |
404 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
405 | 406 | | |
406 | | - | |
| 407 | + | |
407 | 408 | | |
408 | 409 | | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
412 | | - | |
| 413 | + | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
416 | 417 | | |
417 | | - | |
| 418 | + | |
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
422 | 423 | | |
423 | 424 | | |
424 | | - | |
| 425 | + | |
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
| 18 | + | |
12 | 19 | | |
13 | 20 | | |
14 | 21 | | |
15 | | - | |
16 | | - | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
23 | 37 | | |
24 | 38 | | |
25 | 39 | | |
26 | 40 | | |
27 | 41 | | |
28 | 42 | | |
| 43 | + | |
29 | 44 | | |
30 | 45 | | |
31 | | - | |
| 46 | + | |
32 | 47 | | |
| 48 | + | |
| 49 | + | |
33 | 50 | | |
34 | 51 | | |
35 | 52 | | |
36 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
37 | 57 | | |
38 | 58 | | |
39 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
40 | 71 | | |
41 | 72 | | |
42 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
0 commit comments