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): unify associated record list styling (#8087)

teo4b25ac92081a
diff --git a/apps/web/src/components/view-shell/SearchBar.tsx b/apps/web/src/components/view-shell/SearchBar.tsx
index ead19f3c99..8882e6cac7 100644
--- a/apps/web/src/components/view-shell/SearchBar.tsx
+++ b/apps/web/src/components/view-shell/SearchBar.tsx
@@ -8,7 +8,7 @@ import { Show, splitProps } from 'solid-js';
export type SearchBarProps = Omit<
JSX.InputHTMLAttributes<HTMLInputElement>,
- 'children' | 'class' | 'onInput' | 'type' | 'value'
+ 'children' | 'class' | 'onInput' | 'size' | 'type' | 'value'
> & {
label: string;
value: string;
@@ -23,6 +23,7 @@ export type SearchBarProps = Omit<
onClose?: () => void;
/** Controls shown after the input and before its clear or close action. */
actions?: JSXElement;
+ size?: 'sm' | 'md';
class?: string;
inputClass?: string;
};
@@ -36,6 +37,7 @@ export function SearchBar(props: SearchBarProps) {
'onEscape',
'onClose',
'actions',
+ 'size',
'class',
'inputClass',
'disabled',
@@ -65,7 +67,8 @@ export function SearchBar(props: SearchBarProps) {
depth={2}
hideBorder
class={cn(
- 'h-10 w-full min-w-0 rounded-full border border-edge-button bg-control text-ink has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-edge-muted',
+ 'w-full min-w-0 rounded-full border border-edge-button bg-control text-ink has-[input:focus-visible]:ring-2 has-[input:focus-visible]:ring-edge-muted',
+ local.size === 'sm' ? 'h-8' : 'h-10',
local.class
)}
data-search-bar=""
@@ -78,13 +81,19 @@ export function SearchBar(props: SearchBarProps) {
disabled={local.disabled}
readOnly={local.readOnly}
required={local.required}
- class="group flex size-full min-w-0 items-center gap-2 px-3"
+ class={cn(
+ 'group flex size-full min-w-0 items-center',
+ local.size === 'sm' ? 'gap-1.5 px-2' : 'gap-2 px-3'
+ )}
onKeyDown={onKeyDown}
>
<TextField.Label class="sr-only">{local.label}</TextField.Label>
<MagnifyingGlassIcon
aria-hidden="true"
- class="size-4 shrink-0 text-ink-extra-muted"
+ class={cn(
+ 'shrink-0 text-ink-extra-muted',
+ local.size === 'sm' ? 'size-3.5' : 'size-4'
+ )}
/>
<div class="relative min-w-0 flex-1">
<TextField.Input
@@ -126,7 +135,7 @@ export function SearchBar(props: SearchBarProps) {
>
<Button
type="button"
- size="sm"
+ size={local.size === 'sm' ? 'icon-xs' : 'sm'}
square
label={local.onClose ? 'Close search' : 'Clear search'}
onPointerDown={(event) => event.preventDefault()}
diff --git a/apps/web/src/features/crm/components/record-section.tsx b/apps/web/src/features/crm/components/record-section.tsx
index 513ed77ded..1bfef9d68b 100644
--- a/apps/web/src/features/crm/components/record-section.tsx
+++ b/apps/web/src/features/crm/components/record-section.tsx
@@ -1,19 +1,41 @@
+import { SearchBar } from '@app/components/view-shell';
import type { JSX, ParentProps } from 'solid-js';
import { Show } from 'solid-js';
-/** A named record tab with optional actions above scrolling content. */
+/** Shared toolbar and scrolling content for a record's associated tabs. */
export function RecordSection(
- props: ParentProps<{ title: string; actions?: JSX.Element }>
+ props: ParentProps<{
+ title: string;
+ search: string;
+ onSearchChange: (value: string) => void;
+ searchPlaceholder?: string;
+ onSearchEscape?: () => void;
+ actions?: JSX.Element;
+ }>
) {
return (
- <section aria-label={props.title} class="flex size-full min-h-0 flex-col">
- <Show when={props.actions}>
- <div class="flex min-w-0 shrink-0 flex-wrap items-center gap-3 px-4 py-3">
- <div class="ml-auto flex shrink-0 items-center gap-2.5">
+ <section
+ 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">
+ <SearchBar
+ size="sm"
+ label={`Search ${props.title.toLowerCase()}`}
+ placeholder={
+ props.searchPlaceholder ?? `Search ${props.title.toLowerCase()}…`
+ }
+ class="w-64 max-w-full"
+ value={props.search}
+ onValueChange={props.onSearchChange}
+ onEscape={props.onSearchEscape}
+ />
+ <Show when={props.actions}>
+ <div class="ml-auto flex shrink-0 flex-wrap items-center gap-2.5">
{props.actions}
</div>
- </div>
- </Show>
+ </Show>
+ </div>
<div class="min-h-0 flex-1 overflow-y-auto px-2 pb-6">
{props.children}
</div>
diff --git a/apps/web/src/features/crm/context/crm-context.tsx b/apps/web/src/features/crm/context/crm-context.tsx
index d94b7ca2b8..590039e36d 100644
--- a/apps/web/src/features/crm/context/crm-context.tsx
+++ b/apps/web/src/features/crm/context/crm-context.tsx
@@ -42,6 +42,8 @@ export type CrmContext = {
PipelineEntries: PipelineEntriesView;
PipelineSharing: PipelineSharing;
downloadCsv(content: string, filename: string): Promise<{ saved: boolean }>;
+ /** Profile picture lookup for a contact; presentation owns the fallback. */
+ createContactPhoto?(email: string): Accessor<string | undefined>;
contactInitials(name: string | null | undefined, email: string): string;
userEmail(id: string): string;
copyViewLink(config: import('../core/saved-view').CrmViewConfig): void;
diff --git a/apps/web/src/features/crm/core/record-search.ts b/apps/web/src/features/crm/core/record-search.ts
new file mode 100644
index 0000000000..afe40367dd
--- /dev/null
+++ b/apps/web/src/features/crm/core/record-search.ts
@@ -0,0 +1,17 @@
+/** Search the visible title and supporting text of an associated record. */
+export function recordItemMatchesSearch(
+ entity: { name: string; snippet?: unknown; summary?: unknown },
+ search: string
+): boolean {
+ const query = search.trim().toLowerCase();
+ if (!query) return true;
+ const text = [
+ entity.name,
+ 'snippet' in entity ? entity.snippet : undefined,
+ 'summary' in entity ? entity.summary : undefined,
+ ]
+ .filter((value): value is string => typeof value === 'string')
+ .join(' ')
+ .toLowerCase();
+ return query.split(/\s+/).every((word) => text.includes(word));
+}
diff --git a/apps/web/src/features/crm/crm-adapter.ts b/apps/web/src/features/crm/crm-adapter.ts
index e1678a0131..a5e7d08791 100644
--- a/apps/web/src/features/crm/crm-adapter.ts
+++ b/apps/web/src/features/crm/crm-adapter.ts
@@ -8,7 +8,8 @@ import {
enableCrmPipelines,
} from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
-import { getInitialsFromName } from '@core/user';
+import { useProfilePictureUrl } from '@core/signal/profilePicture';
+import { emailToMacroId, getInitialsFromName } from '@core/user';
import { idToEmail } from '@core/user/util';
import { queryReadyGate } from '@queries/gate';
import { useListPropertiesQuery } from '@queries/properties/definitions';
@@ -175,6 +176,8 @@ export function createAppCrmContext(): CrmContext {
PipelineSharing: PipelineShare,
feedback: toast,
downloadCsv: downloadCrmCsv,
+ createContactPhoto: (email) =>
+ useProfilePictureUrl(emailToMacroId(email))[0],
contactInitials: getInitialsFromName,
userEmail: idToEmail,
createNavigation: createAppCrmNavigation,
diff --git a/apps/web/src/features/crm/record-tasks-adapter.tsx b/apps/web/src/features/crm/record-tasks-adapter.tsx
index 155cf1a349..cb960e2a08 100644
--- a/apps/web/src/features/crm/record-tasks-adapter.tsx
+++ b/apps/web/src/features/crm/record-tasks-adapter.tsx
@@ -1,4 +1,3 @@
-import { SearchBar } from '@app/components/view-shell';
import { TasksControls } from '@app/features/tasks-view/components/TasksControls';
import { TaskList } from '@app/features/tasks-view/components/task-list/TaskList';
import { useTasksDataSource } from '@app/features/tasks-view/queries/use-tasks-query';
@@ -8,6 +7,7 @@ import {
} from '@app/features/tasks-view/tasks-view-context';
import { createTaskWithProperties } from '@block-md/util/taskComposerProperties';
import { useSplitLayout } from '@components/app/split-layout/layout';
+import PlusIcon from '@phosphor/plus.svg';
import { SYSTEM_PROPERTY_IDS } from '@property/identifiers';
import { TagSetsQueryProvider } from '@property/tags/tag-sets-context';
import type { PropertyApiValues } from '@property/types';
@@ -113,18 +113,16 @@ function RecordTasksBody(props: { scope: CrmRecordScope }) {
return (
<RecordSection
title="Tasks"
+ search={state.search}
+ onSearchChange={(search) => setState('search', search)}
+ onSearchEscape={() => listElement?.focus()}
actions={
<>
- <SearchBar
- label={`Search ${props.scope.type} tasks`}
- placeholder="Search tasks"
- class="w-56"
- value={state.search}
- onValueChange={(search) => setState('search', search)}
- onEscape={() => listElement?.focus()}
- />
<TasksControls />
- <Button onClick={composeTask}>New task</Button>
+ <Button variant="outline" onClick={composeTask}>
+ <PlusIcon class="size-4" />
+ New task
+ </Button>
</>
}
>
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
new file mode 100644
index 0000000000..e3c24c4f96
--- /dev/null
+++ b/apps/web/src/features/crm/views/company-contacts-section.test.tsx
@@ -0,0 +1,102 @@
+import type { CrmCompanyEntity } from '@entity';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import type { JSX, ParentProps } from 'solid-js';
+import { afterEach, expect, it, vi } from 'vitest';
+import type { CrmContact } from '../core/contact';
+import { CompanyContactsSection } from './company-contacts-section';
+
+vi.mock('@entity', () => ({
+ ListEntity: (props: {
+ entity: { name: string };
+ icon: JSX.Element;
+ titleTrailing: JSX.Element;
+ onClick: JSX.EventHandler<HTMLButtonElement, MouseEvent>;
+ }) => (
+ <button type="button" onClick={props.onClick}>
+ {props.icon}
+ {props.entity.name}
+ {props.titleTrailing}
+ </button>
+ ),
+ ListEntityMetadataQueryProvider: (props: ParentProps) => props.children,
+ ListLayoutProvider: (props: ParentProps) => props.children,
+}));
+vi.mock('@ui', async () => import('../../../components/ui/components/Avatar'));
+vi.mock('@app/components/view-shell', () => ({
+ SearchBar: (props: {
+ label: string;
+ value: string;
+ onValueChange(value: string): void;
+ }) => (
+ <input
+ aria-label={props.label}
+ value={props.value}
+ onInput={(event) => props.onValueChange(event.currentTarget.value)}
+ />
+ ),
+}));
+vi.mock('../context/crm-context', () => ({
+ useCrmContext: () => ({
+ createNavigation: () => ({ openWithSplit: vi.fn() }),
+ createContactPhoto: (email: string) => () =>
+ email === '[email protected]' ? '/avery.jpg' : undefined,
+ }),
+}));
+afterEach(cleanup);
+
+const contacts: CrmContact[] = [
+ {
+ id: 'a',
+ companyId: 'co',
+ name: 'Avery Chen',
+ email: '[email protected]',
+ hidden: false,
+ createdAt: '2026-10-15',
+ updatedAt: '2026-10-15',
+ firstInteraction: '2026-10-15',
+ lastInteraction: '2026-10-15',
+ },
+ {
+ id: 'p',
+ companyId: 'co',
+ email: '[email protected]',
+ hidden: false,
+ createdAt: '2026-10-15',
+ updatedAt: '2026-10-15',
+ firstInteraction: '2026-10-15',
+ lastInteraction: '2026-10-15',
+ },
+];
+
+it('shows contact photos or a letter avatar and opens the chosen contact', () => {
+ const open = vi.fn();
+ const { container } = render(() => (
+ <CompanyContactsSection
+ company={{ id: 'co' } as CrmCompanyEntity}
+ contacts={contacts}
+ onOpenContact={open}
+ />
+ ));
+ expect(container.querySelector('img')?.getAttribute('src')).toBe(
+ '/avery.jpg'
+ );
+ screen.getByText('P');
+ fireEvent.click(screen.getByRole('button', { name: /Avery Chen/ }));
+ expect(open).toHaveBeenCalledWith(contacts[0]);
+});
+
+it('filters by email and keeps the search available with no results', () => {
+ render(() => (
+ <CompanyContactsSection
+ company={{ id: 'co' } as CrmCompanyEntity}
+ contacts={contacts}
+ />
+ ));
+ const search = screen.getByRole('textbox', { name: 'Search team' });
+ fireEvent.input(search, { target: { value: 'procurement' } });
+ expect(screen.queryByRole('button', { name: /Avery Chen/ })).toBeNull();
+ screen.getByRole('button', { name: /[email protected]/ });
+ fireEvent.input(search, { target: { value: 'missing' } });
+ screen.getByText('No matching contacts.');
+ expect(screen.getByRole('textbox', { name: 'Search team' })).toBe(search);
+});
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 bfa66f6b39..13fbfd438f 100644
--- a/apps/web/src/features/crm/views/company-contacts-section.tsx
+++ b/apps/web/src/features/crm/views/company-contacts-section.tsx
@@ -1,85 +1,129 @@
-import type { CrmCompanyEntity } from '@entity';
-import { createMemo, createSignal, For, Show } from 'solid-js';
+import {
+ type CrmCompanyEntity,
+ type CrmContactEntity,
+ ListEntity,
+ ListEntityMetadataQueryProvider,
+ ListLayoutProvider,
+} from '@entity';
+import { Avatar } from '@ui';
+import { createMemo, createSignal, For, type JSX, Show } from 'solid-js';
+import { RecordSection } from '../components/record-section';
import { useCrmContext } from '../context/crm-context';
-import type { CrmContact as CompanyContact } from '../core/contact';
+import type { CrmContact } from '../core/contact';
+
+function ContactRow(props: {
+ contact: CrmContact;
+ onOpen: (event: MouseEvent) => void;
+ ownerId: string;
+}) {
+ const photo = useCrmContext().createContactPhoto?.(props.contact.email);
+ const name = () => props.contact.name || props.contact.email;
+ const entity = (): CrmContactEntity => ({
+ ...props.contact,
+ type: 'crm_contact',
+ name: name(),
+ ownerId: props.ownerId,
+ sortTs: props.contact.lastInteraction,
+ });
+ return (
+ <ListEntity
+ entity={entity()}
+ timestamp={props.contact.lastInteraction}
+ role="button"
+ tabIndex={0}
+ onClick={props.onOpen}
+ onKeyDown={(event) => {
+ if (event.target !== event.currentTarget) return;
+ if (event.key !== 'Enter' && event.key !== ' ') return;
+ event.preventDefault();
+ event.currentTarget.click();
+ }}
+ icon={
+ <Avatar size="sm" aria-hidden="true">
+ <Show when={photo?.()}>
+ {(url) => <Avatar.Image src={url()} alt="" />}
+ </Show>
+ <Avatar.Fallback>{name().slice(0, 1).toUpperCase()}</Avatar.Fallback>
+ </Avatar>
+ }
+ titleTrailing={
+ <Show when={props.contact.name}>
+ <span class="min-w-0 truncate font-normal text-ink-extra-muted">
+ {props.contact.email}
+ </span>
+ </Show>
+ }
+ />
+ );
+}
export function CompanyContactsSection(props: {
company?: CrmCompanyEntity;
- contacts?: CompanyContact[];
- onOpenContact?: (contact: CompanyContact) => void;
+ contacts?: CrmContact[];
+ onOpenContact?: (contact: CrmContact) => void;
+ actions?: JSX.Element;
}) {
- const contacts = () => props.contacts ?? [];
const { openWithSplit } = useCrmContext().createNavigation();
-
const [search, setSearch] = createSignal('');
+ const [listRef, setListRef] = createSignal<HTMLElement>();
const filtered = createMemo(() => {
const query = search().trim().toLowerCase();
- if (!query) return contacts();
- return contacts().filter(
+ return (props.contacts ?? []).filter(
(contact) =>
+ !query ||
contact.name?.toLowerCase().includes(query) ||
contact.email.toLowerCase().includes(query)
);
});
return (
- <Show
- when={props.company}
- fallback={<div class="text-sm text-ink-muted">Loading…</div>}
+ <RecordSection
+ title="Team"
+ search={search()}
+ onSearchChange={setSearch}
+ searchPlaceholder="Search contacts…"
+ actions={props.actions}
>
<Show
- when={contacts().length > 0}
- fallback={<div class="text-sm text-ink-muted">No contacts yet.</div>}
+ when={props.company}
+ fallback={
+ <div class="p-6 text-center text-sm text-ink-muted">Loading…</div>
+ }
>
- <div class="flex flex-col gap-2">
- <input
- type="text"
- value={search()}
- onInput={(event) => setSearch(event.currentTarget.value)}
- placeholder="Search contacts…"
- class="w-full rounded-md border border-edge bg-surface px-2 py-1 text-sm text-ink placeholder:text-ink-placeholder focus:outline-none"
- />
- <Show
- when={filtered().length > 0}
- fallback={
- <div class="text-sm text-ink-muted">No matching contacts.</div>
- }
- >
- <div class="flex flex-col gap-1">
- <For each={filtered()}>
- {(contact) => (
- <button
- type="button"
- onClick={(event) => {
- if (props.onOpenContact && !event.shiftKey) {
- props.onOpenContact(contact);
- return;
- }
- openWithSplit(
- {
- type: 'contact',
- id: contact.id,
- },
- { activate: true, preferNewSplit: event.shiftKey }
- );
- }}
- class="flex min-w-0 flex-col gap-0.5 rounded-md px-2 py-1.5 text-left hover:bg-ink-muted/[0.06]"
- >
- <span class="truncate text-sm">
- {contact.name ?? contact.email}
- </span>
- <Show when={contact.name}>
- <span class="truncate text-xs text-ink-muted">
- {contact.email}
- </span>
- </Show>
- </button>
- )}
- </For>
+ <Show
+ when={filtered().length}
+ fallback={
+ <div class="p-6 text-center text-sm text-ink-muted">
+ {search().trim() ? 'No matching contacts.' : 'No contacts yet.'}
</div>
- </Show>
- </div>
+ }
+ >
+ <ListEntityMetadataQueryProvider>
+ <ListLayoutProvider ref={listRef}>
+ <div ref={setListRef} class="flex flex-col">
+ <For each={filtered()}>
+ {(contact) => (
+ <ContactRow
+ contact={contact}
+ ownerId={props.company?.ownerId ?? ''}
+ onOpen={(event) => {
+ if (props.onOpenContact && !event.shiftKey) {
+ props.onOpenContact(contact);
+ return;
+ }
+ openWithSplit(
+ { type: 'contact', id: contact.id },
+ { activate: true, preferNewSplit: event.shiftKey }
+ );
+ }}
+ />
+ )}
+ </For>
+ </div>
+ </ListLayoutProvider>
+ </ListEntityMetadataQueryProvider>
+ </Show>
</Show>
- </Show>
+ </RecordSection>
);
}
diff --git a/apps/web/src/features/crm/views/company-detail.tsx b/apps/web/src/features/crm/views/company-detail.tsx
index 29bd38bee9..ca83e7870f 100644
--- a/apps/web/src/features/crm/views/company-detail.tsx
+++ b/apps/web/src/features/crm/views/company-detail.tsx
@@ -2,7 +2,6 @@ import { SidePanel } from '@components/app/side-panel';
import PlusIcon from '@phosphor/plus.svg';
import { Button } from '@ui';
import { createMemo, Match, Show, Suspense, Switch } from 'solid-js';
-import { RecordSection } from '../components/record-section';
import { useCrmContext } from '../context/crm-context';
import type { CrmContact as CompanyContact } from '../core/contact';
import {
@@ -83,12 +82,13 @@ export function Company(props: {
</div>
</Match>
<Match when={section() === 'team'}>
- <RecordSection
- title="Team"
+ <CompanyContactsSection
+ company={company()}
+ contacts={contacts()}
+ onOpenContact={props.onOpenContact}
actions={
<Button
- variant="ghost"
- size="sm"
+ variant="outline"
// Contact emails are pinned to the company's primary
// domain; disabled until the company has loaded.
disabled={!company()?.domains[0]}
@@ -101,19 +101,11 @@ export function Company(props: {
});
}}
>
- <PlusIcon class="size-3.5" />
+ <PlusIcon class="size-4" />
Add contact
</Button>
}
- >
- <div class="px-2">
- <CompanyContactsSection
- company={company()}
- contacts={contacts()}
- onOpenContact={props.onOpenContact}
- />
- </div>
- </RecordSection>
+ />
</Match>
<Match when={section() === 'emails'}>
<CompanyEmailsSection company={company()} />
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 b84ef46ba6..41beed0542 100644
--- a/apps/web/src/features/crm/views/company-emails-section.tsx
+++ b/apps/web/src/features/crm/views/company-emails-section.tsx
@@ -13,6 +13,7 @@ export function CompanyEmailsSection(props: { company?: CrmCompanyEntity }) {
const domains = createMemo(
() => props.company?.domains.map((domain) => domain.domain) ?? []
);
+ const [search, setSearch] = createSignal('');
const [view, setView] = createSignal<EmailView>('team');
const [signalView, setSignalView] = createSignal<EmailSignalView>('all');
const emailsQuery = useCompanyEmailsQuery(domains, view, signalView);
@@ -29,6 +30,8 @@ export function CompanyEmailsSection(props: { company?: CrmCompanyEntity }) {
return (
<RecordSection
title="Emails"
+ search={search()}
+ onSearchChange={setSearch}
actions={
<>
<TabsInset
@@ -52,6 +55,7 @@ export function CompanyEmailsSection(props: { company?: CrmCompanyEntity }) {
>
<RecordItemList
source={emailsQuery}
+ search={search()}
pending={!props.company}
empty={emptyMessage()}
/>
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 a9fabc7e83..9a51977795 100644
--- a/apps/web/src/features/crm/views/contact-emails-section.tsx
+++ b/apps/web/src/features/crm/views/contact-emails-section.tsx
@@ -11,6 +11,7 @@ import { useContactEmailsQuery } from './use-crm';
export function ContactEmailsSection(props: { contact?: CrmContactResponse }) {
const email = () => props.contact?.email;
+ const [search, setSearch] = createSignal('');
const [view, setView] = createSignal<EmailView>('team');
const [signalView, setSignalView] = createSignal<EmailSignalView>('all');
const emailsQuery = useContactEmailsQuery(email, view, signalView);
@@ -18,6 +19,8 @@ export function ContactEmailsSection(props: { contact?: CrmContactResponse }) {
return (
<RecordSection
title="Emails"
+ search={search()}
+ onSearchChange={setSearch}
actions={
<>
<TabsInset
@@ -41,6 +44,7 @@ export function ContactEmailsSection(props: { contact?: CrmContactResponse }) {
>
<RecordItemList
source={emailsQuery}
+ search={search()}
pending={!props.contact}
empty={`No ${signalView() === 'signal' ? 'signal emails' : 'emails'} with this contact ${view() === 'me' ? 'in your inbox' : 'yet'}.`}
/>
diff --git a/apps/web/src/features/crm/views/record-associations.tsx b/apps/web/src/features/crm/views/record-associations.tsx
index 0303ece0aa..9a542c28ad 100644
--- a/apps/web/src/features/crm/views/record-associations.tsx
+++ b/apps/web/src/features/crm/views/record-associations.tsx
@@ -1,3 +1,4 @@
+import { createSignal } from 'solid-js';
import { RecordSection } from '../components/record-section';
import { useCrmContext } from '../context/crm-context';
import type { CrmRecordScope } from '../core/record';
@@ -8,11 +9,13 @@ import { RecordItemList } from './record-item-list';
* plus attachments of emails exchanged with its people.
*/
export function RecordFilesSection(props: { scope?: CrmRecordScope }) {
+ const [search, setSearch] = createSignal('');
const files = useCrmContext().createRecordFiles(() => props.scope);
return (
- <RecordSection title="Files">
+ <RecordSection title="Files" search={search()} onSearchChange={setSearch}>
<RecordItemList
source={files}
+ search={search()}
pending={!props.scope}
empty={`No files with this ${props.scope?.type ?? 'record'} yet.`}
/>
@@ -25,11 +28,13 @@ export function RecordFilesSection(props: { scope?: CrmRecordScope }) {
* its contacts when the call ended, or referencing it in the call thread.
*/
export function RecordCallsSection(props: { scope?: CrmRecordScope }) {
+ const [search, setSearch] = createSignal('');
const calls = useCrmContext().createRecordCalls(() => props.scope);
return (
- <RecordSection title="Calls">
+ <RecordSection title="Calls" search={search()} onSearchChange={setSearch}>
<RecordItemList
source={calls}
+ search={search()}
pending={!props.scope}
empty={`No calls with this ${props.scope?.type ?? 'record'} yet.`}
/>
diff --git a/apps/web/src/features/crm/views/record-item-list.test.tsx b/apps/web/src/features/crm/views/record-item-list.test.tsx
index c47c817044..fa2c5cf2c0 100644
--- a/apps/web/src/features/crm/views/record-item-list.test.tsx
+++ b/apps/web/src/features/crm/views/record-item-list.test.tsx
@@ -68,3 +68,38 @@ it('keeps loaded rows and retries the page after a failed continuation', () => {
expect(failed.fetchNextPage).toHaveBeenCalledTimes(1);
expect(failed.refetch).not.toHaveBeenCalled();
});
+
+it('searches titles and supporting text without dropping pagination', () => {
+ const list = source({
+ data: {
+ entities: [
+ { id: 'call-1', name: 'Pilot check-in', summary: 'Review adoption' },
+ {
+ id: 'call-2',
+ name: 'Technical deep dive',
+ summary: 'Security review',
+ },
+ ] as never,
+ },
+ hasNextPage: true,
+ });
+ render(() => (
+ <RecordItemList source={list} search=" REVIEW pilot " empty="Nothing" />
+ ));
+
+ screen.getByText('Pilot check-in');
+ expect(screen.queryByText('Technical deep dive')).toBeNull();
+ expect(screen.queryByText('No matching items.')).toBeNull();
+});
+
+it('only declares no search results after the final page', () => {
+ render(() => (
+ <RecordItemList
+ source={source({ hasNextPage: true })}
+ search="missing"
+ empty="Nothing"
+ />
+ ));
+ screen.getByText('Searching more…');
+ expect(screen.queryByText('No matching items.')).toBeNull();
+});
diff --git a/apps/web/src/features/crm/views/record-item-list.tsx b/apps/web/src/features/crm/views/record-item-list.tsx
index 6b434d628b..774a72fc5b 100644
--- a/apps/web/src/features/crm/views/record-item-list.tsx
+++ b/apps/web/src/features/crm/views/record-item-list.tsx
@@ -5,10 +5,19 @@ import {
type NarrowLayoutVariant,
} from '@entity';
import { Button } from '@ui';
-import { createSignal, For, type JSX, Match, Show, Switch } from 'solid-js';
+import {
+ createMemo,
+ createSignal,
+ For,
+ type JSX,
+ Match,
+ Show,
+ Switch,
+} from 'solid-js';
import { useInfiniteScrollSentinel } from '../../../lib/primitives/infinite-scroll-sentinel';
import { useCrmContext } from '../context/crm-context';
import type { ItemListSource } from '../context/crm-sources';
+import { recordItemMatchesSearch } from '../core/record-search';
/**
* One of a CRM record's soup lists (emails, files, calls or references):
@@ -20,6 +29,7 @@ export function RecordItemList(props: {
/** Hold the loading state, e.g. while the record itself loads. */
pending?: boolean;
empty: JSX.Element;
+ search?: string;
/** Row layout when the list is narrow, e.g. in the information panel. */
narrowLayout?: NarrowLayoutVariant;
}) {
@@ -27,6 +37,9 @@ export function RecordItemList(props: {
// Reading `data` before the first page resolves would suspend the tab.
const items = () =>
props.source.isPending ? [] : (props.source.data?.entities ?? []);
+ const filteredItems = createMemo(() =>
+ items().filter((item) => recordItemMatchesSearch(item, props.search ?? ''))
+ );
const [listRef, setListRef] = createSignal<HTMLElement>();
const [sentinelRef, setSentinelRef] = createSignal<HTMLDivElement>();
@@ -63,7 +76,15 @@ export function RecordItemList(props: {
<ListEntityMetadataQueryProvider>
<ListLayoutProvider ref={listRef} narrowLayout={props.narrowLayout}>
<div ref={setListRef} class="flex flex-col">
- <For each={items()}>
+ <Show when={filteredItems().length === 0}>
+ <div class="p-6 text-center text-sm text-ink-muted">
+ {props.source.hasNextPage &&
+ !props.source.isFetchNextPageError
+ ? 'Searching more…'
+ : 'No matching items.'}
+ </div>
+ </Show>
+ <For each={filteredItems()}>
{(entity) => (
<ListEntity
entity={entity}
diff --git a/apps/web/src/features/crm/views/record-row.tsx b/apps/web/src/features/crm/views/record-row.tsx
index 05ec93569a..51ebd63170 100644
--- a/apps/web/src/features/crm/views/record-row.tsx
+++ b/apps/web/src/features/crm/views/record-row.tsx
@@ -82,6 +82,9 @@ export function CrmListRow(
return (
<Entity.Root
+ role={props.role}
+ tabIndex={props.tabIndex}
+ onKeyDown={props.onKeyDown}
entity={props.entity}
onClick={(e) => {
if (e.metaKey && props.onChecked) {
diff --git a/apps/web/src/features/entity/composed/ListEntity.tsx b/apps/web/src/features/entity/composed/ListEntity.tsx
index 01b5120716..b7cdae5cf0 100644
--- a/apps/web/src/features/entity/composed/ListEntity.tsx
+++ b/apps/web/src/features/entity/composed/ListEntity.tsx
@@ -99,6 +99,8 @@ export function ListEntity(props: ListEntityProps) {
const rowActions = children(() => props.actions);
const leadingAction = children(() => props.leadingAction);
const titleLeading = children(() => props.titleLeading);
+ const icon = children(() => props.icon);
+ const titleTrailing = children(() => props.titleTrailing);
const meta = children(() => props.meta);
const scheduleStatus = children(() => props.scheduleStatus);
@@ -159,6 +161,8 @@ export function ListEntity(props: ListEntityProps) {
actions: !isTouchDevice() ? rowActions() : undefined,
leadingAction: !isTouchDevice() ? leadingAction() : undefined,
titleLeading: titleLeading(),
+ icon: icon(),
+ titleTrailing: titleTrailing(),
meta: meta(),
scheduleStatus: scheduleStatus(),
authorDisplayName: props.authorDisplayName,
@@ -206,6 +210,9 @@ export function ListEntity(props: ListEntityProps) {
return (
<Entity.Root
+ role={props.role}
+ tabIndex={props.tabIndex}
+ onKeyDown={props.onKeyDown}
entity={props.entity}
onClick={(e) => {
if (e.metaKey && props.onChecked) {
diff --git a/apps/web/src/features/entity/composed/list-entity/call.tsx b/apps/web/src/features/entity/composed/list-entity/call.tsx
index e2564f190c..f4af4eced4 100644
--- a/apps/web/src/features/entity/composed/list-entity/call.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/call.tsx
@@ -82,7 +82,7 @@ export function CallParticipants(props: {
/>
}
>
- <div class="flex items-center gap-1.5">
+ <div class="flex shrink-0 items-center gap-1.5 whitespace-nowrap">
<Show when={entities().length > 0}>
<UserGroup entities={entities()} maxUsers={2} />
</Show>
diff --git a/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx b/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
index 072925a4fc..5dc80ce282 100644
--- a/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/narrow-condensed-layout.tsx
@@ -34,9 +34,20 @@ export function NarrowCondensedLayout(props: LayoutProps) {
class="ph-no-capture flex min-w-0 items-center gap-2 truncate font-normal"
>
<div class="size-4 shrink-0">
- <Entity.Icon entity={props.entity} streamState={props.streamState} />
+ <Show
+ when={props.icon}
+ fallback={
+ <Entity.Icon
+ entity={props.entity}
+ streamState={props.streamState}
+ />
+ }
+ >
+ {props.icon}
+ </Show>
</div>
<Entity.Title entity={props.entity} />
+ {props.titleTrailing}
<Show when={isChannelEntity(props.entity) && props.entity}>
{(entity) => (
<span class="ml-auto shrink-0 flex items-center">
diff --git a/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx b/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
index baa342450b..13c73133c1 100644
--- a/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/narrow-layout.tsx
@@ -54,7 +54,17 @@ export function NarrowLayout(props: LayoutProps) {
class="ph-no-capture flex items-center gap-2 truncate font-semibold"
>
<div class="size-4 shrink-0">
- <Entity.Icon entity={props.entity} streamState={props.streamState} />
+ <Show
+ when={props.icon}
+ fallback={
+ <Entity.Icon
+ entity={props.entity}
+ streamState={props.streamState}
+ />
+ }
+ >
+ {props.icon}
+ </Show>
</div>
{props.titleLeading}
<Show
@@ -63,6 +73,7 @@ export function NarrowLayout(props: LayoutProps) {
>
{(entity) => <ChannelMessageSingleLine entity={entity()} />}
</Show>
+ {props.titleTrailing}
<Show when={isEmailEntity(props.entity) && props.entity}>
{(entity) => <EmailInboxChip entity={entity()} class="ml-auto" />}
</Show>
diff --git a/apps/web/src/features/entity/composed/list-entity/narrow-single-line-layout.tsx b/apps/web/src/features/entity/composed/list-entity/narrow-single-line-layout.tsx
index 15eb615eeb..39b8278a8f 100644
--- a/apps/web/src/features/entity/composed/list-entity/narrow-single-line-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/narrow-single-line-layout.tsx
@@ -56,7 +56,17 @@ export function NarrowSingleLineLayout(props: LayoutProps) {
class="ph-no-capture flex min-w-0 items-center gap-2 truncate"
>
<div class="size-4 shrink-0">
- <Entity.Icon entity={props.entity} streamState={props.streamState} />
+ <Show
+ when={props.icon}
+ fallback={
+ <Entity.Icon
+ entity={props.entity}
+ streamState={props.streamState}
+ />
+ }
+ >
+ {props.icon}
+ </Show>
</div>
<Switch>
<Match when={isEmailEntity(props.entity) && props.entity}>
@@ -99,6 +109,7 @@ export function NarrowSingleLineLayout(props: LayoutProps) {
</Show>
</Match>
</Switch>
+ {props.titleTrailing}
</Entity.Slot>
<Show
diff --git a/apps/web/src/features/entity/composed/list-entity/shared.tsx b/apps/web/src/features/entity/composed/list-entity/shared.tsx
index 80aea3026c..abb4abfac2 100644
--- a/apps/web/src/features/entity/composed/list-entity/shared.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/shared.tsx
@@ -20,7 +20,11 @@ import type { WithNotification } from '../../types/notification';
import type { ContentHitData, SearchLocation } from '../../types/search';
import { isSearchEntity } from '../../types/search';
-export interface BaseListEntityProps<E extends EntityData = EntityData> {
+export interface BaseListEntityProps<E extends EntityData = EntityData>
+ extends Pick<
+ JSX.HTMLAttributes<HTMLDivElement>,
+ 'role' | 'tabIndex' | 'onKeyDown'
+ > {
entity: WithNotification<E>;
onClick?: (event: MouseEvent) => void;
timestamp?: DateValue | null;
@@ -34,6 +38,10 @@ export interface BaseListEntityProps<E extends EntityData = EntityData> {
leadingAction?: JSX.Element;
/** Caller-owned marker between the icon and the title, e.g. a priority. */
titleLeading?: JSX.Element;
+ /** Caller-owned leading visual inside the standard Soup icon slot. */
+ icon?: JSX.Element;
+ /** Supporting text after the title in the standard content slot. */
+ titleTrailing?: JSX.Element;
/** Caller-owned metadata ahead of the entity's own, in wide rows only. */
meta?: JSX.Element;
hideContentHits?: boolean;
@@ -71,6 +79,10 @@ export interface LayoutProps {
actions?: JSX.Element;
leadingAction?: JSX.Element;
titleLeading?: JSX.Element;
+ /** Caller-owned leading visual inside the standard Soup icon slot. */
+ icon?: JSX.Element;
+ /** Supporting text after the title in the standard content slot. */
+ titleTrailing?: JSX.Element;
meta?: JSX.Element;
checked?: boolean;
authorDisplayName?: string;
diff --git a/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx b/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
index 5a0845c352..1354c9f6f4 100644
--- a/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
@@ -129,7 +129,17 @@ export function WideLayout(props: LayoutProps) {
)}
>
<div class="size-4 shrink-0">
- <Entity.Icon entity={props.entity} streamState={props.streamState} />
+ <Show
+ when={props.icon}
+ fallback={
+ <Entity.Icon
+ entity={props.entity}
+ streamState={props.streamState}
+ />
+ }
+ >
+ {props.icon}
+ </Show>
</div>
{props.titleLeading}
<Switch>
@@ -183,6 +193,7 @@ export function WideLayout(props: LayoutProps) {
{(entity) => <Entity.Title entity={entity()} />}
</Match>
</Switch>
+ {props.titleTrailing}
</Entity.Slot>
<Entity.Slot
placement="meta"
@@ -295,7 +306,7 @@ export function WideLayout(props: LayoutProps) {
/>
)}
</Show>
- <span class="flex w-10 shrink-0 justify-end">
+ <span class="flex min-w-10 shrink-0 justify-end">
<CallParticipants
participantIds={entity().participantIds}
guests={entity().guests}
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 65dd77fce5..09c25dc25d 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -2075,6 +2075,19 @@ 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, and Calls 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.
+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,
+the last-contacted timestamp sits at the right, and the side gutters and row
+spacing match. There is no column-heading row.
+Emails, Files, and Calls search the loaded row titles and supporting text and
+continue loading pages when the current pages have no match.
+
A company is laid out like a project. Its split header or embedded breadcrumb
header shows inset `Overview`, `Team`, `Emails`, `Files`, `Tasks`, and `Calls`
tabs, collapsing to icons when narrow. Overview shows the name, pills