Repository navigation
Commit 00dd362
feat(console): one Studio detail header composite (×, package, ‹ › with position, ⋯, primary) (#36924)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBTuMGhLAZx29zwDrayDGZZF)_
repo:objectstack#3 · os-support-ai · session_01WGufziBCAytAzzCu3iPBFR
Fixes #36892
Part of #36890
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:这次只做出 Studio 全屏详情共用的头部零件,还没有放进任何页面。
- 属于「Studio 重构」大卡,替后面四张接入卡(对象、流程、通用详情等全屏详情页)先定下头部和「上一个/下一个」的接口。
- 出错也碰不到用户,因为没有页面用它;可以直接撤回。
- 无。
## What changes
- New `StudioDetailHeader`
(`ui/packages/app-shell/src/views/studio-detail/StudioDetailHeader.tsx`):
a thin composite over `StudioItemHeader`'s slots. × (back to the list)
in `leading`; the type and the source package as identity chips after
the label and api name; the status as the header's status chip; in
`actions`, ‹ › with "index / total", the page's primary button (a slot),
and ⋯ (the page's own menu items, with the folded chips above them via
`StudioItemHeaderFoldedItems`). No switcher dropdown, no "open in app"
(epic decision 7).
- The ‹ › data interface is a plain prop: `sequence={{ names, current
}}` plus `onOpenItem(name)`. `detailSequence(names, current)` (exported,
pure) computes the 1-based index, total, previous and next; the ends do
not wrap; a name the list does not hold has no position and both steps
are off. The order itself comes later from the list card (decision 10:
filter and sort in the detail address, by name without list context).
- × , Esc and ‹ › all go through the existing leave-guard seam
`confirmUnsavedLeave` in `chrome/unsavedEdits.ts`; browser Back is not
intercepted (decision 12). Esc is ignored when a menu or dialog already
handled it (Radix marks it `defaultPrevented`), when it is aimed at a
text field, or with a modifier; `closeOnEscape={false}` turns it off.
- Narrow widths reuse `StudioItemHeader`'s rules unchanged: the identity
chips (api name, type, package) fold into ⋯ first; the position text
carries `data-studio-fold-label` / `STUDIO_FOLD_LABEL` so it leaves the
row at the second stage while ‹ › stay; the title is cut last. The
composite does no measuring of its own.
- Strings: `engine.studio.detailHeader.*` (close, previous, next,
position, notInList, package, more) in the `studio` namespace, en + zh.
- Not wired into any page (later cards do that). `StudioItemHeader.tsx`,
`StudioDesignSurface.tsx` and `unsavedEdits.ts` are read, not edited.
Placement: a new sibling folder `views/studio-detail/` rather than
`studio-design/`, so this PR adds nothing under the `studio-design/**`
surface another open card holds.
## Tests
- `StudioDetailHeader.test.tsx` (24 tests): index math (middle, first,
last, lone, outside the list, empty list); first/last disabled; ‹ › open
the neighbours; the leave guard on × and › (Cancel keeps the page, OK
leaves, nothing unsaved means no prompt); Esc triggers × (through the
guard), not from a text field, not while ⋯ is open (that Esc closes the
menu, the next one closes the page), not with `closeOnEscape` off or a
modifier; ×, ‹, › are native buttons in tab order; the narrow-row fold
at stubbed widths (wide 900 px nothing folds; 560 px chips fold into ⋯;
380 px the position label folds too; it follows resizes both ways;
without menu items the header draws its own ⋯ only while folded).
- Test page `ui/e2e/studio-detail-header-width.spec.ts`: the real
component and real Tailwind in Chromium at a 1024 px row (everything
whole, nothing folded, every box inside the row) and a 360 px row (chips
folded into ⋯, position text out, both fold stages taken, ×, ‹, ›, ⋯
inside the row, no overflow), plus keyboard: Tab from ‹ reaches ›, Enter
steps, Esc triggers ×.
<details><summary>Readings (head 7a4b4a3)</summary>
- `vitest run packages/app-shell/src/views/studio-detail/
packages/i18n/src/namespaces/studio/ packages/i18n/src/__tests__/`: Test
Files 110 passed (110), Tests 2038 passed, 13 skipped (lock VERDICT
command-exit 0).
- Playwright (local scratch config, chromium only, no webServer): 3
passed. Readings: 1024 px
`{"title":{"width":205.88,"clipped":false},"inRow":{"type":true,"package":true,"apiName":true},"positionShown":true,"fold":null,"childrenInsideRow":true,"controlsInsideRow":true,"documentOverflowX":0}`;
360 px
`{"title":{"width":43.92,"clipped":true},"inRow":{"type":false,"package":false,"apiName":false},"positionShown":false,"fold":"labels","childrenInsideRow":true,"controlsInsideRow":true,"documentOverflowX":0}`.
- `pnpm --filter @object-ui/app-shell run type-check`: exit 0 (both
programs, the test one included). `pnpm --dir ui type-check:e2e`: exit
0.
- `ui` i18n: `check:i18n-keys` exit 0, `check:i18n-drift` exit 0,
`check:i18n-dead-keys` exit 0 (no `detailHeader` key reported).
- eslint (`--no-inline-config`) on the new files: 0 errors, 1 warning
(`react-refresh/only-export-components` for the exported pure
`detailSequence`, the same shape `StudioItemHeader.tsx` already has).
- Derived gate families (`dispatch-gates.mjs --commands`, 38): all exit
0 on the final tree except `pnpm --dir ui exec vitest run scripts/`,
which failed once on `e2e-type-check.test.ts` "imports no workspace
package" (the test page imported `@object-ui/components`); fixed in
7a4b4a3 by importing it by source path, and that file re-run green
(15/15). `--ran` reconciliation: 38 of 38 accounted.
</details>
## Acceptance notes
- The test page is a Playwright spec (the repo has no Storybook); it
measures geometry, so it follows
`e2e/studio-item-header-title-width.spec.ts`'s bundling.
- Esc is not advertised in the keyboard-shortcuts dialog: the composite
is mounted nowhere yet, and advertising belongs beside the handler once
a page mounts it (the wiring cards).
- The changeset declares `Clause-②: no` as the claim says; a sibling
i18n-only changeset declared `yes (widening)` for added keys, so the
seat may want to confirm which reading applies to new keys in the
`studio` namespace.
- At a 360 px row the title is cut (about 44 px in this container's
fallback font) after both fold stages: that is `StudioItemHeader`'s
existing last step, not new behaviour.
## Verification
Files to read first: `StudioDetailHeader.tsx` (the Esc listener and the
⋯ / `foldMenu` choice are the risk hunks), then
`StudioDetailHeader.test.tsx`'s narrow-width block.
Two-minute check: `pnpm --filter @object-ui/app-shell exec vitest run
--root ../.. packages/app-shell/src/views/studio-detail/` and expect 24
passed.
Session: https://claude.ai/code/session_01WGufziBCAytAzzCu3iPBFR
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufziBCAytAzzCu3iPBFR -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4f19091 commit 00dd362
6 files changed
Lines changed: 1068 additions & 0 deletions
File tree
- .changeset
- ui
- e2e
- packages
- app-shell/src/views/studio-detail
- i18n/src/namespaces/studio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 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 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 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 | + | |
| 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 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 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 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
0 commit comments