Repository navigation
Commit bb89b2d
feat(app-shell): the record's favorite star beside its name, out of the header's overflow (#36456)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbVF7sWPNE4HmjkgyaVxQYif)_
repo:objectstack#7 · zhuangjianguo · session_01QsR2jRaJbQ4vqdv4J5peqA
Fixes #36246
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
记录整页、右侧预览和手机记录页上,记录名右边多了一颗星:空心是没收藏,点一下变实心、记录进左侧栏「收藏」,再点一下取消;「更多」菜单里不再有「添加到收藏」。
- 记录页专题对标 Attio:按维护者「以 attio 为准」,把收藏入口从「更多」挪到记录名旁边。
- 出错时用户在记录页看不到或点不动星标,已有收藏数据和左侧栏「收藏」一组不受影响;改动可直接撤回。
- 宽度说明:1440、1280、1024 宽时记录名长度不变;只有记录名本来就被截断(如 800 宽)时,星标让它再少约 32
像素。星标按裁定始终显示在记录名旁,这一点按实测说明接受(见 Acceptance notes 第一条)。
## What changes
- **The star beside the record's name.** `RecordDetailView` now hands
its record context the favorite state and toggle it already computed
(`isRecordFavorite`, `handleToggleRecordFavorite`), so `page:header`'s
`RecordTitleChip` draws its star in every face it draws: the full page's
bar, a drawer or split-pane preview (`embedded`), and a phone's header.
Hollow until the record is a favorite, filled yellow once it is, one
press to toggle, no confirm. Same `record:OBJECT:ID` favorite as before,
so the sidebar's 收藏 group and the stored favorites are unchanged.
- **No second entry in the ⋯.** The `sys_favorite` system action is
pushed only on a print page (a page that declares `print`): that page
draws no `page:header`, so no name and no star, and its chrome row's ⋯
keeps the entry. Everywhere else the ⋯ holds no favorites entry. The
print check is one helper, `pageDeclaresPrintOf`, read for the ⋯ entry
from the assigned page (only an assigned page can declare `print`) and
for the print chrome from the rendered page, as before.
- **Phone tap target.** `RecordTitleChip`'s star takes the same 44px
phone target as the copy-id button beside it (`min-h-[44px]
min-w-[44px]`, reset at `sm:`). Before this PR the record pages never
drew this star, so the 24px target was never user-visible.
- **The retired `showStar` refusal stays true.** `@objectstack/spec`'s
`retiredKey` text for `page:header` `showStar` said the console draws no
star beside the record title and that the favorites entry is the ⋯ menu;
after this PR both are false. It now reads: the console draws the
record's star from the host's favorites toggle, never from metadata, so
the key switched nothing; delete the key, the page draws the same star
without it. The two jsdoc sentences beside it say the same,
`content/docs/references/ui/component.mdx` is regenerated (`pnpm
--filter @objectstack/spec gen:docs`), and the changeset carries an
`@objectstack/spec` patch entry. Wording only: the key stays refused by
the same tombstone, `Clause-②: no`, `Metadata-protocol: none`. The 18
upgrade texts say the same: the D3 semantic entry
`page-header-show-star-retired` (its `replacement`, `reason` and
`acceptanceCriteria`, which `os migrate meta` prints as the `verify:`
line: the record's star beside the record name, and no favorites entry
in the ⋯ except on a print page), the D2 conversion
`page-header-show-star-removed`'s `summary` (projected into the
published `spec-changes.json`) and the step-18 rationale in
`registry.ts.template`. The retired-keys entry comment and the CHANGELOG
stay as written.
- No new i18n key (the chip's existing `detail.addToFavorites` /
`detail.removeFromFavorites`), no exported prop, no spec contract
change.
Read first (by risk):
1. `ui/packages/app-shell/src/views/RecordDetailView.tsx`: the
`sys_favorite` push now guarded by `pageDeclaresPrintOf(assignedPage)`,
and the two new props on `RecordContextProvider`.
2. `ui/packages/components/src/custom/RecordTitleChip.tsx`: the star's
className (phone target).
3.
`ui/packages/app-shell/src/views/RecordDetailView.favoritesEntry-12427.test.tsx`:
the rewritten first `describe` (three faces, reload).
Two-minute check: open any record in the Console, press the star right
of the name. Expected: it fills yellow and the record appears at the top
of the sidebar's 收藏 group; the header's ⋯ lists no 添加到收藏.
## Screenshots (HotCRM on this branch's Console, zh-CN, 1440 wide, DPR
2)
Before this PR (from the card, main `6c7c6db250`): the header has no
star, 添加到收藏 is inside ⋯.

Full page, 客户 (Acme Corporation): hollow, the ⋯ without 添加到收藏, then
filled with the record in 收藏.



Right-side preview (the list's 在侧边打开, Stark Medical): hollow, the ⋯,
then filled with the record in 收藏.



HotCRM 线索 (four labelled header buttons) at 1440 and at 800:


Phone (390 wide): hollow, filled, and the bottom bar's ⋯.



## Tests
- `RecordDetailView.favoritesEntry-12427.test.tsx`, first `describe`
rewritten deliberately (it pinned objectui#12427's opposite placement,
which the maintainer's ruling reverses): the star sits in the H1's row,
hollow (`aria-pressed=false`, no fill), and the ⋯ holds no favorites
entry (CONTROL: Share is there); one press stores the `record:` favorite
(id, type, href) and fills it, a second press removes it; a stored
favorite (a reload) opens filled; an `embedded` mount draws the same
star with the same state and toggles it; a phone mount (390 wide, bottom
bar drawn as CONTROL) draws it beside the name and its ⋯ has no
favorites entry.
- `RecordDetailView.headerMenuIcons-12529.test.tsx`: the ⋯ rows lose
`Add to favorites`.
- `page-header-star-host-toggle-12427.test.tsx`: new case, the star
keeps the 44px phone target (CONTROL: the copy-id button carries the
same classes).
- `RecordDetailView.printPageHeaderActions-12906.test.tsx` unchanged and
green: the print page keeps its ⋯ entry.
- `packages/spec/src/ui/page-header-show-star-retirement.test.ts`
(`PRESCRIPTION`) and
`packages/lint/src/validate-component-props.test.ts` pin the reworded
refusal.
<details><summary>Runs (final head b6db6ed unless named)</summary>
- Targeted six files (both RecordDetailView pins, the print pin, the
three chip/header pins), at 00a15ab: `Test Files 6 passed (6)`,
`Tests 35 passed (35)`, lock VERDICT command-exit 0.
- Broader sweep at 00a15ab: every
`packages/app-shell/src/views/RecordDetailView*` file,
`packages/components/src/__tests__/page-header*`, `record-title-chip*`,
`ConsoleToaster.drawerActionsRow-26418`, `PageHeader.actionsFold-12705`:
`Test Files 134 passed (134)`, `Tests 1151 passed (1151)`, lock VERDICT
command-exit 0. The one commit after it adds a module-top import to the
star pin (check:test-source-alias); at b6db6ed the star pin and the
favorites file re-run: `Test Files 2 passed (2)`, `Tests 19 passed
(19)`, exit 0.
- `pnpm --filter @object-ui/app-shell run type-check` (both tsc
programs, test tsconfig included): exit 0.
</details>
<details><summary>Ablations (mutation landed on disk via
scripts/ablation-replace.mjs, restored to HEAD with an empty git diff
HEAD; no build step: the suites import the source)</summary>
- Delete the `onToggleFavorite` prop on the record context (anchor 1 to
0): the favorites file goes 5 failed / 4 passed, every star case red (no
star drawn); Share cases stay green.
- Revert the guard to `if (favoriteRecord)` (the ⋯ entry back
everywhere): 5 red across two files (the three ⋯ assertions in the
favorites file, both ⋯ row lists in the 12529 file); the print pin stays
green, as it should.
</details>
## Acceptance notes
- **HotCRM 线索 width, against the card's "the record name is not shorter
than today" line: measured, and read as met where the name fits.**
Measured on the seeded lead "Pia Anand - Citrine Finance" with its four
labelled buttons. At 1440, 1280 and 1024 the name is not truncated and
its width is the same with and without the star (204px both); the star
is drawn and visible. At 800 the name is already truncated today, and
the star takes 32px from it (181px without the star, 149px with it,
measured in the same build by hiding the star). The same holds for any
name long enough to truncate at a wider width: the star is a fixed 24px
plus an 8px gap in a row where the title is the only flexible item.
Keeping the name exactly as long as today in that case would mean
folding one more labelled header button into the ⋯ when the title
truncates, a header-fold rule change outside this card (the preview
header's slots are the next card in this area). Reading taken (seat 7):
accepted as is, no follow-up card. The ruling puts the star beside the
name and always visible, and the 32px only comes off a name that is
already cut.
- **The custom app 客户 was not built.** The walk ran on HotCRM's own 客户
object instead (same record page, same header faces).
- **What main's ⋯ held in the preview and the phone page (the card's
unchecked point):** not measured live on main. In the code, one
system-action list feeds the ⋯ of every face, so on main all three held
添加到收藏; on this branch the full page, the preview and the phone ⋯ were
opened and none holds it (screenshots above).
- **Print pages** keep 添加到收藏 in the chrome row's ⋯: they draw no record
header, so there is nowhere to put the star. One entry there, as
everywhere else.
- **Reload:** the full page reload keeps the filled star and the 收藏
entry; the phone run then found the account still a favorite from the
desktop session, i.e. the favorite is the user's, not the tab's.
- The view favourites entry in the view switcher, the sidebar 收藏 order
and cap, and list rows are untouched.
## Verification
<details><summary>Local gates (derived with `node
scripts/pm/dispatch-gates.mjs --commands`, 38 families)</summary>
- 37 derived families run at 00a15ab, exit 0 each; `pnpm
check:test-source-alias` went red on the edited star pin (a dynamic
`@object-ui/react-runtime` load reached inside a clocked case), fixed by
the module-top import in b6db6ed and re-run green.
- `pnpm --dir ui exec vitest run scripts/` under the lock at b6db6ed:
exit 0, `Test Files 172 passed | 2 skipped (174)`, `Tests 5127 passed |
2 skipped (5129)`.
- `--ran` reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN.
- `pnpm check:changeset-fixed` (roster under `.changeset`) exit 0; `pnpm
--dir ui run check:new-line-citations`: 0 new citations.
- Rework at 646a72b (origin/main merged in 3195b43): spec
`page-header-show-star-retirement.test.ts` `Tests 19 passed (19)`; lint
`validate-component-props.test.ts` `Tests 121 passed (121)`; `pnpm
--filter @objectstack/spec check:docs` and `check:generated` (14
artifacts up to date, `check:docs content/docs/references/**` green);
changeset checks (no-major, empty-changeset, adr-0087-registration,
changeset-fixed, changeset-gate-self-tests) exit 0; check:doc-authoring,
check:issue-citations, check:spec-docblock-symbol-anchors,
check:docs-spec-enumerations, check:cross-package-test-inputs,
check:nul-bytes exit 0.
- Rework at 735d878 (the D3 entry, D2 summary and rationale
reworded): `pnpm --filter @objectstack/spec build` (regenerates the
migration registry) lock VERDICT command-exit 0; spec `src/migrations`,
`src/conversions`, `page-header-show-star-retirement.test.ts`,
`retired-key-removal-version.pin.test.ts`, `component.test.ts`: `Test
Files 31 passed (31)`, `Tests 1445 passed (1445)`; `check:generated`,
`check:docs`, `check:spec-changes`, `check:upgrade-guide` exit 0 (a
generated `spec-changes.json` carries the new wording 6 times and the
old 0); changeset checks (no-major, empty-changeset,
adr-0087-registration, changeset-fixed, changeset-gate-self-tests),
check:issue-citations, closing-keyword-parity, check:nul-bytes exit 0.
NOT MEASURED locally: `packages/cli`
`test/migrate-meta-engine-guidance.test.ts` (integration tier, spawns
the CLI; this tree has no CLI closure build), declared to CI; the new
strings carry no tracker id, which is what it pins.
- Every other family is CI's: read the PR's check runs.
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jRaJbQ4vqdv4J5peqA -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 60e79ed commit bb89b2d
13 files changed
Lines changed: 246 additions & 104 deletions
File tree
- .changeset
- content/docs/references/ui
- packages
- lint/src
- spec/src
- conversions/entries/18
- migrations
- entries/semantic
- ui
- ui/packages
- app-shell/src/views
- components/src
- __tests__
- custom
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1577 | 1577 | | |
1578 | 1578 | | |
1579 | 1579 | | |
1580 | | - | |
| 1580 | + | |
1581 | 1581 | | |
1582 | 1582 | | |
1583 | 1583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
| 122 | + | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 53 | + | |
| 54 | + | |
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2665 | 2665 | | |
2666 | 2666 | | |
2667 | 2667 | | |
2668 | | - | |
2669 | | - | |
2670 | | - | |
2671 | | - | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
2672 | 2672 | | |
2673 | 2673 | | |
2674 | 2674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
779 | 779 | | |
780 | 780 | | |
781 | 781 | | |
782 | | - | |
783 | | - | |
| 782 | + | |
| 783 | + | |
784 | 784 | | |
785 | 785 | | |
786 | 786 | | |
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
809 | 810 | | |
810 | 811 | | |
811 | 812 | | |
| |||
817 | 818 | | |
818 | 819 | | |
819 | 820 | | |
820 | | - | |
821 | | - | |
822 | | - | |
| 821 | + | |
| 822 | + | |
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
61 | | - | |
| 63 | + | |
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| |||
0 commit comments