Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(crm): fit record navigation into mobile headers (#9135)

dev-rb28306e166c3c
diff --git a/.agents/rules/web/design-system.md b/.agents/rules/web/design-system.md
index 3fdd7214f1..798f855e2a 100644
--- a/.agents/rules/web/design-system.md
+++ b/.agents/rules/web/design-system.md
@@ -19,7 +19,7 @@ construction. Browse them at `/app/component/ui` (Foundations → Controls).
| Tabs that own panels or a dynamic collection (tables, form pages, rename, add) | `TabSelector` (`Root`, `List`, `Tab`, `Panel`, `AddMenu`) | `@kobalte/core/tabs` in a feature |
| Related header actions (filters, view options, sharing, navigation) | `HeaderActionGroup` | A hand-built bordered row |
| One on/off toggle, or an icon-only layout choice | `Button` with `aria-pressed` | A custom active tint |
-| Many options, or header tabs that no longer fit | `Dropdown` / `Select`, or `Tabs iconOnly` first | Scrolling or wrapping a header tab row |
+| Many options, or header tabs that no longer fit | `Dropdown` / `Select`, `MobileDrawer` on touch, or `Tabs iconOnly` first | Scrolling or wrapping a header tab row |
| Create, search in a collection header | `ViewCreateButton`, `ListHeaderSearch` | One-off New or search buttons |
| Text entry, search fields | `Input`, `InputGroup`, `SearchBar`, `settings-input` | A raw `<input>` with its own border, radius, or focus color |
| Menu, popover, floating toolbar or editor panel | `Dropdown`, `Toolbar`, or `menu-surface` on the overlay root | A hand-built fill, border, and shadow, or `bg-menu-glass` |
@@ -68,9 +68,9 @@ construction. Browse them at `/app/component/ui` (Foundations → Controls).
buttons as tabs. The agent composer's Auto/Chat/Code switch remains
`Tabs variant="track"`, a flat pill sliding along the composer's tray. Keep all
tab treatments flat: use borders and selected fills, not raised edges, gradients, or shadows.
-- **FE-65** Components own their touch treatment. Never branch on
- `isTouchDevice()` to choose a tab component or variant; set `Tabs`' `touch`
- to the style that surface already uses on touch.
+- **FE-65** Let `Tabs` own its touch styling: set its `touch` prop instead of
+ swapping tab components or variants. For overflowing touch header sections,
+ use a shared `MobileDrawer` selector instead of a scrolling tab strip.
- **FE-66** Single-line inputs are pills at the control heights, like Buttons:
build them from `Input`, `InputGroup`, or `SearchBar` (`settings-input` in
settings rows). Filter chips use the same frame (pill, `edge-button` border,
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 26060e7523..17b5fdbd3e 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -284,7 +284,7 @@ resolved session ID; keep the existing `AgentSessionProvider` subscription to
- Share URL recognition with `packages/lexical-core/utils/auto-link.ts`; preserve explicit unlink markers when saving and rendering messages. See `packages/lexical-core/README.md` at the repository root.
- Empty human DMs use the shared centered conversations graphic and explain email delivery to nonusers; keep this state out of agent DMs, loading/error states, and populated timelines.
-- Keep CRM database discovery row-linked and permission-scoped; use horizontally centered actionable list states raised toward the toolbar and shared skeletons, with separate search-empty and retry states. See `src/features/crm/README.md` and `docs/agent-guide/crm.md` at the repo root.
+- Keep CRM database discovery row-linked and permission-scoped; use horizontally centered actionable list states raised toward the toolbar and shared skeletons, with separate search-empty and retry states. Company/contact touch headers use a Switch view drawer that honors host collapse and square copy-link islands; keep phone breadcrumbs above the switcher and leave the workspace view strip unchanged. Record search fills the row beside filters with header spacing; section creation replaces the default floating dock action through FloatRegion. See `src/features/crm/README.md` and `docs/agent-guide/crm.md` at the repo root.
- Main Tasks mounts reusable GraphQL saved views; keep embedded Project/CRM task lists unchanged. Read `src/features/tasks-view/AGENTS.md` for filter, draft, navigation, and browser checks.
- Enable persisted email/calendar review controls only for the review’s saved acting account; historical reviews fall back to the session owner. Require session edit access on desktop and mobile.
- Email draft reads compare server generations before choosing cached delivery state over a restored working copy; only a definitive first-submission rejection permits local send recovery without server cancellation.
diff --git a/apps/web/src/components/app/mobile/MobileCreateButton.tsx b/apps/web/src/components/app/mobile/MobileCreateButton.tsx
new file mode 100644
index 0000000000..bf0afcac57
--- /dev/null
+++ b/apps/web/src/components/app/mobile/MobileCreateButton.tsx
@@ -0,0 +1,25 @@
+import CreateIcon from '@icon/system/regular/plus.svg';
+import { MobileDockIsland } from './MobileDockIsland';
+
+/** Shared labeled creation pill above the mobile navigation dock. */
+export function MobileCreateButton(props: {
+ label: string;
+ ariaLabel?: string;
+ disabled?: boolean;
+ onClick: () => void;
+}) {
+ return (
+ <MobileDockIsland class="shrink-0">
+ <button
+ type="button"
+ aria-label={props.ariaLabel ?? props.label}
+ disabled={props.disabled}
+ onClick={props.onClick}
+ class="relative flex h-(--mobile-chrome-button-size) shrink-0 items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-base font-medium whitespace-nowrap disabled:opacity-50"
+ >
+ <CreateIcon class="size-5.5 shrink-0" />
+ <span>{props.label}</span>
+ </button>
+ </MobileDockIsland>
+ );
+}
diff --git a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
index 16160f22f8..53e7d178c0 100644
--- a/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
+++ b/apps/web/src/components/app/mobile/MobilePageCreateButton.tsx
@@ -14,13 +14,12 @@ import EmailIcon from '@icon/system/regular/envelope-simple.svg';
import DocumentIcon from '@icon/system/regular/file-text.svg';
import TaskIcon from '@icon/system/regular/list-checks.svg';
import PhoneIcon from '@icon/system/regular/phone.svg';
-import CreateIcon from '@icon/system/regular/plus.svg';
import { Show } from 'solid-js';
+import { MobileCreateButton } from './MobileCreateButton';
import {
MobileCreateMenu,
type MobileCreateMenuItem,
} from './MobileCreateMenu';
-import { MobileDockIsland } from './MobileDockIsland';
import type { MobileNavViewId } from './mobile-nav-views';
import { mobilePageCreateBlock } from './mobile-page-create-action';
import { useForegroundMobileView } from './use-mobile-nav';
@@ -117,17 +116,11 @@ export function MobilePageCreateButton() {
<Show
when={foregroundView() === 'calendar' && calendarEnabled()}
fallback={
- <MobileDockIsland class="shrink-0">
- <button
- type="button"
- aria-label={actionAriaLabel()}
- onClick={() => action().onSelect()}
- class="relative flex h-(--mobile-chrome-button-size) shrink-0 items-center justify-center gap-1.5 rounded-full pl-3 pr-4 text-base font-medium whitespace-nowrap"
- >
- <CreateIcon class="size-5.5 shrink-0" />
- <span>{action().label}</span>
- </button>
- </MobileDockIsland>
+ <MobileCreateButton
+ ariaLabel={actionAriaLabel()}
+ label={action().label}
+ onClick={() => action().onSelect()}
+ />
}
>
<MobileCreateMenu items={calendarActions()} />
diff --git a/apps/web/src/features/block-company/component/CompanyBlockAdapter.tsx b/apps/web/src/features/block-company/component/CompanyBlockAdapter.tsx
index ed2f125de6..fb8bb4d465 100644
--- a/apps/web/src/features/block-company/component/CompanyBlockAdapter.tsx
+++ b/apps/web/src/features/block-company/component/CompanyBlockAdapter.tsx
@@ -37,13 +37,13 @@ export function CompanyBlockAdapter() {
<CollapsibleHeaderItem
id="company-tabs"
priority={1}
- containerClass="ph-no-capture min-w-0 h-full mx-2"
+ containerClass="ph-no-capture min-w-0 h-full mx-2 touch:mx-0"
>
{(isCollapsed) => (
<div
class={
isCollapsed()
- ? 'min-w-0 overflow-x-auto scrollbar-hidden'
+ ? 'min-w-0 not-touch:overflow-x-auto not-touch:scrollbar-hidden'
: 'shrink-0'
}
>
@@ -57,7 +57,7 @@ export function CompanyBlockAdapter() {
</CollapsibleHeaderItem>
</SplitHeaderLeft>
<SplitHeaderRight>
- <HeaderIsland>
+ <HeaderIsland class="p-0">
<CrmCopyLinkButton type="company" id={companyId} />
</HeaderIsland>
</SplitHeaderRight>
diff --git a/apps/web/src/features/block-contact/component/ContactBlockAdapter.tsx b/apps/web/src/features/block-contact/component/ContactBlockAdapter.tsx
index 38026de91d..6636775024 100644
--- a/apps/web/src/features/block-contact/component/ContactBlockAdapter.tsx
+++ b/apps/web/src/features/block-contact/component/ContactBlockAdapter.tsx
@@ -37,13 +37,13 @@ export function ContactBlockAdapter() {
<CollapsibleHeaderItem
id="contact-tabs"
priority={1}
- containerClass="ph-no-capture min-w-0 h-full mx-2"
+ containerClass="ph-no-capture min-w-0 h-full mx-2 touch:mx-0"
>
{(isCollapsed) => (
<div
class={
isCollapsed()
- ? 'min-w-0 overflow-x-auto scrollbar-hidden'
+ ? 'min-w-0 not-touch:overflow-x-auto not-touch:scrollbar-hidden'
: 'shrink-0'
}
>
@@ -57,7 +57,7 @@ export function ContactBlockAdapter() {
</CollapsibleHeaderItem>
</SplitHeaderLeft>
<SplitHeaderRight>
- <HeaderIsland>
+ <HeaderIsland class="p-0">
<CrmCopyLinkButton type="contact" id={contactId} />
</HeaderIsland>
</SplitHeaderRight>
diff --git a/apps/web/src/features/crm/README.md b/apps/web/src/features/crm/README.md
index 8aa261c39e..b229acfcca 100644
--- a/apps/web/src/features/crm/README.md
+++ b/apps/web/src/features/crm/README.md
@@ -91,6 +91,19 @@ shared list skeletons. Keep search and available header actions visible in every
state. A failed continuation retains rows and retries that page.
Workspace activity uses the shared single-row desktop header with New and an
expandable Search control; record-detail tabs retain their section toolbar.
+Company and contact headers keep desktop section tabs; touch uses a labeled
+header island that opens the shared bottom drawer with the current section
+checked under **Switch view**. A collapsed host keeps the section icon and
+accessible label; embedded phone headers put the switcher below the breadcrumb
+and action row. Keep the
+workspace's mobile view strip separate. Copy-link islands
+are square on touch, with a 24px glyph and the standard 40px icon control.
+On touch, record list search has space below the header and fills the row beside
+any filter button. Email filters use the shared filter drawer. Each section's
+creation action replaces the default floating action above the navigation dock
+through `FloatRegion`; keyboard focus, higher-priority composers, and inactive
+panes suppress it. Preserve record context, disabled states, and feature gates.
+Desktop creation controls remain in the toolbar.
Activity rows render stored Companies and Contacts reference properties as inline
pills through the shared Soup row. Pills use the shared property preview and open
diff --git a/apps/web/src/features/crm/browser-test/mobile-insets.browser.e2e.ts b/apps/web/src/features/crm/browser-test/mobile-insets.browser.e2e.ts
index 8bef60a4ef..2920e68fbe 100644
--- a/apps/web/src/features/crm/browser-test/mobile-insets.browser.e2e.ts
+++ b/apps/web/src/features/crm/browser-test/mobile-insets.browser.e2e.ts
@@ -43,8 +43,8 @@ for (const device of [
});
await expect(search).toBeVisible();
const searchBox = await search.boundingBox();
- expect(searchBox!.y).toBeGreaterThanOrEqual(100);
- expect(searchBox!.y).toBeLessThan(112);
+ expect(searchBox!.y).toBeGreaterThanOrEqual(108);
+ expect(searchBox!.y).toBeLessThan(120);
await search.fill('proposal');
await expect(page.getByText('Searching: proposal')).toBeVisible();
await page
diff --git a/apps/web/src/features/crm/components/record-section.tsx b/apps/web/src/features/crm/components/record-section.tsx
index 3984ee2d0c..6cb706dcaa 100644
--- a/apps/web/src/features/crm/components/record-section.tsx
+++ b/apps/web/src/features/crm/components/record-section.tsx
@@ -1,6 +1,21 @@
import { SearchBar } from '@app/components/view-shell';
-import type { JSX, ParentProps } from 'solid-js';
-import { Show } from 'solid-js';
+import { MobileFilterDrawer } from '@app/components/view-shell/MobileFilterDrawer';
+import { t } from '@app/lib/i18n';
+import { activeElement } from '@app/signal/focus';
+import { FloatRegion } from '@components/app/mobile/float-regions/FloatRegion';
+import { MobileCreateButton } from '@components/app/mobile/MobileCreateButton';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { virtualKeyboardVisible } from '@core/mobile/virtualKeyboard';
+import { isEditableInput } from '@core/util/isEditableInput';
+import PlusIcon from '@icon/system/regular/plus.svg';
+import { Button } from '@ui';
+import { type JSX, type ParentProps, Show } from 'solid-js';
+
+type RecordCreateAction = {
+ label: string;
+ onClick: () => void;
+ disabled?: boolean;
+};
/** Shared toolbar and scrolling content for a record's associated tabs. */
export function RecordSection(
@@ -11,6 +26,9 @@ export function RecordSection(
searchPlaceholder?: string;
onSearchEscape?: () => void;
actions?: JSX.Element;
+ createAction?: RecordCreateAction;
+ /** Preserve existing desktop creation controls; other actions are touch-only. */
+ toolbarCreate?: boolean;
}>
) {
return (
@@ -18,27 +36,85 @@ export function RecordSection(
aria-label={props.title}
class="@container/record flex size-full min-h-0 flex-col"
>
- <div class="flex min-h-12 min-w-0 shrink-0 flex-wrap items-center gap-3 px-4 py-2 touch:pt-[calc(var(--mobile-content-inset-top,0px)+0.5rem)]">
+ <div class="flex min-h-12 min-w-0 shrink-0 flex-wrap items-center gap-3 px-4 py-2 touch:flex-nowrap touch:pt-[calc(var(--mobile-content-inset-top,0px)+1rem)] touch:pb-4">
<SearchBar
size="sm"
label={`Search ${props.title.toLowerCase()}`}
placeholder={
props.searchPlaceholder ?? `Search ${props.title.toLowerCase()}…`
}
- class="w-64 max-w-full"
+ class="w-64 max-w-full touch:w-auto touch:min-w-0 touch:flex-1"
value={props.search}
onValueChange={props.onSearchChange}
onEscape={props.onSearchEscape}
/>
- <Show when={props.actions}>
+ <Show
+ when={
+ props.actions ||
+ (!isTouchDevice() && props.toolbarCreate && props.createAction)
+ }
+ >
<div class="ml-auto flex shrink-0 flex-wrap items-center gap-2.5">
{props.actions}
+ <Show when={props.toolbarCreate && props.createAction}>
+ {(action) => (
+ <Button
+ variant="secondary"
+ class="touch:hidden"
+ disabled={action().disabled}
+ onClick={() => action().onClick()}
+ >
+ <PlusIcon class="size-4" />
+ {action().label}
+ </Button>
+ )}
+ </Show>
</div>
</Show>
</div>
+ <Show when={isTouchDevice() && props.createAction}>
+ {(action) => (
+ <FloatRegion
+ region="accessory"
+ // Replace the app action (-1), but yield to screen composers (0).
+ priority={-0.5}
+ active={() =>
+ !virtualKeyboardVisible() && !isEditableInput(activeElement())
+ }
+ >
+ <div class="flex justify-end px-(--mobile-chrome-gutter)">
+ <MobileCreateButton
+ label={action().label}
+ disabled={action().disabled}
+ onClick={() => action().onClick()}
+ />
+ </div>
+ </FloatRegion>
+ )}
+ </Show>
<div class="flex min-h-0 flex-1 flex-col overflow-y-auto px-2 pb-6 touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+1.5rem)] touch:[--mobile-content-inset-top:0px]">
{props.children}
</div>
</section>
);
}
+
+/** Keep record filters beside search without squeezing their controls onto phones. */
+export function RecordSectionFilters(
+ props: ParentProps<{ activeCount: number; onClear: () => void }>
+) {
+ return (
+ <Show when={isTouchDevice()} fallback={props.children}>
+ <MobileFilterDrawer
+ triggerLabel={t('viewMenus.openFilterMenu')}
+ label={t('viewMenus.filters')}
+ activeCount={props.activeCount}
+ onClear={props.onClear}
+ >
+ <div class="flex flex-col items-start gap-4 px-6 py-4">
+ {props.children}
+ </div>
+ </MobileFilterDrawer>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/crm/components/record-tabs.tsx b/apps/web/src/features/crm/components/record-tabs.tsx
index 23c97c6f4a..7b263a3525 100644
--- a/apps/web/src/features/crm/components/record-tabs.tsx
+++ b/apps/web/src/features/crm/components/record-tabs.tsx
@@ -1,14 +1,18 @@
import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import { t } from '@app/lib/i18n';
+import { MobileDrawer } from '@components/app/mobile/MobileDrawer';
+import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
import { getIconConfig } from '@core/component/EntityIcon';
import { enableDatabases } from '@core/constant/featureFlags';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import CaretDownIcon from '@icon/system/regular/caret-down.svg';
+import CheckIcon from '@icon/system/regular/check.svg';
import SquaresFourIcon from '@icon/system/regular/squares-four.svg';
import UsersIcon from '@icon/system/regular/users.svg';
-import { Tabs } from '@ui';
-import type { Component, JSX } from 'solid-js';
-import {
- CRM_RECORD_SECTION_LABELS,
- type CrmRecordSection,
-} from '../core/record';
+import { Button, Tabs } from '@ui';
+import { type Component, createSignal, For, type JSX, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
+import type { CrmRecordSection } from '../core/record';
const SECTION_ICONS: Record<
CrmRecordSection,
@@ -23,10 +27,7 @@ const SECTION_ICONS: Record<
databases: getIconConfig('database').icon,
};
-/**
- * A CRM record's section tabs for its top bar, like a project's Overview /
- * Tasks tabs. `compact` swaps labels for icons when the bar runs out of room.
- */
+/** Desktop section tabs and a touch header island with a section drawer. */
export function RecordTabs<S extends CrmRecordSection>(props: {
sections: readonly S[];
value: S;
@@ -34,21 +35,106 @@ export function RecordTabs<S extends CrmRecordSection>(props: {
compact?: boolean;
}) {
const databasesFlag = useFeatureFlag(enableDatabases);
+ const [open, setOpen] = createSignal(false);
+ const [trigger, setTrigger] = createSignal<HTMLButtonElement>();
+ const sections = () =>
+ props.sections.filter(
+ (section) => section !== 'databases' || databasesFlag().enabled
+ );
+ const label = (section: CrmRecordSection) => t(`tabs.record-${section}`);
+ const icon = (section: CrmRecordSection) => SECTION_ICONS[section];
+
return (
- <Tabs
- aria-label="Record sections"
- touch="inset"
- class="shrink-0"
- options={props.sections
- .filter((section) => section !== 'databases' || databasesFlag().enabled)
- .map((section) => ({
- value: section,
- label: CRM_RECORD_SECTION_LABELS[section],
- icon: props.compact ? SECTION_ICONS[section] : undefined,
- }))}
- iconOnly={props.compact}
- value={props.value}
- onChange={props.onChange}
- />
+ <Show
+ when={isTouchDevice()}
+ fallback={
+ <Tabs
+ aria-label={t('tabs.recordSections')}
+ class="shrink-0"
+ options={sections().map((section) => ({
+ value: section,
+ label: label(section),
+ icon: props.compact ? SECTION_ICONS[section] : undefined,
+ }))}
+ iconOnly={props.compact}
+ value={props.value}
+ onChange={props.onChange}
+ />
+ }
+ >
+ <HeaderIsland class="shrink px-1">
+ <MobileDrawer
+ side="bottom"
+ open={open()}
+ onOpenChange={setOpen}
+ restoreFocus
+ finalFocusEl={trigger()}
+ >
+ <MobileDrawer.Trigger
+ as={Button}
+ ref={setTrigger}
+ variant="ghost"
+ size="sm"
+ class="min-w-0"
+ aria-label={t('tabs.recordSection', {
+ section: label(props.value),
+ })}
+ >
+ <Dynamic component={icon(props.value)} class="size-5 shrink-0" />
+ <Show when={!props.compact}>
+ <span class="truncate">{label(props.value)}</span>
+ </Show>
+ <CaretDownIcon
+ class="size-4 shrink-0 transition-transform"
+ classList={{ 'rotate-180': open() }}
+ />
+ </MobileDrawer.Trigger>
+ <MobileDrawer.Portal>
+ <MobileDrawer.Overlay />
+ <MobileDrawer.Content>
+ <MobileDrawer.Handle />
+ <MobileDrawer.Title class="px-6 pb-3 text-base font-semibold">
+ {t('tabs.recordSections')}
+ </MobileDrawer.Title>
+ <MobileDrawer.ScrollBody>
+ <MobileDrawer.Section
+ role="radiogroup"
+ aria-label={t('tabs.recordSections')}
+ class="flex flex-col"
+ >
+ <For each={sections()}>
+ {(section) => (
+ <MobileDrawer.Close
+ as={MobileDrawer.Item}
+ role="radio"
+ aria-label={label(section)}
+ class={
+ props.value === section
+ ? 'text-ink'
+ : 'text-ink-extra-muted'
+ }
+ aria-checked={props.value === section}
+ onClick={() => props.onChange(section)}
+ >
+ <Dynamic
+ component={icon(section)}
+ class="size-5 shrink-0"
+ />
+ <span class="min-w-0 flex-1 break-words">
+ {label(section)}
+ </span>
+ <Show when={props.value === section}>
+ <CheckIcon class="size-4 shrink-0 text-ink" />
+ </Show>
+ </MobileDrawer.Close>
+ )}
+ </For>
+ </MobileDrawer.Section>
+ </MobileDrawer.ScrollBody>
+ </MobileDrawer.Content>
+ </MobileDrawer.Portal>
+ </MobileDrawer>
+ </HeaderIsland>
+ </Show>
);
}
diff --git a/apps/web/src/features/crm/core/record.ts b/apps/web/src/features/crm/core/record.ts
index 70afe7aa9c..a7ef1c2cc9 100644
--- a/apps/web/src/features/crm/core/record.ts
+++ b/apps/web/src/features/crm/core/record.ts
@@ -56,13 +56,3 @@ export const CONTACT_SECTIONS = [
export type CompanySection = (typeof COMPANY_SECTIONS)[number];
export type ContactSection = (typeof CONTACT_SECTIONS)[number];
export type CrmRecordSection = CompanySection | ContactSection;
-
-export const CRM_RECORD_SECTION_LABELS: Record<CrmRecordSection, string> = {
- overview: 'Overview',
- team: 'Team',
- emails: 'Emails',
- files: 'Files',
- tasks: 'Tasks',
- calls: 'Calls',
- databases: 'Databases',
-};
diff --git a/apps/web/src/features/crm/record-tasks-adapter.test.tsx b/apps/web/src/features/crm/record-tasks-adapter.test.tsx
index ff499c6b2f..bf07786fa1 100644
--- a/apps/web/src/features/crm/record-tasks-adapter.test.tsx
+++ b/apps/web/src/features/crm/record-tasks-adapter.test.tsx
@@ -71,7 +71,17 @@ vi.mock('@ui', () => ({
),
}));
vi.mock('./components/record-section', () => ({
- RecordSection: (props: { actions: JSX.Element }) => props.actions,
+ RecordSection: (props: {
+ actions: JSX.Element;
+ createAction: { label: string; onClick: () => void };
+ }) => (
+ <>
+ {props.actions}
+ <button onClick={props.createAction.onClick}>
+ {props.createAction.label}
+ </button>
+ </>
+ ),
}));
afterEach(() => {
diff --git a/apps/web/src/features/crm/record-tasks-adapter.tsx b/apps/web/src/features/crm/record-tasks-adapter.tsx
index d563181439..f786d3fe9e 100644
--- a/apps/web/src/features/crm/record-tasks-adapter.tsx
+++ b/apps/web/src/features/crm/record-tasks-adapter.tsx
@@ -11,9 +11,7 @@ import {
isFeatureEnabled,
} from '@core/constant/featureFlags';
import EmptyStateTasksGraphic from '@design/empty-state-tasks.svg';
-import PlusIcon from '@icon/system/regular/plus.svg';
import { TagSetsQueryProvider } from '@property/tags/tag-sets-context';
-import { Button } from '@ui';
import { Show } from 'solid-js';
import {
CrmListEmpty,
@@ -91,15 +89,9 @@ function RecordTasksBody(props: { scope: CrmRecordScope }) {
search={state.search}
onSearchChange={(search) => setState('search', search)}
onSearchEscape={() => listElement?.focus()}
- actions={
- <>
- <TasksControls />
- <Button variant="secondary" onClick={composeTask}>
- <PlusIcon class="size-4" />
- New task
- </Button>
- </>
- }
+ actions={<TasksControls />}
+ createAction={{ label: 'New task', onClick: composeTask }}
+ toolbarCreate
>
<TaskList
loadingContent={<CrmListSkeleton label="Loading tasks" />}
diff --git a/apps/web/src/features/crm/views/company-contacts-section.test.tsx b/apps/web/src/features/crm/views/company-contacts-section.test.tsx
index 772f6d787e..6e5de9e80f 100644
--- a/apps/web/src/features/crm/views/company-contacts-section.test.tsx
+++ b/apps/web/src/features/crm/views/company-contacts-section.test.tsx
@@ -23,6 +23,9 @@ vi.mock('@entity', () => ({
}));
vi.mock('@ui', async () => ({
...(await import('../../../components/ui/components/Avatar')),
+ Button: (props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) => (
+ <button {...props} />
+ ),
EmptyStatePanel: (props: {
title?: string;
primaryAction?: { label: string; onClick: () => void };
diff --git a/apps/web/src/features/crm/views/company-contacts-section.tsx b/apps/web/src/features/crm/views/company-contacts-section.tsx
index 3a4cdb9d52..175119ca32 100644
--- a/apps/web/src/features/crm/views/company-contacts-section.tsx
+++ b/apps/web/src/features/crm/views/company-contacts-section.tsx
@@ -6,7 +6,7 @@ import {
ListLayoutProvider,
} from '@entity';
import { Avatar } from '@ui';
-import { createMemo, createSignal, For, type JSX, Show } from 'solid-js';
+import { createMemo, createSignal, For, Show } from 'solid-js';
import {
CrmListEmpty,
CrmListSearchEmpty,
@@ -66,7 +66,6 @@ export function CompanyContactsSection(props: {
company?: CrmCompanyEntity;
contacts?: CrmContact[];
onOpenContact?: (contact: CrmContact) => void;
- actions?: JSX.Element;
}) {
const context = useCrmContext();
const { openWithSplit } = context.createNavigation();
@@ -81,6 +80,11 @@ export function CompanyContactsSection(props: {
contact.email.toLowerCase().includes(query)
);
});
+ const createContact = () => {
+ const domain = props.company?.domains?.[0]?.domain;
+ if (domain && props.company)
+ context.openCreateContact({ companyId: props.company.id, domain });
+ };
return (
<RecordSection
@@ -89,7 +93,12 @@ export function CompanyContactsSection(props: {
onSearchChange={setSearch}
searchPlaceholder="Search contacts…"
onSearchEscape={() => setSearch('')}
- actions={props.actions}
+ createAction={{
+ label: 'Add contact',
+ onClick: createContact,
+ disabled: !props.company?.domains?.[0],
+ }}
+ toolbarCreate
>
<Show
when={props.company}
@@ -106,17 +115,7 @@ export function CompanyContactsSection(props: {
description="Add a contact to this company to see them here."
action={
props.company?.domains?.[0]
- ? {
- label: 'Add contact',
- onClick: () => {
- const domain = props.company?.domains?.[0]?.domain;
- if (domain && props.company)
- context.openCreateContact({
- companyId: props.company.id,
- domain,
- });
- },
- }
+ ? { label: 'Add contact', onClick: createContact }
: undefined
}
/>
diff --git a/apps/web/src/features/crm/views/company-detail.tsx b/apps/web/src/features/crm/views/company-detail.tsx
index 82e5f0451f..682d7da62a 100644
--- a/apps/web/src/features/crm/views/company-detail.tsx
+++ b/apps/web/src/features/crm/views/company-detail.tsx
@@ -1,6 +1,4 @@
import { SidePanel } from '@components/app/side-panel';
-import PlusIcon from '@icon/system/regular/plus.svg';
-import { Button } from '@ui';
import { createMemo, Match, onCleanup, Show, Suspense, Switch } from 'solid-js';
import { CrmListSkeleton } from '../components/list-state';
import { RecordOverview } from '../components/record-overview';
@@ -48,7 +46,6 @@ export function Company(props: {
id: props.companyId,
}))
);
- const openCreateContactModal = context.openCreateContact;
const listsEnabled = context.listsEnabled();
const pipelinesEnabled = context.pipelinesEnabled();
const { company, contacts } = useCompanyQuery(() => props.companyId);
@@ -93,25 +90,6 @@ export function Company(props: {
company={company()}
contacts={contacts()}
onOpenContact={props.onOpenContact}
- actions={
- <Button
- variant="secondary"
- // Contact emails are pinned to the company's primary
- // domain; disabled until the company has loaded.
- disabled={!company()?.domains[0]}
- onClick={() => {
- const domain = company()?.domains[0]?.domain;
- if (domain)
- openCreateContactModal({
- companyId: props.companyId,
- domain,
- });
- }}
- >
- <PlusIcon class="size-4" />
- Add contact
- </Button>
- }
/>
</Match>
<Match when={section() === 'emails'}>
diff --git a/apps/web/src/features/crm/views/company-emails-section.tsx b/apps/web/src/features/crm/views/company-emails-section.tsx
index db1fcd1ab8..f22a3800ca 100644
--- a/apps/web/src/features/crm/views/company-emails-section.tsx
+++ b/apps/web/src/features/crm/views/company-emails-section.tsx
@@ -3,7 +3,10 @@ import type { CrmCompanyEntity } from '@entity';
import { Tabs } from '@ui';
import { createMemo, createSignal } from 'solid-js';
import { CrmListEmpty } from '../components/list-state';
-import { RecordSection } from '../components/record-section';
+import {
+ RecordSection,
+ RecordSectionFilters,
+} from '../components/record-section';
import { useCrmContext } from '../context/crm-context';
import type {
CrmEmailSignal as EmailSignalView,
@@ -36,8 +39,21 @@ export function CompanyEmailsSection(props: { company?: CrmCompanyEntity }) {
title="Emails"
search={search()}
onSearchChange={setSearch}
+ createAction={
+ props.company?.emailSync === false
+ ? undefined
+ : { label: 'New email', onClick: () => crm.openEmailComposer() }
+ }
actions={
- <>
+ <RecordSectionFilters
+ activeCount={
+ Number(signalView() !== 'all') + Number(view() !== 'team')
+ }
+ onClear={() => {
+ setSignalView('all');
+ setView('team');
+ }}
+ >
<Tabs
aria-label="Email importance"
size="sm"
@@ -60,7 +76,7 @@ export function CompanyEmailsSection(props: { company?: CrmCompanyEntity }) {
value={view()}
onChange={setView}
/>
- </>
+ </RecordSectionFilters>
}
>
<RecordItemList
diff --git a/apps/web/src/features/crm/views/contact-emails-section.tsx b/apps/web/src/features/crm/views/contact-emails-section.tsx
index 3dc2790236..0ef1db1f0b 100644
--- a/apps/web/src/features/crm/views/contact-emails-section.tsx
+++ b/apps/web/src/features/crm/views/contact-emails-section.tsx
@@ -2,7 +2,10 @@ import EmptyStateEmailGraphic from '@design/empty-state-email.svg';
import { Tabs } from '@ui';
import { createSignal } from 'solid-js';
import { CrmListEmpty } from '../components/list-state';
-import { RecordSection } from '../components/record-section';
+import {
+ RecordSection,
+ RecordSectionFilters,
+} from '../components/record-section';
import { useCrmContext } from '../context/crm-context';
import type {
CrmEmailSignal as EmailSignalView,
@@ -25,8 +28,20 @@ export function ContactEmailsSection(props: { contact?: CrmContactResponse }) {
title="Emails"
search={search()}
onSearchChange={setSearch}
+ createAction={{
+ label: 'New email',
+ onClick: () => crm.openEmailComposer(props.contact?.email),
+ }}
actions={
- <>
+ <RecordSectionFilters
+ activeCount={
+ Number(signalView() !== 'all') + Number(view() !== 'team')
+ }
+ onClear={() => {
+ setSignalView('all');
+ setView('team');
+ }}
+ >
<Tabs
aria-label="Email importance"
size="sm"
@@ -49,7 +64,7 @@ export function ContactEmailsSection(props: { contact?: CrmContactResponse }) {
value={view()}
onChange={setView}
/>
- </>
+ </RecordSectionFilters>
}
>
<RecordItemList
diff --git a/apps/web/src/features/crm/views/copy-link-button.tsx b/apps/web/src/features/crm/views/copy-link-button.tsx
index 5eaba0bd8c..00d3cfbb90 100644
--- a/apps/web/src/features/crm/views/copy-link-button.tsx
+++ b/apps/web/src/features/crm/views/copy-link-button.tsx
@@ -1,3 +1,4 @@
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import LinkIcon from '@icon/system/regular/link.svg';
import { Button, ButtonGroup, CopyButton } from '@ui';
import { useCrmContext } from '../context/crm-context';
@@ -9,17 +10,21 @@ export function CrmCopyLinkButton(props: {
}) {
const { copyRecordLink } = useCrmContext();
const copyLink = () => copyRecordLink({ type: props.type, id: props.id });
+ const size = () => {
+ if (isTouchDevice()) return 'icon-lg';
+ return props.grouped ? 'icon-sm' : 'icon-md';
+ };
return (
<CopyButton
aria-label={`Copy ${props.type} link`}
as={props.grouped ? ButtonGroup.Button : Button}
variant="ghost"
- size={props.grouped ? 'icon-sm' : 'icon-md'}
+ size={size()}
tooltip={`Copy ${props.type} link`}
onClick={copyLink}
>
- <LinkIcon class="size-3.5!" />
+ <LinkIcon class="size-4 touch:size-6" />
</CopyButton>
);
}
diff --git a/apps/web/src/features/crm/views/databases.tsx b/apps/web/src/features/crm/views/databases.tsx
index df18fead15..8dad6ef111 100644
--- a/apps/web/src/features/crm/views/databases.tsx
+++ b/apps/web/src/features/crm/views/databases.tsx
@@ -3,8 +3,6 @@ import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { enableDatabases } from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import EmptyStateDatabaseGraphic from '@design/empty-state-folder.svg';
-import PlusIcon from '@icon/system/regular/plus.svg';
-import { Button } from '@ui';
import { createSignal, type JSX, Show } from 'solid-js';
import { CrmListEmpty, CrmListSkeleton } from '../components/list-state';
import { RecordSection } from '../components/record-section';
@@ -91,12 +89,8 @@ function DatabasesList(props: { scope?: CrmRecordScope; title?: JSX.Element }) {
title="Databases"
search={search()}
onSearchChange={setSearch}
- actions={
- <Button variant="outline" onClick={create}>
- <PlusIcon class="size-4" />
- New database
- </Button>
- }
+ createAction={{ label: 'New database', onClick: create }}
+ toolbarCreate
>
{list()}
</RecordSection>
diff --git a/apps/web/src/features/crm/views/record-associations.tsx b/apps/web/src/features/crm/views/record-associations.tsx
index 3f26a77952..85c683d736 100644
--- a/apps/web/src/features/crm/views/record-associations.tsx
+++ b/apps/web/src/features/crm/views/record-associations.tsx
@@ -17,7 +17,15 @@ export function RecordFilesSection(props: { scope?: CrmRecordScope }) {
const crm = useCrmContext();
const files = crm.createRecordFiles(() => props.scope);
return (
- <RecordSection title="Files" search={search()} onSearchChange={setSearch}>
+ <RecordSection
+ title="Files"
+ search={search()}
+ onSearchChange={setSearch}
+ createAction={{
+ label: 'New note',
+ onClick: () => crm.openCreateItem('notes'),
+ }}
+ >
<RecordItemList
source={files}
search={search()}
@@ -48,7 +56,15 @@ export function RecordCallsSection(props: { scope?: CrmRecordScope }) {
const crm = useCrmContext();
const calls = crm.createRecordCalls(() => props.scope);
return (
- <RecordSection title="Calls" search={search()} onSearchChange={setSearch}>
+ <RecordSection
+ title="Calls"
+ search={search()}
+ onSearchChange={setSearch}
+ createAction={{
+ label: 'New call',
+ onClick: () => crm.openCreateItem('calls'),
+ }}
+ >
<RecordItemList
source={calls}
search={search()}
diff --git a/apps/web/src/features/crm/views/record-detail.tsx b/apps/web/src/features/crm/views/record-detail.tsx
index 7dd5540de7..bbb6d8c1d9 100644
--- a/apps/web/src/features/crm/views/record-detail.tsx
+++ b/apps/web/src/features/crm/views/record-detail.tsx
@@ -177,13 +177,13 @@ export function CrmRecordDetail(props: {
tabindex={-1}
class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden outline-none"
>
- <div class="flex h-12 min-w-0 shrink-0 items-center gap-2 px-3 touch:gap-3 touch:border-b touch:border-edge-muted touch:px-4 touch:h-auto touch:min-h-12 touch:pt-[calc(var(--mobile-content-inset-top,var(--safe-top,0px))+0.5rem)] touch:pb-2">
+ <div class="flex h-12 min-w-0 shrink-0 items-center gap-2 px-3 touch:gap-3 touch:border-b touch:border-edge-muted touch:px-4 touch:h-auto touch:min-h-12 touch:pt-[calc(var(--mobile-content-inset-top,var(--safe-top,0px))+0.5rem)] touch:pb-2 mobile:flex-wrap">
{props.navigation}
<ViewBreadcrumbs.Outlet
aria-label="CRM record location"
- class="min-w-0 shrink"
+ class="min-w-0 shrink mobile:flex-1"
/>
- <div class="min-w-0 overflow-x-auto">
+ <div class="min-w-0 not-touch:overflow-x-auto mobile:order-last mobile:flex mobile:basis-full">
<Show
when={current().type === 'contact'}
fallback={
diff --git a/apps/web/src/lib/i18n/locales/en/tabs.ts b/apps/web/src/lib/i18n/locales/en/tabs.ts
index 6a03c4a8aa..bc3a535a6a 100644
--- a/apps/web/src/lib/i18n/locales/en/tabs.ts
+++ b/apps/web/src/lib/i18n/locales/en/tabs.ts
@@ -9,4 +9,15 @@ export default {
one: '{{count}} split',
other: '{{count}} splits',
},
+
+ // Company and contact sections.
+ recordSections: 'Switch view',
+ recordSection: 'View: {{section}}',
+ 'record-overview': 'Overview',
+ 'record-team': 'Team',
+ 'record-emails': 'Emails',
+ 'record-files': 'Files',
+ 'record-tasks': 'Tasks',
+ 'record-calls': 'Calls',
+ 'record-databases': 'Databases',
};
diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.md
index 67813e76ba..ab04250ff3 100644
--- a/docs/agent-guide/crm.md
+++ b/docs/agent-guide/crm.md
@@ -187,18 +187,41 @@ already in the trail (such as the contact's own company from `Companies >
<company> > <contact>`) returns to it instead of adding a duplicate. Back and
Forward restore the trail; a reloaded or shared record URL shows only `<list> >
<record>`. The CRM sidebar stays visible throughout.
-Company and contact headers group `Copy link` separately from the side-panel toggle. Desktop section tabs collapse to icons in narrow panes; each icon keeps a tooltip.
+Company and contact headers group `Copy link` separately from the side-panel toggle.
+Desktop section tabs collapse to icons in narrow panes; each icon keeps a tooltip.
+On phones and tablets, the current section appears as a labeled header island
+with a caret. When the host collapses it, the section icon and caret keep its
+accessible label. Embedded phone headers put the switcher below the breadcrumb
+and actions so the record name and navigation retain space. Tap the switcher to
+open the shared **Switch view** bottom drawer: every available section
+has an icon and label, with a check beside the current section. Choosing a section
+closes the drawer and updates the header label; Escape, backdrop tap, and drag
+also dismiss it. Focus returns to the section trigger. Databases remains gated
+by its feature flag, and contacts do not show Team. The workspace's scrollable
+mobile view strip is unchanged. A direct Databases section link retains its
+title with the unavailable-state message when the flag is off, without database
+queries or creation actions. Copy-link islands are 40px square on touch with
+a 24px icon. Verify both record types, section changes, dismissal, copy feedback,
+and header fit at phone and tablet widths.
Their information panel starts closed and opens as a floating bubble at every
width, without shrinking the record content. Click outside the bubble or use
the toggle to dismiss it; the open state is not restored on a later visit.
It copies the record's direct URL and shows a confirmation toast; this is also
available in the embedded company and contact breadcrumb header.
-The Team, Emails, Files, Tasks, Calls, and Databases tabs share a compact toolbar: search on
-the left, with available filters and actions on the right. Search remains visible
-for empty lists. `Add contact` and `New task` match the project task list's
-creation button: a rounded outline, standard height, and leading plus icon.
-The associated-tab search fields match the creation buttons' height.
+The Team, Emails, Files, Tasks, Calls, and Databases views share a compact
+toolbar. On desktop, search stays on the left with existing filters and creation
+actions on the right. On touch, search has 16px of space below the header and
+fills the row beside the filter button, or the whole row without filters.
+Email importance and inbox choices open in the shared filter drawer.
+Section creation actions appear at the bottom right above the navigation dock,
+replacing the default app-wide action: Add contact, New email, New note, New task,
+New call, or New database. Existing contact-domain requirements, email-sync and
+database gates, recipients, and task associations still apply. Keyboard focus and
+higher-priority composers suppress the floating action; leaving the section
+restores the default action. Search remains visible for empty lists.
+Verify filter changes, section changes, disabled creation, and bottom-row clearance
+on phone and tablet; desktop creation controls must stay in the toolbar.
Team rows show a profile photo when available, otherwise a
letter avatar at the same 16px size as channel list icons. Team uses the same Soup
row component as Emails, Files, and Calls: the avatar, name, and email are inline,
@@ -209,9 +232,10 @@ continue loading pages when the current pages have no match.
Emails, Files, Calls, and References rows open their items without selection
checkboxes, including on touch devices.
-A company is laid out like a project. Its split header or embedded breadcrumb
-header shows rounded view tabs for `Overview`, `Team`, `Emails`, `Files`, `Tasks`, `Calls`, and `Databases`
-tabs, collapsing to icons when narrow. Overview shows the name, pills
+A company is laid out like a project. On desktop, its split header or embedded
+breadcrumb header shows rounded view tabs for `Overview`, `Team`, `Emails`,
+`Files`, `Tasks`, `Calls`, and `Databases`, collapsing to icons when narrow.
+Touch headers use the section drawer described above. Overview shows the name, pills
for each domain and `Last interacted`, the generated description, a
**Pipelines** section and the Discussion. Pipelines stacks one full-width card
per row of a pipeline you can open that references the record. A card's header