From 26a4c5a361fde4b8c61a13ca5004485c530747fb Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 10:09:40 +0000 Subject: [PATCH 1/8] feat(app-shell): the record's favorite star beside its name, out of the header's overflow Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA --- .../app-shell/src/views/RecordDetailView.tsx | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index 619d21967c7..f8dabbb3be2 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -275,6 +275,15 @@ function recordPagePlacesNoComponent(page: Parameters - {/* No `isFavorite` / `onToggleFavorite` here (objectui#12427): the - record's favorites entry is the `sys_favorite` item in the header's - `⋯` overflow, and the `page:header` chrome draws its star only for - a host that wires `onToggleFavorite`, so this page draws none. */} {/* objectui#2407 P2 — ONE record-level inline-edit session spanning the highlights strip AND the details body (both descend from this provider), committed together by the single From 97c6f12f01e0dff16b49e7f482ab1b7d3a4276a6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 10:10:49 +0000 Subject: [PATCH 2/8] test(app-shell): pin the record header star in the page, drawer and phone faces Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA --- ...rdDetailView.favoritesEntry-12427.test.tsx | 184 ++++++++++++++---- ...dDetailView.headerMenuIcons-12529.test.tsx | 14 +- 2 files changed, 149 insertions(+), 49 deletions(-) diff --git a/ui/packages/app-shell/src/views/RecordDetailView.favoritesEntry-12427.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.favoritesEntry-12427.test.tsx index 8f34de4e2ef..bd24859d86e 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.favoritesEntry-12427.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.favoritesEntry-12427.test.tsx @@ -7,20 +7,20 @@ */ /** - * objectui#12427: the record page's favorites entry is in the header's `⋯` - * overflow, ahead of Share. + * objectstack#36246: the record's favorites control is the star beside its + * name, as Attio draws it (maintainer: 「以 attio 为准」). It is always drawn, + * hollow until the record is a favorite and filled once it is, and one press + * toggles it with no confirm. The header's `⋯` holds no favorites entry, so + * the page keeps one control. Every face `page:header` draws carries it: the + * full page's bar, a drawer or pane (`embedded`), and a phone's header. * - * A record is never a navigation entry, so the entry toggles the `record:` - * favorite, which the sidebar draws in its Favorites section at the top. It - * reads "Add to favorites", then "Remove from favorites" once the record is - * one. + * A record is never a navigation entry, so the star toggles the `record:` + * favorite, which the sidebar draws in its Favorites section at the top; the + * stored entry is the one the `⋯` entry of objectui#12427 wrote. * - * It is the page's ONE favorites control: the record header draws no star. - * This page no longer hands the record context an `onToggleFavorite`, and the - * `page:header` chrome draws its star only for a host that does (the - * components pin `page-header-star-host-toggle-12427`). Updated deliberately - * by the record-star remainder of objectui#12427: the header star that sat - * beside this entry is gone, in both favorite states. + * Updated deliberately by objectstack#36246: this file pinned the opposite + * (the `⋯` entry as the one control, no header star), objectui#12427's + * placement, which the maintainer's ruling reverses. * * Harness: the `RecordDetailView.deleteConfirmDialog-11001` mount (the real * record page under a real `I18nProvider` and a metadata context), plus the @@ -101,7 +101,7 @@ const METADATA = { const STORE_KEY = 'objectui-favorites'; const stored = (): FavoriteItem[] => JSON.parse(localStorage.getItem(STORE_KEY) ?? '[]'); -async function mountRecordPage() { +async function mountRecordPage(opts: { embedded?: boolean } = {}) { const dataSource = { find: vi.fn(async () => ({ data: [] })), findOne: vi.fn(async () => ({ id: RECORD_ID, name: 'Intro call' })), @@ -117,7 +117,20 @@ async function mountRecordPage() { {}} />} + element={ + opts.embedded ? ( + {}} + objectNameOverride={OBJECT_NAME} + recordIdOverride={RECORD_ID} + embedded + /> + ) : ( + {}} /> + ) + } /> @@ -137,9 +150,14 @@ function headerStars(): HTMLElement[] { ]; } +/** Whether a star draws filled: the chip fills its icon once the record is a favorite. */ +function isFilled(star: HTMLElement): boolean { + return star.querySelector('svg')?.getAttribute('class')?.split(/\s+/).includes('fill-yellow-400') ?? false; +} + /** Opens the header's overflow and returns its entries' text. */ async function openOverflow(): Promise { - const trigger = screen.getByRole('button', { name: 'More actions' }); + const [trigger] = screen.getAllByRole('button', { name: 'More actions' }); fireEvent.pointerDown(trigger, { button: 0, ctrlKey: false, pointerType: 'mouse' }); await waitFor(() => expect(screen.getByRole('menu')).toBeInTheDocument()); return screen.getAllByRole('menuitem').map((el) => (el.textContent ?? '').trim()); @@ -164,36 +182,30 @@ afterEach(() => { vi.clearAllMocks(); }); -describe('record page: the favorites entry is in the overflow, ahead of Share (objectui#12427)', () => { - it('the overflow leads with Add to favorites, then Share — after the Refresh that heads it', async () => { - await mountRecordPage(); - const items = await openOverflow(); - // objectstack#27055: the host's Refresh is the ⋯'s first item. - expect(items.indexOf('Refresh')).toBe(0); - expect(items.indexOf('Add to favorites')).toBe(1); - expect(items.indexOf('Share')).toBe(2); - }); - - it('the record header draws no star, so the overflow entry is the one favorites control', async () => { +describe('record page: the favorite star beside the record name, none in the ⋯ (objectstack#36246)', () => { + it('the star sits in the name\'s row, hollow, and the ⋯ holds no favorites entry', async () => { await mountRecordPage(); - // The record chip is drawn (its copy-id button sits in the star's row), - // so "no star" cannot pass on a header that drew no chip at all. - await waitFor(() => expect(screen.getByRole('button', { name: 'Copy record ID' })).toBeInTheDocument()); - expect(headerStars()).toHaveLength(0); + const star = await waitFor(() => { + const [only, ...rest] = headerStars(); + expect(rest).toHaveLength(0); + expect(only).toBeTruthy(); + return only; + }); + expect([star.getAttribute('aria-label'), star.getAttribute('aria-pressed')]).toEqual(['Add to favorites', 'false']); + expect(isFilled(star)).toBe(false); + // Beside the record's name: the chip row that holds the H1. + const title = screen.getByRole('heading', { level: 1, name: 'Intro call' }); + expect(title.parentElement!.contains(star)).toBe(true); const items = await openOverflow(); - expect(items.filter((text) => /favorites$/.test(text))).toEqual(['Add to favorites']); - - // Still none once the record is a favorite. - fireEvent.click(screen.getByRole('menuitem', { name: 'Add to favorites' })); - await waitFor(() => expect(stored()).toHaveLength(1)); - expect(headerStars()).toHaveLength(0); + // CONTROL: the ⋯ is open and holds the system group. + expect(items).toContain('Share'); + expect(items.filter((text) => /favorites$/.test(text))).toEqual([]); }); - it('choosing it writes the record favorite, and the entry then reads Remove from favorites', async () => { + it('one press makes the record a favorite and fills the star; a second press removes it', async () => { await mountRecordPage(); - await openOverflow(); - fireEvent.click(screen.getByRole('menuitem', { name: 'Add to favorites' })); + fireEvent.click(await screen.findByRole('button', { name: 'Add to favorites' })); await waitFor(() => expect(stored()).toHaveLength(1)); const [favorite] = stored(); @@ -202,12 +214,98 @@ describe('record page: the favorites entry is in the overflow, ahead of Share (o 'record', RECORD_PATH, ]); + const filled = await screen.findByRole('button', { name: 'Remove from favorites' }); + expect(filled.getAttribute('aria-pressed')).toBe('true'); + expect(isFilled(filled)).toBe(true); + expect(headerStars()).toHaveLength(1); + + fireEvent.click(filled); + await waitFor(() => expect(stored()).toHaveLength(0)); + const hollow = await screen.findByRole('button', { name: 'Add to favorites' }); + expect(hollow.getAttribute('aria-pressed')).toBe('false'); + expect(isFilled(hollow)).toBe(false); + }); - // The header re-derives its system actions on the next render, so the - // overflow's first action entry (after Refresh) now offers the way back. - await waitFor(() => - expect((screen.getAllByRole('menuitem')[1].textContent ?? '').trim()).toBe('Remove from favorites'), + it('a record already a favorite (a reload) opens with the star filled', async () => { + localStorage.setItem( + STORE_KEY, + JSON.stringify([ + { + id: `record:${OBJECT_NAME}:${RECORD_ID}`, + label: 'Intro call', + href: RECORD_PATH, + type: 'record', + favoritedAt: new Date(0).toISOString(), + }, + ]), ); + await mountRecordPage(); + const star = await screen.findByRole('button', { name: 'Remove from favorites' }); + expect(star.getAttribute('aria-pressed')).toBe('true'); + expect(isFilled(star)).toBe(true); + }); + + it('a drawer or pane (embedded) draws the same star, with the same state', async () => { + localStorage.setItem( + STORE_KEY, + JSON.stringify([ + { + id: `record:${OBJECT_NAME}:${RECORD_ID}`, + label: 'Intro call', + href: RECORD_PATH, + type: 'record', + favoritedAt: new Date(0).toISOString(), + }, + ]), + ); + await mountRecordPage({ embedded: true }); + const star = await waitFor(() => { + const [only, ...rest] = headerStars(); + expect(rest).toHaveLength(0); + expect(only).toBeTruthy(); + return only; + }); + expect([star.getAttribute('aria-label'), star.getAttribute('aria-pressed')]).toEqual(['Remove from favorites', 'true']); + const title = screen.getByRole('heading', { level: 1, name: 'Intro call' }); + expect(title.parentElement!.contains(star)).toBe(true); + + fireEvent.click(star); + await waitFor(() => expect(stored()).toHaveLength(0)); + expect((await screen.findByRole('button', { name: 'Add to favorites' })).getAttribute('aria-pressed')).toBe('false'); + const items = await openOverflow(); + expect(items).toContain('Share'); + expect(items.filter((text) => /favorites$/.test(text))).toEqual([]); + }); + + it('a phone draws the star beside the name, and its bottom bar\'s ⋯ holds no favorites entry', async () => { + Object.defineProperty(window, 'innerWidth', { value: 390, configurable: true, writable: true }); + const measure = HTMLElement.prototype.getBoundingClientRect; + vi.spyOn(HTMLElement.prototype, 'getBoundingClientRect').mockImplementation(function (this: HTMLElement) { + if (!this.hasAttribute('data-record-page-root')) return measure.call(this); + return { x: 0, y: 0, top: 0, left: 0, right: 390, bottom: 800, width: 390, height: 800, toJSON: () => ({}) } as DOMRect; + }); + try { + await mountRecordPage(); + // CONTROL: the phone face is drawn — its bottom bar holds the actions. + await waitFor(() => expect(document.querySelector('[data-record-action-bar] [role="toolbar"]')).toBeTruthy()); + const star = await waitFor(() => { + const [only, ...rest] = headerStars(); + expect(rest).toHaveLength(0); + expect(only).toBeTruthy(); + return only; + }); + const title = screen.getByRole('heading', { level: 1, name: 'Intro call' }); + expect(title.parentElement!.contains(star)).toBe(true); + fireEvent.click(star); + await waitFor(() => expect(stored()).toHaveLength(1)); + + const items = await openOverflow(); + expect(items).toContain('Share'); + expect(items.filter((text) => /favorites$/.test(text))).toEqual([]); + } finally { + vi.restoreAllMocks(); + Object.defineProperty(window, 'innerWidth', { value: 1024, configurable: true, writable: true }); + } }); }); diff --git a/ui/packages/app-shell/src/views/RecordDetailView.headerMenuIcons-12529.test.tsx b/ui/packages/app-shell/src/views/RecordDetailView.headerMenuIcons-12529.test.tsx index 7017d38c5f4..b76e583c90f 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.headerMenuIcons-12529.test.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.headerMenuIcons-12529.test.tsx @@ -7,8 +7,9 @@ */ /** - * objectui#12529: the record header's system entries (Edit, favorites, Share, - * Delete) declare icons through the same `icon` key the app's actions use, so + * objectui#12529: the record header's system entries (Edit, Share, Delete; + * favorites is the star beside the name since objectstack#36246) declare + * icons through the same `icon` key the app's actions use, so * the `⋯` menu draws one kind of row; Delete is last, behind a separator. * * objectui#12617 replaced this file's third rule: Edit no longer folds into @@ -183,13 +184,14 @@ afterEach(() => { }); describe('record header: iconed system entries, Delete set apart in the ⋯, Edit a labelled button in the row (objectui#12529, objectui#12617)', () => { - it('each system entry carries its icon: Edit in the row, the other three in the ⋯', async () => { + it('each system entry carries its icon: Edit in the row, Share and Delete in the ⋯', async () => { await mountRecordPage(FULL_ROW); const edit = screen.getByRole('button', { name: 'Edit' }); await waitFor(() => expect(edit.querySelector('svg.lucide-pencil')).not.toBeNull()); const menu = await openOverflow(); + // The favorites control is the star beside the record's name + // (objectstack#36246), not a ⋯ entry. const expected: Record = { - 'Add to favorites': 'lucide-star', Share: 'lucide-share', Delete: 'lucide-trash', }; @@ -206,7 +208,7 @@ describe('record header: iconed system entries, Delete set apart in the ⋯, Edi // The host's Refresh leads the ⋯, set apart (objectstack#27055); the three // app actions fit the bar's three inline slots (objectstack#35853), so the // system group follows. - expect(menuRows(menu)).toEqual(['Refresh', '---', 'Add to favorites', 'Share', '---', 'Delete']); + expect(menuRows(menu)).toEqual(['Refresh', '---', 'Share', '---', 'Delete']); }); it('with three app actions in the header, the first leads, Edit stays a labelled button after it, opens the edit session, and nothing is icon-only', async () => { @@ -238,6 +240,6 @@ describe('record header: iconed system entries, Delete set apart in the ⋯, Edi // The ⋯ then holds only the menu-pinned system entries. const menu = await openOverflow(); // The host's Refresh leads the ⋯, set apart (objectstack#27055). - expect(menuRows(menu)).toEqual(['Refresh', '---', 'Add to favorites', 'Share', '---', 'Delete']); + expect(menuRows(menu)).toEqual(['Refresh', '---', 'Share', '---', 'Delete']); }); }); From 96d8f45c718a861698be4ef5dcad5a63c8437c00 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 10:37:05 +0000 Subject: [PATCH 3/8] chore(changeset): record header favorite star Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA --- .changeset/36246-record-header-star.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/36246-record-header-star.md diff --git a/.changeset/36246-record-header-star.md b/.changeset/36246-record-header-star.md new file mode 100644 index 00000000000..339811baa24 --- /dev/null +++ b/.changeset/36246-record-header-star.md @@ -0,0 +1,10 @@ +--- +'@object-ui/app-shell': patch +--- + +feat(app-shell): the record's favorite star sits beside its name, and the header's `⋯` no longer holds "Add to favorites" + +Clause-②: no +Metadata-protocol: none + +The record page draws its favorite star right of the record's name, always visible: hollow until the record is a favorite, filled once it is, one press to toggle with no confirm. The full page, a drawer or split-pane preview, and a phone's record page all draw it, from the same favorite the sidebar's Favorites section reads, so nothing about the stored favorites or that section changes. The header's `⋯` menu drops its "Add to favorites" / "Remove from favorites" entry, so the page keeps one favorites control. A print page, which draws no record header and so no star, keeps the entry in its chrome row's `⋯`. From 95243c7ea9711b8ae2ebfeecc27de766da49ffa9 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 11:16:09 +0000 Subject: [PATCH 4/8] fix(components): the record header star keeps a phone tap target Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QsR2jRaJbQ4vqdv4J5peqA --- .changeset/36246-record-header-star.md | 3 ++- .../page-header-star-host-toggle-12427.test.tsx | 11 +++++++++++ ui/packages/components/src/custom/RecordTitleChip.tsx | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.changeset/36246-record-header-star.md b/.changeset/36246-record-header-star.md index 339811baa24..e413ba4fefa 100644 --- a/.changeset/36246-record-header-star.md +++ b/.changeset/36246-record-header-star.md @@ -1,5 +1,6 @@ --- '@object-ui/app-shell': patch +'@object-ui/components': patch --- feat(app-shell): the record's favorite star sits beside its name, and the header's `⋯` no longer holds "Add to favorites" @@ -7,4 +8,4 @@ feat(app-shell): the record's favorite star sits beside its name, and the header Clause-②: no Metadata-protocol: none -The record page draws its favorite star right of the record's name, always visible: hollow until the record is a favorite, filled once it is, one press to toggle with no confirm. The full page, a drawer or split-pane preview, and a phone's record page all draw it, from the same favorite the sidebar's Favorites section reads, so nothing about the stored favorites or that section changes. The header's `⋯` menu drops its "Add to favorites" / "Remove from favorites" entry, so the page keeps one favorites control. A print page, which draws no record header and so no star, keeps the entry in its chrome row's `⋯`. +The record page draws its favorite star right of the record's name, always visible: hollow until the record is a favorite, filled once it is, one press to toggle with no confirm. The full page, a drawer or split-pane preview, and a phone's record page all draw it, from the same favorite the sidebar's Favorites section reads, so nothing about the stored favorites or that section changes. The header's `⋯` menu drops its "Add to favorites" / "Remove from favorites" entry, so the page keeps one favorites control. On a phone the star keeps a 44px tap target, as the copy-id button beside it does. A print page, which draws no record header and so no star, keeps the entry in its chrome row's `⋯`. diff --git a/ui/packages/components/src/__tests__/page-header-star-host-toggle-12427.test.tsx b/ui/packages/components/src/__tests__/page-header-star-host-toggle-12427.test.tsx index c4066b12539..5dae9e53c58 100644 --- a/ui/packages/components/src/__tests__/page-header-star-host-toggle-12427.test.tsx +++ b/ui/packages/components/src/__tests__/page-header-star-host-toggle-12427.test.tsx @@ -106,6 +106,17 @@ describe('page:header record chrome: the favorite star draws only where the host expect(onToggleFavorite).toHaveBeenCalledTimes(1); }); + it('the star keeps a 44px tap target on a phone, as the copy-id button beside it does (objectstack#36246)', () => { + const { header } = renderHeader({ isFavorite: false, onToggleFavorite: () => {} }); + const [star] = stars(header); + const copyId = header.querySelector('button[aria-label="Copy record ID"]')!; + for (const cls of ['min-h-[44px]', 'min-w-[44px]', 'sm:min-h-0', 'sm:min-w-0']) { + // CONTROL: the copy-id button carries the same phone target. + expect(copyId.classList.contains(cls), `copy-id ${cls}`).toBe(true); + expect(star.classList.contains(cls), `star ${cls}`).toBe(true); + } + }); + it('CONTROL: the star mirrors the host state', () => { const { header } = renderHeader({ isFavorite: true, onToggleFavorite: () => {} }); const [star] = stars(header); diff --git a/ui/packages/components/src/custom/RecordTitleChip.tsx b/ui/packages/components/src/custom/RecordTitleChip.tsx index 8991b693ae8..4b9970135bf 100644 --- a/ui/packages/components/src/custom/RecordTitleChip.tsx +++ b/ui/packages/components/src/custom/RecordTitleChip.tsx @@ -182,7 +182,8 @@ export const RecordTitleChip: React.FC = ({