Repository navigation
Commit 141a826
feat(console): an app's docs page has one navigation — the docs column — with the path to its book and the previous and next article (#36000)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuCS24S2hYG3SFdUpRMkrGmE)_
Part of #35424
repo:objectstack#1 · os-sales · session_01L6bhgWcCSnzHX9bYADvAVH · Area:
b1-CX
## 维护者速读
- 用户看到的变化:在应用里打开一篇文档,左边不再有应用菜单,只剩文档自己的一栏(顶部「←
返回〈应用〉」、搜索、这个应用的全部手册、底部「全部文档 →」);只有一条顶栏「〈应用〉 / 文档」;正文 720 px、15
px;「本页目录」随滚动高亮;文末有上一篇和下一篇;流程图可放大。应用的文档首页、空手册和找不到的页面顶部也有「← 返回〈应用〉」。
- 为什么:#35424 指出同屏三套导航、两条顶栏、标题被截断、没有上一篇和下一篇、正文太窄。
- 最坏情况:只影响显示。某个文档页如果漏了返回入口,读者只能用顶栏的应用切换器或浏览器后退;撤回这个 PR 即恢复原样。
- 需要 Sales 做的:无。「全部文档」页(第 6–9 项)是下一个 PR。
## What changes
The reading page half of #35424 (its items 1–5, design figure 25). The
"All docs" page (items 6–9, figure 26) is the next PR.
Inside an app, a documentation page (`/apps/<app>/docs/…`):
1. **No app menu beside the docs.** `ConsoleLayout` mounts no
`UnifiedSidebar` on an app's docs routes (`isAppDocsPath`, beside
`isRecordPagePath`), and the app bar draws no sidebar toggle there (its
slot is held empty, as off an app). The left column is the docs' own
(`DocsNav`), headed by 「← Back to <app>」 (the app the route segment
addresses, by the label the app bar shows). Every other docs page inside
an app (the app's docs index, a book with no articles, a book or doc not
found) carries the same link at its top (`DocShell` draws
`AppDocsBackLink`; the reader turns it off because its column has it),
so no docs page is left without a way back.
2. **One bar.** The app bar stays and reads 「<app> / Documentation」 (a
`docs` crumb in `AppHeader`, from `help.documentation`). `DocShell`
draws no bar of its own inside an app, so the separate 「Documentation /
<title>」 strip is gone. Above the article, the path names the book:
Documentation › <book>, both links.
3. **Every book of the package in the column.** The current book open,
the others folded, each with its article count; long titles wrap instead
of truncating (`BookSidebar`); a 「Search docs」 field filters the column
by article title and summary; 「All documentation →」 at its foot (the
existing `help.allDocs` key). (The full-text search of all docs is item
9, the next PR.)
4. **「On this page」 marks the section being read** as the page scrolls
(`useActiveHeading`: the last heading at or above the bar plus the
headings' scroll margin; the last one once the page is scrolled to its
end), and the article ends with its book's **previous / next article**
cards; at either end of the book the empty side says so.
5. **Article 720 px wide at 15 px** (was ~590 px at 14 px). A Mermaid
diagram gets an 「Enlarge」 control that opens it full size in a dialog:
`@object-ui/plugin-markdown` adds `MermaidEnlargeContext`, which the
reader provides; with no provider (every other markdown surface) a
diagram renders exactly as before. The dialog's copy renames the
render-id prefix (root id, scoped styles, markers), so no id appears
twice while it is open.
The portal reader (`/docs/<book>/<doc>`) gets the same column, path and
pager; its own header bar stays until the next PR gives that page the
top bar.
`@object-ui/app-shell` exports `matchAppBySegment` and
`useServedAppLabel` for the back link. Twelve new `help.*` keys in all
11 shipped locales (real text in each).
## Why
The maintainer's topic #34571, card #35424: three navigations side by
side on one screen (the app's 30-odd menu entries, the book's contents,
"On this page"), a second bar under the app bar, the other books of the
app reachable only through the app menu, truncated titles, no previous /
next, no current section, a narrow 14 px body.
## Verification
- Browser, against the showcase app (`objectstack dev --fresh`, console
on vite), zh-CN, 1440 × 900,
`/apps/com.example.showcase/docs/manual/showcase_tour_ui`:
- before: app menu drawn, two bars, article 592 px, body 14 px, no
current section;
- after: no app menu (`[data-sidebar=sidebar]` absent), one bar reading
「功能展示 / 文档」, article 720 px, body 15 px; scrolled to the end, 「本页目录」
marks 「Branding」 and the pager shows 上一篇 Tour · Data / 下一篇 Tour ·
Automation; 32 px below the pager at the end of the scroll (no blank
screen; it was 24 px on `main` here too, so the hosted environment's
blank screen was not reproduced on `main`).
- At 900 px the column folds into the disclosure above the path, as the
book sidebar did.
- Screenshots (before / after) are kept with the card's evidence for the
reviewer.
- Tests (new pins in the existing harnesses):
- `docs-portal.test.tsx` — the in-app reader: no bar of its own; back
link and 「All documentation」; the path's two links; the pager at the
first and last article; the search narrowing the column and its no-match
line; a package with two books lists both (current open, other folded,
unfolds on click) and no other package's book. The app's docs index and
a not-found book lead back to the app; the reader carries the link once.
- `docs-reading.test.ts` — reading order (a doc placed twice counted
once, links and separators skipped), neighbours, the filter (title,
summary, case, non-Latin), `pickActiveHeading`.
- `ConsoleLayout.phoneRecordOneBar-28483.test.tsx` — docs routes draw no
app menu and keep the app bar; other routes keep the menu;
`isAppDocsPath` table.
- `AppHeader.systemBreadcrumbs-10969.test.tsx` — 文档 / Documentation
crumb on the docs routes; the empty toggle slot there, the toggle
elsewhere.
- `Mermaid.enlarge-35424.test.tsx` — the control and dialog with a
provider (the dialog's copy under its own ids), nothing without one.
- `DocPage.docLinkBasename-12686.test.tsx` — its portal control now
reads every 「Documentation」 link (the header's and the path's); both
name the portal.
- `vitest`: `apps/console`, `packages/plugin-markdown`, `packages/i18n`
in full: 1,399 files, 5,458 tests passed (one red on the first run,
`zh-hant-generated.test.ts`: two zh-Hant strings were hand-written;
regenerated with `gen:zh-hant`, now green). `packages/app-shell`: the
165 test files that import `AppHeader`, `ConsoleLayout`, the new exports
or the package index, 1,458 tests passed (its full 2,356 files outran a
50-minute local budget; CI runs them). `tsc` for the four packages and
`eslint` over the changed files: 0 errors, no new warnings.
- `overlap-check.mjs`: clean against `origin/main` and the four open PRs
sharing the locale files (#35918, #35968, #35984, #35994).
Clause-②: yes (widening) — @object-ui/plugin-markdown exports
MermaidEnlargeContext and MermaidEnlargeText; @object-ui/i18n adds 12
help.* keys; nothing removed
Metadata-protocol: none
Follow-ups (not in this PR): items 6–9 of #35424 (the "All docs" page:
top bar, grouped by app, localized subtitle and counts, system packages
named and shown to admins only, search all docs) — next PR, new thread.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(No spec change.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [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: n/a.
- [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 with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgWcCSnzHX9bYADvAVH
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgWcCSnzHX9bYADvAVH -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 32409a9 commit 141a826
32 files changed
Lines changed: 1210 additions & 74 deletions
File tree
- .changeset
- ui
- apps/console/src/pages
- packages
- app-shell/src
- layout
- __tests__
- i18n/src/locales
- plugin-markdown/src
| 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 | + | |
| 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 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
| 41 | + | |
32 | 42 | | |
33 | 43 | | |
34 | | - | |
| 44 | + | |
35 | 45 | | |
36 | 46 | | |
37 | | - | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | | - | |
41 | | - | |
42 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| |||
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
57 | | - | |
| 69 | + | |
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
| |||
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
70 | | - | |
| 82 | + | |
71 | 83 | | |
72 | | - | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
197 | 200 | | |
198 | 201 | | |
0 commit comments