Repository navigation
Commit 94fb8db
fix(plugin-chatbot): the AI approvals inbox stacks each action as a card on phones, and its drawer fits the screen (#35515)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg6v19uPsX6gX42G8tGcvvzb)_
Fixes #35449
repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户看到的变化:手机上打开「AI 审批」页,每条待审批操作是一张卡片,「通过 / 拒绝 /
查看」三个按钮都在屏幕内;详情抽屉占满整屏,两个决定按钮都看得到。电脑上的表格不变。
- 为什么:确认邮件把用户带到这一页做决定,很多人用手机打开;原来按钮在屏幕外要横向拖动才找得到,抽屉里的「拒绝」被截掉,审批会过期。
- 如果判断错:只影响这一页在手机上的排版,接口、数据和文案都不动;最坏情况是手机上排版不理想,电脑上不受影响。
- 需要您做的:无,席位落地。
## What changes
`AiPendingActionsInbox` (the AI approvals inbox; cloud renders it
unchanged, so the fix needs no props from the host):
- **Below `md`, one stacked card per action.** The table's fixed columns
add up to far more than a phone (measured on the card: Approve / Reject
/ View at x 906 to 1013 in a 306 px scroller at 390 px). The rows now
have two faces, the console's own pattern for this (the approvals inbox
page draws its rows the same way): the desktop table wrapped in `hidden
md:block`, unchanged, and a `md:hidden` card list. Each card leads with
the action name, then the object, the tool name (secondary, monospace)
and the relative time, then Approve / Reject / View as 44 px buttons in
a wrapping row inside the card. Viewport breakpoints rather than a JS
hook, so a phone never paints the table first.
- **The detail drawer takes the full width below `sm`.** `w-full` merges
over the Sheet primitive's `w-3/4` (293 px at 390, where Reject ran to x
415); from `sm` up the existing 560 px cap holds. Its decision buttons
wrap instead of overflowing.
- **A long action or tool name wraps in the drawer's title and
subtitle.** Found by the geometry pin: an action name is one snake_case
word, and a long one pushed the full-width drawer sideways.
`[overflow-wrap:anywhere]` on both.
- The toolbar row (tabs + Refresh) wraps, so a long locale's labels
cannot push it past the edge.
No new label, prop, export or locale key. Shared primitives untouched.
## Tests
- New Playwright geometry pin
`ui/e2e/ai-approvals-inbox-phone-35449.spec.ts` (10 cases, Chromium): at
360 and 390 px, in English and in German (the longer labels), no
horizontal page overflow, the table face not drawn, every card and its
action name inside the viewport, Approve / Reject / View inside the
viewport and inside their card at 44 px or more, nothing in a card cut
sideways; the drawer as wide as the screen, both its buttons inside it,
nothing in it cut sideways. A 1280 px control: the table face drawn, the
cards not, no sideways scroll in the table, the drawer at 560 px. A
not-vacuous leg measures the pre-fix arms at 390 px (the table shown at
phone width; the drawer without `w-full` and the wrapping row) and
requires them to fail the same checks. Class strings are read out of the
component and the primitives at run time and compiled with the installed
Tailwind, the pattern of `approvals-inbox-phone.spec.ts`.
- New top-level describe in
`AiPendingActionsInbox.noProviderFallback.test.tsx` (4 cases): which
face each breakpoint draws, the card naming the action before the tool,
card Approve posting to the approve route and card Reject opening the
reason dialog, and the drawer's classes (`w-full`, not `w-3/4`, wrapping
button row).
- Existing pins scoped, not changed: happy-dom applies no stylesheet, so
both faces are in the DOM there; the lookups in
`AiPendingActionsInbox.i18n.test.tsx` and the no-provider suite that
count or single-match row text now read the table face
(`within(getByRole('table'))`), which is what they were written against.
## Acceptance notes
- The row contract (`PendingActionRow`) carries no human-readable
summary or label, only `action_name`, `object_name` and `tool_name`; the
card leads with `action_name`, as the drawer title already does. A human
summary would be a contract addition, not part of this card.
- Between `md` (768 px) and the table's natural width the desktop table
still scrolls sideways, as before; the breakpoint follows the approvals
inbox page.
- The faces switch on the viewport, not the container: hosted in a
narrow panel on a desktop, the inbox draws its table as before.
- On a desktop a name longer than its column still widens the table, as
before; the 1280 px control uses the ordinary rows.
- The drawer's decision buttons keep their 36 px `sm` size; the card
buttons, the phone's primary decision path, are 44 px.
## Verification
All readings below at head `b9b41e084b` unless named.
<details><summary>E2E: 10/10 in Chromium; five ablations each red the
leg they should</summary>
Run locally with a throwaway config (no `webServer`, Chromium from
`/opt/pw-browsers`), deleted afterwards; CI runs the spec under
`playwright.config.ts`.
```
10 passed (1.9s)
```
Ablations at `66a1e1acb7` (same component and spec bytes as the head),
each through `scripts/ablation-replace.mjs` (anchor hit 1 -> 0, blob
changed, restored to the HEAD blob `8201c029f4d5`, `git diff HEAD`
empty):
| Mutation | Result |
|---|---|
| card button row loses `flex-wrap` | 4 failed (the four card cases), 6
passed |
| drawer loses `w-full` | 4 failed (the four drawer cases), 6 passed |
| drawer title loses `[overflow-wrap:anywhere]` | 4 failed (the four
drawer cases), 6 passed |
| table wrapper loses `hidden md:block` | 4 failed (the four card
cases), 6 passed |
| drawer button row loses `flex-wrap` | 2 failed (de 360, de 390
drawer), 8 passed |
</details>
<details><summary>Vitest: 111 files, 1189 tests passed</summary>
`vitest run` over `packages/plugin-chatbot/` (the whole package), the
census and readers that walk or render the component:
`affordanceGrantMap-12082`, `ariaLabelLiteralCensus-12145`,
`de-quote-pairing-3876`, `column-identity.ratchet`,
`product-neutral-renderer.ratchet`,
`AiPendingActionsPage.pageHeader-12553`, `consolePagesLocale-13460`,
`ConversationsSidebar`:
```
Test Files 111 passed (111)
Tests 1189 passed (1189)
```
Before the existing pins were scoped to the table face, 9 of them failed
on duplicate matches (both faces in the DOM), which is what the scoping
answers.
</details>
<details><summary>Types, lint, gates</summary>
- `pnpm --filter @object-ui/plugin-chatbot run type-check`: exit 0
(`tsconfig.test.json` lists both edited test files).
- `pnpm --dir ui run type-check:e2e`: exit 0 (its program lists the new
spec).
- eslint on the four ui files: exit 0, no output.
- `node scripts/pm/dispatch-gates.mjs --commands`: 38 derived families,
all 38 run, each exit 0 (including `pnpm --dir ui exec vitest run
scripts/`); `--ran` reconciliation: 38 run, 0 NOT-MEASURED, 0 UNRUN, a
derived zero.
- `node scripts/pm/overlap-check.mjs`: clean before every push.
</details>
Authored by session_01Utp6CbSphdunq2aJq7ktuY (seat repo:objectstack#5,
account os-bill).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbSphdunq2aJq7ktuY -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2211bb1 commit 94fb8db
5 files changed
Lines changed: 585 additions & 33 deletions
File tree
- .changeset
- ui
- e2e
- packages/plugin-chatbot/src
- __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 | + | |
0 commit comments