Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(crm): align restore and record metadata controls (#9614)
gbirman486b6999314f
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.mdindex 6d2e95100b..3cd430f15a 100644--- a/apps/web/AGENTS.md+++ b/apps/web/AGENTS.md@@ -436,7 +436,9 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription toKeep Files scoped to the contact when its optional email is absent; emit anemail-attachment participant literal only for a present address.Put Archive beside Copy link for visible CRM records; put the Archived chip and- separate borderless Restore action in the identity heading for archived records.+ separate compact secondary Restore button in the identity heading for archived records.+ Match record metadata to the 24px property-control scale while reserving separate+ 44px touch targets; see the CRM README for the visible-face and hit-area contract.Keep explanations on the chip and retain company-only Email sharing controls.Use the explicit Visible/Archived filter for People, Companies and company Team;reset its admin-only choice on account/team/role/list changes and preserve search.diff --git a/apps/web/src/features/crm/README.md b/apps/web/src/features/crm/README.mdindex 4c32962a73..297c84a5db 100644--- a/apps/web/src/features/crm/README.md+++ b/apps/web/src/features/crm/README.md@@ -63,8 +63,13 @@ its own collection state to the shared collection renderer. Shared collection coCRM-specific state again.Visible contact and company toolbars put the archive-system icon beside Copy link.-Archived identities group one Archived chip with a borderless Restore action; on-phones the group wraps beneath the name and Restore retains a 44px touch target.+Archived identities group one Archived chip with a flat secondary Restore button;+on phones the group wraps beneath the name. Keep identity actions and metadata at+the compact property scale: 24px visible height, 12px text and 12px icons.+Interactive controls reserve 10px above and below their touch faces for separate+44px targets; transparent extensions receive those taps without enlarging the paint.+Use flat controls here because the glass finish owns its own press pseudo-elements.+Top-toolbar controls retain their separate navigation scale.The chip owns hover/focus/tap explanation; Restore does not trigger that explanation.`RecordVisibilityAction` handles confirmation, pending, cancellation and retry.Only admins/owners can change visibility. Company archive cascades to all peoplediff --git a/apps/web/src/features/crm/browser-test/archive/archive.browser.e2e.ts b/apps/web/src/features/crm/browser-test/archive/archive.browser.e2e.tsindex c90a78a95a..4f77b8efc4 100644--- a/apps/web/src/features/crm/browser-test/archive/archive.browser.e2e.ts+++ b/apps/web/src/features/crm/browser-test/archive/archive.browser.e2e.ts@@ -113,7 +113,6 @@ test('chip explanation has its own keyboard and touch lifecycle with narrow layofor (const width of [390, 320]) {await page.setViewportSize({ width, height: 844 });await expect(restore).toBeInViewport({ ratio: 1 });- expect((await restore.boundingBox())!.height).toBeGreaterThanOrEqual(44);expect(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth@@ -142,6 +141,105 @@ test('chip explanation has its own keyboard and touch lifecycle with narrow layoawait expect(restore).toBeDisabled();});+test('compact record controls keep separate full-height touch targets', async ({+ page,+ isMobile,+}) => {+ for (const width of isMobile ? [390, 320, 820] : [1280]) {+ await page.setViewportSize({ width, height: 844 });+ for (const kind of ['contact', 'company']) {+ const companyName = width === 320 ? 'I' : 'Example company';+ await page.goto(+ `/?kind=${kind}&archived&companyName=${encodeURIComponent(companyName)}${kind === 'company' ? '&companyArchived' : ''}`+ );+ const chip = page.getByRole('button', { name: 'Archived — details' });+ const restore = page.getByRole('button', {+ name: 'Restore',+ exact: true,+ });+ await expect(restore).toBeVisible();+ const controls = [chip, restore];+ if (kind === 'contact')+ controls.push(+ page.getByRole('button', { name: companyName, exact: true })+ );++ for (const control of controls) {+ const bounds = (await control.boundingBox())!;+ expect(bounds.height).toBe(24);+ await expect(control).toHaveCSS('font-size', '12px');+ if (!isMobile) continue;+ expect(bounds.width).toBeGreaterThanOrEqual(44);+ // The visible face is compact; the reserved margin and transparent+ // extension must still deliver taps across a separate 44px target.+ for (const y of [bounds.y - 9.5, bounds.y + bounds.height + 9.5]) {+ expect(+ await control.evaluate(+ (element, point) =>+ document+ .elementFromPoint(point.x, point.y)+ ?.closest('button') === element,+ { x: bounds.x + bounds.width / 2, y }+ )+ ).toBe(true);+ }+ }+ const chipBounds = (await chip.boundingBox())!;+ const restoreBounds = (await restore.boundingBox())!;+ expect(chipBounds.y).toBe(restoreBounds.y);+ expect(chipBounds.x + chipBounds.width).toBeLessThan(restoreBounds.x);++ if (isMobile) {+ await page.touchscreen.tap(+ chipBounds.x + chipBounds.width / 2,+ chipBounds.y - 9+ );+ await expect(page.getByRole('dialog')).toContainText('Excluded from');+ expect(await page.evaluate(() => window.archiveFixture.writes())).toBe(+ 0+ );+ await page.keyboard.press('Escape');+ await expect(page.getByRole('dialog')).toHaveCount(0);+ await page.touchscreen.tap(+ restoreBounds.x + restoreBounds.width / 2,+ restoreBounds.y + restoreBounds.height + 9+ );+ } else {+ await restore.focus();+ await expect(restore).toBeFocused();+ await page.keyboard.press('Enter');+ }+ if (kind === 'company') {+ const dialog = page.getByRole('dialog');+ await expect(dialog).toContainText(+ 'including people archived individually'+ );+ await expect(dialog).not.toHaveAttribute('data-transitioning');+ await dialog+ .getByRole('button', { name: 'Cancel', exact: true })+ .click();+ await expect(dialog).toHaveCount(0);+ await expect(restore).toBeFocused();+ } else {+ await expect(+ page.getByRole('button', { name: 'Archive', exact: true })+ ).toBeVisible();+ const company = page.getByRole('button', {+ name: companyName,+ exact: true,+ });+ const bounds = (await company.boundingBox())!;+ if (isMobile)+ await page.touchscreen.tap(bounds.x + bounds.width / 2, bounds.y - 9);+ else await company.click();+ await expect(+ page.getByRole('textbox', { name: 'Company name' })+ ).toBeVisible();+ }+ }+ }+});+test('restoring a person whose company is archived routes to company confirmation', async ({page,}) => {diff --git a/apps/web/src/features/crm/browser-test/archive/preview-adapters.ts b/apps/web/src/features/crm/browser-test/archive/preview-adapters.tsindex 9ca19e5c5f..6a08cd6cd7 100644--- a/apps/web/src/features/crm/browser-test/archive/preview-adapters.ts+++ b/apps/web/src/features/crm/browser-test/archive/preview-adapters.ts@@ -36,7 +36,7 @@ let hold = false;const params = new URLSearchParams(location.search);let company: CrmCompanyResponse = {id: 'company-1',- name: 'Example company',+ name: params.get('companyName') ?? 'Example company',teamId: 'team-1',hidden: params.has('companyArchived'),emailSync: !params.has('companyArchived'),diff --git a/apps/web/src/features/crm/components/record-archived-status.tsx b/apps/web/src/features/crm/components/record-archived-status.tsxindex a4fccbc78f..48af62332c 100644--- a/apps/web/src/features/crm/components/record-archived-status.tsx+++ b/apps/web/src/features/crm/components/record-archived-status.tsx@@ -1,6 +1,6 @@import { isTouchDevice } from '@core/mobile/isTouchDevice';import { Popover } from '@kobalte/core/popover';-import { Badge, Button, badgeTriggerClasses, Tooltip } from '@ui';+import { Badge, badgeTriggerClasses, Tooltip } from '@ui';import { type JSX, Show } from 'solid-js';/** The explanation belongs to the chip; Restore is a separate focus target. */@@ -26,7 +26,7 @@ export function RecordArchivedStatus(props: {fallback={<Tooltip.Root><Tooltip.Trigger- class={badgeTriggerClasses({ variant: 'outline', size: 'sm' })}+ class={badgeTriggerClasses({ variant: 'outline', size: 'xs' })}aria-label="Archived — details">Archived@@ -41,15 +41,15 @@ export function RecordArchivedStatus(props: {><Popover placement="bottom-start" gutter={6} modal={false}><Popover.Trigger- as={Button}- variant="ghost"- size="sm"- class="touch:min-h-11"+ class={badgeTriggerClasses({+ variant: 'outline',+ size: 'xs',+ class:+ "touch:min-h-6 touch:min-w-11 touch:my-2.5 touch:before:absolute touch:before:-inset-x-px touch:before:top-1/2 touch:before:h-11 touch:before:-translate-y-1/2 touch:before:content-['']",+ })}aria-label="Archived — details">- <Badge variant="outline" size="sm">- Archived- </Badge>+ Archived</Popover.Trigger><Popover.Portal><Popover.Content class="menu-surface z-modal w-72 max-w-[calc(100vw-2rem)] p-3">diff --git a/apps/web/src/features/crm/components/record-visibility-action.tsx b/apps/web/src/features/crm/components/record-visibility-action.tsxindex c0144ef901..24a5f70a40 100644--- a/apps/web/src/features/crm/components/record-visibility-action.tsx+++ b/apps/web/src/features/crm/components/record-visibility-action.tsx@@ -91,17 +91,22 @@ function VisibilityControl(props: RecordVisibilityActionProps) {component={props.grouped ? ButtonGroup.Button : Button}ref={button}data-crm-visibility-record={props.recordId}- variant={props.hidden ? 'link' : 'ghost'}+ variant={props.hidden ? 'secondary' : 'ghost'}+ finish={props.hidden ? 'flat' : undefined}size={props.hidden- ? 'sm'+ ? 'xs': isTouchDevice()? 'icon-lg': props.grouped? 'icon-sm': 'icon-md'}- class={props.hidden ? 'touch:min-h-11' : undefined}+ class={+ props.hidden+ ? "focus-visible:ring-2 focus-visible:ring-accent/20 touch:min-h-6 touch:min-w-11 touch:my-2.5 touch:before:absolute touch:before:-inset-x-px touch:before:top-1/2 touch:before:h-11 touch:before:-translate-y-1/2 touch:before:content-['']"+ : undefined+ }aria-label={label()}aria-describedby={!props.canManage ? permissionHintId : undefined}tooltip={@@ -118,7 +123,7 @@ function VisibilityControl(props: RecordVisibilityActionProps) {when={props.hidden}fallback={<ArchiveIcon class="size-4 touch:size-6" />}>- <UndoIcon class="size-4" />+ <UndoIcon class="size-3" /></Show><Show when={props.hidden}>{label()}</Show></Dynamic>diff --git a/apps/web/src/features/crm/views/company-header.tsx b/apps/web/src/features/crm/views/company-header.tsxindex 1154a932a9..1934f4ec80 100644--- a/apps/web/src/features/crm/views/company-header.tsx+++ b/apps/web/src/features/crm/views/company-header.tsx@@ -105,7 +105,7 @@ export function CompanyHeader(props: { company?: CrmCompanyEntity }) {><For each={company().domains}>{(domain) => (- <Badge variant="outline" size="sm">+ <Badge variant="ghost" size="sm"><GlobeIcon class="size-3" />{domain.domain}</Badge>@@ -116,7 +116,7 @@ export function CompanyHeader(props: { company?: CrmCompanyEntity }) {<Show when={company().updatedAt}>{(lastInteraction) => (<Tooltip label={formatDateAndTime(lastInteraction())}>- <Badge variant="outline" size="sm">+ <Badge variant="ghost" size="sm"><ClockIcon class="size-3" />Last interacted {formatRelativeTimestamp(lastInteraction())}</Badge>diff --git a/apps/web/src/features/crm/views/contact-header.tsx b/apps/web/src/features/crm/views/contact-header.tsxindex b623887023..8d0e88c060 100644--- a/apps/web/src/features/crm/views/contact-header.tsx+++ b/apps/web/src/features/crm/views/contact-header.tsx@@ -1,11 +1,12 @@import { ListSkeleton } from '@app/components/view-shell/ListSkeleton';+import { propertyPillClasses } from '@app/features/property/extractors/property-pill-classes';import { EntityIcon } from '@core/component/EntityIcon';import { InlineTitleEditor } from '@core/component/InlineTitleEditor';import { formatDateAndTime, formatRelativeTimestamp } from '@entity';import ContactIcon from '@icon/system/regular/address-book.svg';import ClockIcon from '@icon/system/regular/clock.svg';import EnvelopeIcon from '@icon/system/regular/envelope.svg';-import { Avatar, Badge, badgeTriggerClasses, Tooltip } from '@ui';+import { Avatar, Badge, Tooltip } from '@ui';import { Show } from 'solid-js';import { useCrmContext } from '../context/crm-context';import type { CrmContact as CrmContactResponse } from '../core/contact';@@ -53,9 +54,12 @@ function CompanyPill(props: {<buttontype="button"onClick={openCompany}- class={badgeTriggerClasses({ variant: 'outline', size: 'sm' })}+ class={propertyPillClasses({+ class:+ "touch:min-h-6 touch:min-w-11 touch:my-2.5 touch:before:absolute touch:before:-inset-x-px touch:before:top-1/2 touch:before:h-11 touch:before:-translate-y-1/2 touch:before:content-['']",+ })}>- <EntityIcon targetType="crm_company" size="xs" />+ <EntityIcon targetType="crm_company" size="fill" class="size-3" />{company()?.name ?? 'Open company'}</button>);@@ -122,7 +126,7 @@ export function ContactHeader(props: {><Show when={contact().email}>{(email) => (- <Badge variant="outline" size="sm">+ <Badge variant="ghost" size="sm"><EnvelopeIcon class="size-3" />{email()}</Badge>@@ -137,7 +141,7 @@ export function ContactHeader(props: {)}</Show><Tooltip label={formatDateAndTime(contact().lastInteraction)}>- <Badge variant="outline" size="sm">+ <Badge variant="ghost" size="sm"><ClockIcon class="size-3" />Last interacted{' '}{formatRelativeTimestamp(contact().lastInteraction)}diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.mdindex 06360d84d1..948459194f 100644--- a/docs/agent-guide/crm.md+++ b/docs/agent-guide/crm.md@@ -221,11 +221,13 @@ history; Cancel changes nothing. While saving, duplicate actions and dismissal ablocked. A rejected save retains the prior state and an actionable retry. Only teamadmins/owners can archive or restore; other members see a disabled action.-An archived record has a single **Archived** chip and a quiet borderless **Restore**-action beside its name on desktop, grouped beneath it on phones. Its toolbar keeps+An archived record has a single **Archived** chip and a compact secondary **Restore**+button beside its name on desktop, grouped beneath it on phones. Its toolbar keepsCopy link and Details. Hover or focus the chip for the explanation; tap on phones.Escape dismisses it. Restore is a separate focus target. Verify 320px and 390px phone-widths, a usable Restore touch target and focus after confirmation or cancellation.+widths, aligned 24px visible controls and metadata, and separate 44px touch targets.+Tap above and below the painted Archived, Restore and company controls to verify+their expanded targets, then check focus after confirmation or cancellation.Company archive archives all its people and turns off team email sync. Restoring thecompany requires an explicit confirmation: every person is restored, including those