You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e5213e7
Browse filesBrowse the repository at this point in the historyBrowse files
feat(console): the ⌘K palette's Current page group offers Add view and Edit (#36711)
<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ88koXu8fkc7uTmy43dVUPer)_Fixes#36286
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户在列表页按 ⌘K,「当前页面」组里多了「新建视图」,回车直接打开视图切换器的新建卡片;在记录页按 ⌘K
多了「编辑」,回车等同点页面右上角的编辑按钮。
- 属于外壳专题(去掉顶栏那一层)里搜索面板这张卡的最后一项,做完这张卡就关闭。
- 面板里的这两行完全跟着页面上的按钮走:按钮不出现它就不出现,按钮变灰它也变灰并写明原因;出问题只影响这两行,撤回本 PR 即恢复原样。
- 无。
## What changes
The empty ⌘K palette's "Current page" group (its favorites row landed
earlier) now carries the page's own main entry:
- **On an object's list: "Add view".** Listed exactly where the view
switcher offers "Add view". Enter opens the switcher on its in-place
create card; for a host whose switcher offers only the Create View
dialog, it opens that dialog. Opened the switcher's own way afterwards,
the dropdown shows the views again.
- **On a record page: "Edit".** The header's own `sys_edit` entry: Enter
runs its `onClick` (the record form, or the page's edit state where the
page draws body tables). It is listed off exactly when the header's
button is off (`userActions.edit.disabledWhen`, the state lock, a live
inline draft the header greys Edit for), with the header's reason under
it. An approval-locked record, a record already in its edit state and a
record in a drawer or pane over a list list no Edit row, because the
page draws no Edit there (or the page behind the palette is the list).
- The footer names what Enter does ("Add view ↵", "Edit ↵"), in the
controls' own words. No new locale keys: both rows reuse the controls'
labels (`view.switcher.addView`, `detail.edit`).
How: nothing is recomputed in the palette. The page publishes the
command beside the control that runs it, for as long as it draws that
control (`usePublishPageCommand`, new `chrome/paletteCommands.ts`, a
module store like `advertisedShortcuts`), and the palette lists what is
published. `ObjectViewTitleSwitcher` publishes "Add view" under the same
condition its footer button is drawn (`create || onAddView`);
`RecordDetailView` publishes the header's `sys_edit` entry through
`PublishRecordEditCommand` (new `views/recordPaletteEdit.tsx`), mounted
inside the page's `InlineEditProvider` so the inline-draft greying is
read where the header reads it. `ObjectViewSwitcherMenu` gains an
optional `startOnCreate` prop (package-internal, not exported). This is
the route the card's release comment recorded (seat 2: pages advertise
their own command and verdict; the palette lists them).
## Tests
- Palette harness (`CommandPalette.previewCreate-36286.test.tsx`), new
top-level describe, 10 tests, over the real `CommandPaletteProvider`
with the real `ObjectViewTitleSwitcher` and the real
`PublishRecordEditCommand` in an `InlineEditProvider`: row order and
selection, Enter opens the switcher on the create card; dialog-only host
runs `onAddView`; CONTROL no row when the switcher offers no Add view;
Edit runs the entry's handler; an off Edit is listed off with its reason
and does nothing; a live inline draft turns it off; CONTROL a draft
leaves it on where the header does; withdrawn when the page stops
drawing it, and never listed on the wrong kind of page; footer kinds.
- `RecordDetailView.harness.test.tsx`, new block
`RecordDetailView.paletteEdit-36286` (4 tests) over the real record
page: the page publishes Edit and running it calls the same `onEdit` the
header button calls; off exactly when the header button is off
(`edit.disabledWhen` holds); CONTROL a predicate that does not hold
leaves both on; CONTROL an embedded record publishes nothing.
<details><summary>Runs at d8c8135</summary>
- `vitest run` of `packages/app-shell/src/chrome/` + the
RecordDetailView harness + `objectViewTitleSwitcher` (2 files),
`inPlaceViewCreate-35553`, `ObjectView.titleViewSwitcher-27594`,
`RecordDetailView.phoneFace-27058`, `.favoritesEntry-12427`,
`.headerActionGates`, `.drawerLevelEdit-33111` under the verify lock:
Test Files 38 passed (38), Tests 398 passed (398), VERDICT command-exit
0 (at 27f5347; the last commit touched only the palette harness's
imports, re-run there: 37 passed).
- `pnpm --filter @object-ui/app-shell type-check` (tsc --noEmit +
tsconfig.test.json): VERDICT command-exit 0.
- Ablation 1, `scripts/ablation-replace.mjs` on `recordPaletteEdit.tsx`,
the `disabled:` verdict replaced with `disabled: false`: 3 failed (the
disabledWhen, off-with-reason and inline-draft tests), restored blob
282bf9e equals HEAD.
- Ablation 2, `setStartOnCreate(true)` deleted from
`objectViewTitleSwitcher.tsx`: 2 failed (the two create-card tests),
restored blob c9b9cf6 equals HEAD. Source-resolved relative imports, no
dist leg.
</details>
## Acceptance notes
- The card's acceptance lines for step 2 read
"列表页上是收藏这个视图、新建视图;记录页上是收藏这条记录、编辑". The favorites rows landed earlier;
this PR adds the other two, so it closes the card.
- Row words are the controls' own ("Add view", "Edit"), as the favorites
rows reuse the menu's words; Attio's "New view" wording would need two
new keys, not added.
- An authored record page that draws no `page:header` still publishes
Edit, as the header entry is built for every face; I found no such page
in the examples.
- The phone's palette is out of the card's scope and unchanged; the
switcher's phone sheet takes the same `startOnCreate`, adjusted during
render so a kept-mounted body is asked again.
## Verification
Two-minute check: run the showcase, open Accounts, press ⌘K, ArrowDown
to "Add view", Enter: the view switcher opens on its create card. Open
any account, ⌘K, ArrowDown to "Edit", Enter: the page enters its edit
state (Cancel / Save in the header), as the header's Edit does.
Browser run (showcase on its own `--fresh` backend + console vite,
Playwright Chromium 1440x900, signed in through `/login`): list page
group rows `favorite-add`, `view-add`; footer "Add view ↵"; after Enter
the palette is closed, the switcher menu and `create-view-card` are
present. Record page group rows `favorite-add`, `record-edit`; footer
"Edit ↵"; after Enter the header shows Cancel and Save. Four screenshots
are attached to the project thread (GitHub's image store takes browser
uploads only), not committed.
Gates at d8c8135: `dispatch-gates --commands` derived 38 families; all
38 run, each exit 0 (`pnpm --dir ui exec vitest run scripts/` was
OOM-killed on the first pass beside the dev servers and re-run under the
lock: Test Files 172 passed, 2 skipped; `check:test-source-alias` went
red on the first pass and is fixed in d8c8135); `--ran` reconciliation
38 derived, 38 run, 0 NOT-MEASURED. ESLint on the changed source files:
0 errors. `check:new-line-citations`: 0 new. overlap-check: VERDICT
clean (origin/main and #36629, which shares `RecordDetailView.tsx`,
merge cleanly).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [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: 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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbXBGc8PQRp6Q7TM7EU)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
feat(console): the ⌘K palette's "Current page" group offers the list's "Add view" and the record's "Edit"
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
Opened with nothing typed, the command palette's "Current page" group now carries the page's own main entry beside its favorites row:
11
+
12
+
-**On an object's list**: "Add view", listed exactly where the view switcher offers "Add view". Enter opens the switcher on its in-place create card, or, for a host that offers only the Create View dialog, opens that dialog.
13
+
-**On a record page**: "Edit", the header's own Edit. It runs what the header button runs (the record form, or the page's edit state), and it is off exactly when the button is off: a `userActions.edit.disabledWhen` that holds, the state lock, or a live inline draft the header greys Edit for, with the header's reason under it. A record an approval locks, a record already in its edit state and a record shown in a drawer or pane over a list offer no Edit row.
14
+
15
+
The footer names what Enter does ("Add view ↵", "Edit ↵"), in the controls' own words. Nothing is recomputed in the palette: the list and the record page publish the command beside the control while they draw it. No locale keys, props or package exports change.
0 commit comments