Repository navigation
Commit dab4712
feat(console): the All documentation page has the console's top bar, groups its books by app, and searches every article (#36027)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuBsvXiyTDYggWLQFR1qKw49)_
Fixes #35424
repo:objectstack#1 · os-sales · session_01L6bhgTo4iDVWE2AcWkPm77 · Area:
b1-CX
## 维护者速读
- 用户看到的变化:「全部文档」页(以及它下面的手册和文章页)换成和首页一样的顶栏「ObjectOS /
文档」,带搜索、通知、助手和头像菜单,可以直接回到任何应用;手册按应用分组,组名就是应用启动器里的名字;卡片上不再出现包 id;副标题和「9
篇」这样的计数跟随当前语言;页面右上角新增「搜索全部文档」,按标题、摘要和正文搜所有文章,结果里高亮命中的词,点开直接进到文章所在的手册。
-
系统包(如「系统设置」)的手册只挂在它的应用下面:成员的应用列表里没有这个应用,这页就不列它。这只是「列不列」,谁能读文档仍由服务端的受众规则决定,和以前一样。
- 最坏情况:只影响显示。全文搜索第一次输入时多一次 `GET /meta/doc?include=content`
请求(走和列表相同的受众规则);撤回这个 PR 即恢复原样。
- 需要 Sales 做的:无。
## What changes
The "All documentation" half of #35424 (its items 6–9, design figure
26), plus three notes carried from #36000.
6. **The console's top bar on every portal page.** `/docs`,
`/docs/<book>` and `/docs/<book>/<article>` now render inside Home's
frame (`DefaultHomeLayout`, under the same organization / permissions
layout as `/home`). The bar reads 「<product> / Documentation」 (a new
`docs` variant of `AppHeader`; the crumb links to `/docs`) and keeps the
centred search, inbox, assistant and avatar menu. The portal's own
「Documentation / <title>」 strip is gone (`DocShell` draws no bar off an
app).
7. **Books grouped by app** (`groupBooksByApp`, `docs-index.ts`). A book
goes under the first app whose navigation links to it (a `doc` entry
naming the book or one of its articles, in `navigation`, nested
`children` or `areas`, so a module's navigation contributions count),
else under the first app of its package; books no app carries are listed
last under 「Other documentation」. Groups are named as the launcher names
the app (`useServedAppLabel`). **The subtitle and the counts read the
session language** (「9 篇」), through new `help.*` keys with per-locale
plural forms.
8. **No package id on any card.** A package's docs with no authored book
are named by their app. A platform package's books (`com.objectstack.*`)
are listed only under an app in the member's list that carries them (one
linking them, else their own package's app), never under 「Other
documentation」, so a member whose app list (`/meta/app`, already
filtered by the server) has no such app does not see them listed. An
implicit book is named by its own package's app, never by another app
that links it. This is what the page lists, not who may read a doc: the
server's audience gate decides that, as before.
9. **「Search all documentation」** (`searchDocs`, `useDocContents`). A
search field on the page matches every listed article's title, summary
and body (every word must match; title ranks above summary above body),
and lists the matches with the words marked in context; each opens the
article in its own book. Mermaid source and markup are not searched. The
bodies are asked once, the first time the reader types (`GET
/meta/doc?include=content`, which the server answers through the same
audience gate as the slim list), and held for the page's life: one read
of every listed doc's body per visit that searches, and none for a visit
that does not. A server-side search shared with the MCP doc door is the
follow-up if doc volume grows. Every match is listed and counted (no
cap). The query stays in the URL (`?q=`). The label differs from the
reader column's 「Search docs」.
Notes from #36000:
- **N3:** a hand-typed `/docs/<book A>/<article of book B>` now
redirects to the article in its own book; with no book that holds it,
the reader draws no previous / next pager instead of both ends at once
(`bookHoldsArticle`).
- The portal reader passes `backLink={!docsNav}` to `DocShell`, so
inside an app an article whose book is in no package keeps its 「← Back
to <app>」 link.
`@objectstack/client`: `meta.getItems(type, { include })` (both the
unscoped and the environment-scoped client) sends `?include=`; leaving
it out sends nothing, as before. The options type is exported as
`MetaItemsListOptions`. `@object-ui/app-shell`: `AppHeader` takes a
`docs` variant; `DefaultHomeLayout` takes `variant`.
## Why
The maintainer's topic #34571, card #35424, figure 26: the "All docs"
page had no way back to the apps (its own one-line bar), listed books
flat with package ids (`com.objectstack.setup`), an English subtitle and
counts under a Chinese session, the Setup book for every member, and no
way to search across books.
## Verification
- Browser, against the showcase app (`objectstack dev --fresh`, console
on vite), zh-CN, dark, 1280 × 800 and 375 × 812, `/docs`,
`/docs?q=Markdown`, `/docs/manual`:
- before: one bar 「文档」 with no search or menus; two flat cards, the
second 「Setup」 with `com.objectstack.setup` under it; 「Books and guides
from your installed packages.」 and 「8 articles」 in English; no search.
- after: the bar 「ObjectOS 预览版 / 文档」 with search, inbox, help and
avatar; groups 「功能展示」 (示例手册, 8 篇) and 「系统设置」 (系统设置, 1 篇); subtitle
「已安装应用自带的使用手册。」; 「Markdown」 finds 3 articles, each with its book and the
word marked in the snippet; the reader under the same bar. At 375 px the
bar folds to its phone form and the search sits under the title.
- Screenshots (before / after, both widths) are kept with the card's
evidence for the reviewer.
- Tests:
- `docs-index.test.ts` (new): grouping by link, by package, the
ungrouped group, a `doc` link counting as linking its book, platform
books only under an app in the list that carries them (and named by
their own app), no package id line; search word logic and ranking,
listed-books filter, a hit naming its book as the card does, every match
answered, no diagram source or markup, snippet marking, CJK without
spaces.
- `docs-portal.test.tsx`: the real `DocsIndex` under the docs routes —
groups and labels, the platform rule, search (URL, one content read for
several queries, the article opened in its own book), search limited to
listed books, the label differing from 「Search docs」, the N3 redirect
with its control; the earlier collision pin now expects the redirect.
- `AppHeader.centeredSearch-12472`, `AppHeader.aboutBuild-12970`,
`AppHeader.searchTriggerNeedsPalette-11912`: the `docs` variant (centred
search, the crumb to `/docs`, the about item, the palette gate); the
home bar's control has no crumb.
- `client.test.ts`: `include` sent as `?include=` on both getItems,
nothing when left out.
- `App.docsPortalLazy.test.tsx`: the portal stays lazy inside its new
frame.
- `vitest`: `apps/console` docs files (64 tests), `packages/i18n` in
full (parity, base keys, CLDR plural categories per pack), the app-shell
layout and home tests, `packages/client` (223 tests): all passed. `tsc`
for console, app-shell (with `tsconfig.test.json`) and client;
`check:i18n-keys`; `eslint` over the changed files: 0 errors, no new
warnings. zh-Hant regenerated with `gen:zh-hant`.
- `overlap-check.mjs`: clean against `origin/main` and the five open PRs
sharing the locale files or `AppHeader.tsx` (#35968, #35994, #36018,
#36024, #36026).
Clause-②: yes (widening) — @objectstack/client `meta.getItems` takes an
optional `include` (`'content' | 'grants'`, sent as `?include=`) and
exports its options type `MetaItemsListOptions`; @object-ui/i18n adds
nine help.* keys (two of them plural, with their per-locale forms);
nothing removed
Metadata-protocol: none
Follow-ups (not in this PR): #36029 — give Setup's own books an
audience, so a member without `setup.access` cannot read them, not only
does not see them listed (card #35424 item 8 reads "only admins see it";
this PR makes it a listing rule).
## 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_01L6bhgTo4iDVWE2AcWkPm77
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgTo4iDVWE2AcWkPm77 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent c00be39 commit dab4712
32 files changed
Lines changed: 1270 additions & 154 deletions
File tree
- .changeset
- packages/client
- src
- ui
- apps/console/src
- __tests__
- pages
- packages
- app-shell/src
- console/home
- layout
- __tests__
- i18n/src/locales
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
212 | 234 | | |
213 | 235 | | |
214 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
238 | 251 | | |
239 | 252 | | |
240 | 253 | | |
| |||
2083 | 2096 | | |
2084 | 2097 | | |
2085 | 2098 | | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
2086 | 2102 | | |
2087 | | - | |
| 2103 | + | |
2088 | 2104 | | |
2089 | 2105 | | |
2090 | 2106 | | |
2091 | 2107 | | |
| 2108 | + | |
2092 | 2109 | | |
2093 | 2110 | | |
2094 | 2111 | | |
| |||
8696 | 8713 | | |
8697 | 8714 | | |
8698 | 8715 | | |
8699 | | - | |
8700 | | - | |
| 8716 | + | |
| 8717 | + | |
8701 | 8718 | | |
8702 | 8719 | | |
8703 | 8720 | | |
| 8721 | + | |
8704 | 8722 | | |
8705 | 8723 | | |
8706 | 8724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
216 | 230 | | |
217 | 231 | | |
218 | 232 | | |
| |||
351 | 365 | | |
352 | 366 | | |
353 | 367 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | 368 | | |
375 | 369 | | |
376 | 370 | | |
| |||
419 | 413 | | |
420 | 414 | | |
421 | 415 | | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
422 | 435 | | |
423 | 436 | | |
424 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
285 | 298 | | |
286 | 299 | | |
287 | 300 | | |
288 | 301 | | |
289 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
290 | 307 | | |
291 | 308 | | |
292 | 309 | | |
| |||
297 | 314 | | |
298 | 315 | | |
299 | 316 | | |
300 | | - | |
| 317 | + | |
301 | 318 | | |
302 | 319 | | |
303 | 320 | | |
| |||
311 | 328 | | |
312 | 329 | | |
313 | 330 | | |
314 | | - | |
| 331 | + | |
315 | 332 | | |
316 | 333 | | |
317 | 334 | | |
318 | 335 | | |
319 | | - | |
| 336 | + | |
320 | 337 | | |
321 | 338 | | |
322 | 339 | | |
| |||
357 | 374 | | |
358 | 375 | | |
359 | 376 | | |
360 | | - | |
| 377 | + | |
361 | 378 | | |
362 | 379 | | |
363 | 380 | | |
| |||
381 | 398 | | |
382 | 399 | | |
383 | 400 | | |
384 | | - | |
| 401 | + | |
385 | 402 | | |
386 | 403 | | |
387 | 404 | | |
| |||
441 | 458 | | |
442 | 459 | | |
443 | 460 | | |
444 | | - | |
| 461 | + | |
445 | 462 | | |
446 | 463 | | |
447 | 464 | | |
| |||
0 commit comments