Repository navigation
Commit 062236c
fix(console): in-app doc links keep the app shell; docs chrome reads the session language (#30579)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4Uu4MbnkfHMbgaMJXYX2yp8UL)_
Fixes #30554
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
改了什么:在应用里看文档时,正文里的文档链接改为指向当前应用的文档路由,点开后顶栏和应用菜单都还在;文档页头部的「Documentation」、文档门户标题和侧栏的「Uncategorized」分组改为按会话语言显示(10
种语言都补了词)。
- 为什么改:之前正文链接一律指向全局文档门户 `/docs/NAME`,用户在 HotCRM
手册里点「线索」会跳出应用、只能靠浏览器后退;中文界面里还夹着两个英文词。
- 风险与回滚:只改控制台文档页的链接目标和三处文案,路由形状不变、不碰 `packages/**`;门户(应用外)的链接保持原样;回滚即
revert 本 PR。
- 先看:`ui/apps/console/src/pages/DocPage.tsx`(链接基点 `base`
与点击跳转)、`ui/apps/console/src/pages/DocShell.tsx`(头部首页链接)、`ui/apps/console/src/pages/book-nav.ts`(`labelUncategorized`
按 key 取名)。
- 两分钟验证:`pnpm --dir ui exec vitest run
apps/console/src/pages/DocPage.docLinkBasename-12686.test.tsx
apps/console/src/pages/docs-portal.bookLocale-26690.test.tsx`,预期 2 个文件
16 条全过。
- 需要你做的:无,席位落地。
## What changes
- **Body cross-references inside an app stay in the app.** `DocPage`
rewrote `[x](./other_doc.md)` with `useHref('/docs')`, the portal, even
when the page was read under `/apps/APP/docs/BOOK/DOC` (ADR-0048). It
now resolves them under the route it is read under (`/apps/APP/docs`
inside an app, `/docs` outside), basename included as before
(objectui#12686); a plain left click navigates to the same base. The
flat `APP/docs/NAME` segment already redirects to the doc's in-book URL
under that base (`DocsSlug`), so the reader lands on
`/apps/APP/docs/BOOK/NAME` with the top bar and the app navigation.
- **The header's home link is the app's docs index inside an app**
(`DocShell`), the same defect class as the body links, in a claimed
file: before, it also pointed at the portal and left the app. Outside an
app it is still `/docs`.
- **The docs chrome reads the session language.** New keys
`help.documentation` and `help.uncategorized` in all ten locale packs.
`DocShell`'s home label and the `DocsIndex` heading read the first; the
book sidebar's synthetic catch-all group is titled with the second by
its key (`labelUncategorized` in the console's resolver copy
`book-nav.ts`), so the resolver's English label stays as authored and
authored groups keep the server's translation (`translateBook`,
objectstack#26690).
No server change: the body links were rewritten in the console, not
server-side, so the card stays in the ui lane whole.
## Tests
- `DocPage.docLinkBasename-12686.test.tsx` (the DocPage link harness),
new top-level describe: under `/_console` an app doc's body link is the
href react-router's own `Link` renders for `/apps/APP/docs/NAME`; a left
click lands in the app route, never the portal; root mount; the header
home link is the app's docs index; CONTROL: outside an app the home link
is still the portal.
- `docs-portal.bookLocale-26690.test.tsx` (the docs locale harness, real
route table, layout, reader and sidebar), new top-level describe: under
a real `I18nProvider` for zh, ja and es the sidebar's Uncategorized
group and the header home link read the pack's words (expectations read
from the packs, guarded as non-English); CONTROL with no provider reads
English. This harness's `useObjectTranslation` stub (defaultValue only)
was dropped so the provider can answer; its two existing cases are
unchanged and still pass. One unplaced doc was added to its fixture to
put an Uncategorized group on screen.
## Acceptance notes
- Still English, outside this card's two rows, not filed (polish of the
same pages): the `DocsIndex` subtitle "Books and guides from your
installed packages.", the "Documentation not found" / "Failed to load
documentation" notices in `DocPage` / `DocsSlug`, and the narrow-screen
disclosure's fallback "Contents" in `DocPage`.
- Studio's doc-draft preview
(`ui/packages/app-shell/src/views/metadata-admin/previews/doc-draft.ts`)
resolves through the spec's `resolveBookTree` and would show its
synthetic group as "Uncategorized"; not in this claim's file surface,
noted only.
- Branch is the card thread's platform-assigned
`claude/project-thread-y9p3c7`, not `claude/issue-30554-*`; the claim
amendment names it.
## Verification
<details><summary>Live rig on origin/main vs this branch (showcase +
console dev server, zh-CN)</summary>
Showcase `objectstack dev --seed-admin --fresh` with a temporary
unplaced doc (never committed) that links `./showcase_index.md`; console
Vite dev server proxied to it; Playwright signed in as the seeded admin
with the console language set to zh-CN, opened
`/apps/com.example.showcase/docs/showcase_rig_note`, read the header,
the sidebar group titles and the body links, then clicked the body link.
Before (base c23eafa):
- body link href `/docs/showcase_index`; after the click the path is
`/docs/manual/showcase_index`, app help button absent, app sidebar
absent (left the app shell)
- header home link text `Documentation`, href `/docs`
- sidebar groups `入门, 导览, 指南, Uncategorized`
After (this branch):
- body link href `/apps/com.example.showcase/docs/showcase_index`; after
the click the path is
`/apps/com.example.showcase/docs/manual/showcase_index`, app help button
present, app sidebar present
- header home link text `文档`, href `/apps/com.example.showcase/docs`
- sidebar groups `入门, 导览, 指南, 未分类`
- en-US control: `Documentation`, `Getting Started, Guided Tour, Guides,
Uncategorized`, links in the app route
</details>
<details><summary>Ablation (fix reverted, tests kept)</summary>
`DocPage.tsx`, `DocShell.tsx`, `book-nav.ts` and `DocsIndex.tsx`
restored to base c23eafa (disk hash = base blob for all four), the two
test files run: 8 failed / 8 passed — every new case red except the
outside-app CONTROL, which holds on both trees. Restored with `git
checkout HEAD --`, each file's hash re-checked equal to its HEAD blob.
</details>
<details><summary>Local runs at e2e2012</summary>
- `pnpm --dir ui exec vitest run packages/i18n
apps/console/src/pages/Doc apps/console/src/pages/docs
apps/console/src/pages/book-nav apps/console/src/pages/BookSidebar
apps/console/src/pages/doc-`: Test Files 110 passed, Tests 1557 passed /
13 skipped
- `pnpm turbo run type-check --filter=@object-ui/console
--filter=@object-ui/i18n`: 75/75 tasks successful
- eslint `--no-inline-config` on every changed file: 0 errors (2
pre-existing `no-explicit-any` warnings in `DocPage.tsx`, untouched
lines)
- `node scripts/pm/dispatch-gates.mjs --commands`: 35 derived, each run
with exit 0; `--ran` reconciliation: 35 derived, 35 run, 0 NOT-MEASURED,
0 UNRUN
- merge-tree against origin/main 48b3ae6: clean
</details>
## 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. (Changed files linted
locally; the repo-wide run is CI's.)
- [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. (The 维护者速读 block is
the dispatch contract's Chinese summary.)
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgTtGFiNwm2iGyWMAsv
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgTtGFiNwm2iGyWMAsv)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6c30357 commit 062236c
17 files changed
Lines changed: 193 additions & 19 deletions
File tree
- .changeset
- ui
- apps/console/src/pages
- packages/i18n/src/locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 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 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | | - | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| |||
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
162 | | - | |
| 168 | + | |
| 169 | + | |
163 | 170 | | |
164 | 171 | | |
165 | 172 | | |
166 | 173 | | |
167 | | - | |
168 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
28 | | - | |
| 37 | + | |
29 | 38 | | |
30 | 39 | | |
31 | 40 | | |
32 | | - | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
112 | 118 | | |
113 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
114 | 135 | | |
115 | 136 | | |
116 | 137 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
21 | 26 | | |
22 | 27 | | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
32 | 39 | | |
33 | 40 | | |
34 | 41 | | |
| 42 | + | |
| 43 | + | |
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
| |||
79 | 88 | | |
80 | 89 | | |
81 | 90 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | | - | |
93 | | - | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
103 | 114 | | |
104 | 115 | | |
105 | 116 | | |
| |||
140 | 151 | | |
141 | 152 | | |
142 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3355 | 3355 | | |
3356 | 3356 | | |
3357 | 3357 | | |
| 3358 | + | |
| 3359 | + | |
3358 | 3360 | | |
3359 | 3361 | | |
3360 | 3362 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3101 | 3101 | | |
3102 | 3102 | | |
3103 | 3103 | | |
| 3104 | + | |
| 3105 | + | |
3104 | 3106 | | |
3105 | 3107 | | |
3106 | 3108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3701 | 3701 | | |
3702 | 3702 | | |
3703 | 3703 | | |
| 3704 | + | |
| 3705 | + | |
3704 | 3706 | | |
3705 | 3707 | | |
3706 | 3708 | | |
| |||
0 commit comments