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.

feat(crm): restyle creation dialogs to match the entity composer (#7798)

teoefd2ac4b24e5
diff --git a/apps/web/src/features/crm/browser-test/pipelines.browser.e2e.ts b/apps/web/src/features/crm/browser-test/pipelines.browser.e2e.ts
index 0a3d73fb3e..2b58990ae3 100644
--- a/apps/web/src/features/crm/browser-test/pipelines.browser.e2e.ts
+++ b/apps/web/src/features/crm/browser-test/pipelines.browser.e2e.ts
@@ -11,7 +11,9 @@ test('create a private company pipeline and customize a column', async ({
await page.goto(fixture, { waitUntil: 'domcontentloaded' });
await page.getByRole('button', { name: 'New pipeline', exact: true }).click();
const dialog = page.getByRole('dialog');
- await expect(dialog.getByRole('radio', { name: 'Just me' })).toBeChecked();
+ await expect(
+ dialog.getByRole('checkbox', { name: 'Share with my team' })
+ ).not.toBeChecked();
await dialog.getByRole('textbox', { name: 'Pipeline name' }).fill('Renewals');
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
@@ -56,16 +58,20 @@ test('contact pipeline preserves choices after a failed create', async ({
await dialog
.getByRole('textbox', { name: 'Pipeline name' })
.fill('Recruiting');
- await dialog.getByRole('radio', { name: 'Contacts', exact: true }).check();
- await dialog.getByRole('radio', { name: 'My team' }).check();
+ await dialog.getByRole('button', { name: 'Track Companies' }).click();
+ await page.getByRole('menuitemradio', { name: 'Contacts' }).click();
+ await dialog.getByText('Share with my team').click();
+ await expect(
+ dialog.getByRole('checkbox', { name: 'Share with my team' })
+ ).toBeChecked();
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog.getByRole('alert')).toBeVisible();
await expect(
dialog.getByRole('textbox', { name: 'Pipeline name' })
).toHaveValue('Recruiting');
await expect(
- dialog.getByRole('radio', { name: 'Contacts', exact: true })
- ).toBeChecked();
+ dialog.getByRole('button', { name: 'Track Contacts' })
+ ).toBeVisible();
await dialog.getByRole('button', { name: 'Create pipeline' }).click();
await expect(dialog).not.toBeVisible();
await expect(
diff --git a/apps/web/src/features/crm/components/company-select.tsx b/apps/web/src/features/crm/components/company-select.tsx
index 82ed06a49a..f09d8d9757 100644
--- a/apps/web/src/features/crm/components/company-select.tsx
+++ b/apps/web/src/features/crm/components/company-select.tsx
@@ -4,7 +4,7 @@ import BuildingsIcon from '@phosphor/buildings.svg';
import CaretDownIcon from '@phosphor/caret-down.svg';
import CheckIcon from '@phosphor/check.svg';
import SearchIcon from '@phosphor/magnifying-glass.svg';
-import { Layer } from '@ui';
+import { badgeTriggerClasses, Layer } from '@ui';
import { type Accessor, createSignal, Show } from 'solid-js';
import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';
@@ -66,10 +66,9 @@ export function CompanySelect(props: {
value: CompanyOption | undefined;
onChange: (company: CompanyOption) => void;
loading: boolean;
- /** Mount the menu in the nearest portal scope, e.g. inside a modal dialog. */
- portalScope?: 'local';
+ /** Mount the menu here, e.g. a modal dialog's content, which hides body portals. */
+ mount?: HTMLElement;
}) {
- let trigger: HTMLButtonElement | undefined;
const [search, setSearch] = createSignal('');
const matches = (option: CompanyOption, query: string) =>
option.name.toLowerCase().includes(query) ||
@@ -96,27 +95,33 @@ export function CompanySelect(props: {
virtualized
allowsEmptyCollection
placement="bottom-start"
- sameWidth
gutter={4}
>
<Combobox.Control>
<Combobox.Trigger
- ref={trigger}
id={props.id}
type="button"
- class="flex h-9 w-full min-w-0 items-center gap-2 rounded-lg border border-edge-muted px-3 text-left text-sm text-ink outline-none focus-visible:border-edge"
+ // Kobalte's default name is "Show suggestions".
+ aria-label={
+ props.value ? `Company: ${props.value.name}` : 'Choose a company'
+ }
+ class={badgeTriggerClasses({
+ variant: 'outline',
+ size: 'sm',
+ class: 'max-w-full min-w-0 text-left',
+ })}
>
- <BuildingsIcon class="size-4 shrink-0 text-ink-placeholder" />
+ <BuildingsIcon class="size-3 shrink-0" />
<Show
when={props.value}
fallback={
- <span class="flex-1 truncate text-ink-placeholder">
+ <span class="truncate text-ink-extra-muted">
{props.loading ? 'Loading companies…' : 'Choose a company'}
</span>
}
>
{(company) => (
- <span class="flex min-w-0 flex-1 items-baseline gap-2">
+ <span class="flex min-w-0 items-baseline gap-1.5">
<span class="truncate">{company().name}</span>
<span class="truncate text-xs text-ink-extra-muted">
{company().domain}
@@ -127,15 +132,9 @@ export function CompanySelect(props: {
<CaretDownIcon class="size-3 shrink-0 text-ink-muted" />
</Combobox.Trigger>
</Combobox.Control>
- <Combobox.Portal
- mount={
- props.portalScope === 'local'
- ? (trigger?.closest<HTMLElement>('.portal-scope') ?? undefined)
- : undefined
- }
- >
+ <Combobox.Portal mount={props.mount}>
<Layer depth={2}>
- <Combobox.Content class="z-action-menu overflow-hidden rounded-xl border border-edge-muted bg-surface shadow-md">
+ <Combobox.Content class="z-action-menu w-72 overflow-hidden rounded-xl border border-edge-muted bg-surface shadow-md">
<div class="flex items-center gap-2 border-b border-edge-muted px-3 py-2">
<SearchIcon class="size-3.5 shrink-0 text-ink-muted" />
<Combobox.Input
diff --git a/apps/web/src/features/crm/components/pipeline-dialog.tsx b/apps/web/src/features/crm/components/pipeline-dialog.tsx
index 1f4f4bad45..807ab6c315 100644
--- a/apps/web/src/features/crm/components/pipeline-dialog.tsx
+++ b/apps/web/src/features/crm/components/pipeline-dialog.tsx
@@ -1,7 +1,18 @@
-import { Button, Dialog, Panel } from '@ui';
-import { createSignal, Show } from 'solid-js';
+import BuildingsIcon from '@phosphor/buildings.svg';
+import CaretDownIcon from '@phosphor/caret-down.svg';
+import CheckIcon from '@phosphor/check.svg';
+import UsersIcon from '@phosphor/users.svg';
+import XIcon from '@phosphor/x.svg';
+import { Button, Checkbox, Dialog, Dropdown, EntityComposer, Panel } from '@ui';
+import { createSignal, For, Show } from 'solid-js';
+import { Dynamic } from 'solid-js/web';
import type { NewPipeline } from '../core/pipeline';
+const RECORD_TYPES = [
+ { value: 'company', label: 'Companies', icon: BuildingsIcon },
+ { value: 'contact', label: 'Contacts', icon: UsersIcon },
+] as const;
+
/** One creation session; cancel preserves existing CRM data. */
export function PipelineDialog(props: {
onCreate(input: NewPipeline): Promise<void>;
@@ -10,11 +21,13 @@ export function PipelineDialog(props: {
const [name, setName] = createSignal('');
const [recordType, setRecordType] =
createSignal<NewPipeline['recordType']>('company');
- const [sharing, setSharing] = createSignal<NewPipeline['sharing']>('private');
+ const [shareWithTeam, setShareWithTeam] = createSignal(false);
const [pending, setPending] = createSignal(false);
const [error, setError] = createSignal(false);
- async function submit(event: SubmitEvent) {
- event.preventDefault();
+ const tracked = () =>
+ RECORD_TYPES.find((type) => type.value === recordType()) ?? RECORD_TYPES[0];
+ const close = () => !pending() && props.onClose();
+ async function submit() {
if (pending() || !name().trim()) return;
setPending(true);
setError(false);
@@ -22,7 +35,7 @@ export function PipelineDialog(props: {
await props.onCreate({
name: name().trim(),
recordType: recordType(),
- sharing: sharing(),
+ sharing: shareWithTeam() ? 'team' : 'private',
});
props.onClose();
} catch {
@@ -32,95 +45,128 @@ export function PipelineDialog(props: {
}
}
return (
- <Dialog
- open
- onOpenChange={(open) => !open && !pending() && props.onClose()}
- class="w-112 max-w-[calc(100vw-2rem)]"
- >
- <Panel>
+ <Dialog open onOpenChange={(open) => !open && close()}>
+ <Panel hideBorder class="bg-transparent rounded-[inherit] *:max-h-[75vh]">
<Panel.Body>
- <form onSubmit={submit} class="flex flex-col gap-4 p-5">
- <Dialog.Title class="text-base font-semibold">
- New pipeline
- </Dialog.Title>
- <Dialog.Description class="text-sm text-ink-muted">
- Track companies or contacts with columns you can customize.
- </Dialog.Description>
- <label class="flex flex-col gap-1.5 text-sm">
- Pipeline name
- <input
- required
- maxlength={200}
- value={name()}
- onInput={(event) => setName(event.currentTarget.value)}
- disabled={pending()}
- placeholder="e.g. Design partners"
- class="rounded-lg border border-edge-muted bg-input px-3 py-2 outline-none focus:border-accent"
- />
- </label>
- <fieldset disabled={pending()} class="flex flex-col gap-2 text-sm">
- <legend class="mb-2 font-medium">Track</legend>
- <label class="flex items-center gap-2">
- <input
- type="radio"
- name="recordType"
- checked={recordType() === 'company'}
- onChange={() => setRecordType('company')}
- />
- Companies
- </label>
- <label class="flex items-center gap-2">
- <input
- type="radio"
- name="recordType"
- checked={recordType() === 'contact'}
- onChange={() => setRecordType('contact')}
- />
- Contacts
- </label>
- </fieldset>
- <fieldset disabled={pending()} class="flex flex-col gap-2 text-sm">
- <legend class="mb-2 font-medium">Share with</legend>
- <label class="flex items-center gap-2">
- <input
- type="radio"
- name="sharing"
- checked={sharing() === 'private'}
- onChange={() => setSharing('private')}
- />
- Just me
- </label>
- <label class="flex items-center gap-2">
- <input
- type="radio"
- name="sharing"
- checked={sharing() === 'team'}
- onChange={() => setSharing('team')}
- />
- My team
- </label>
- <p class="text-xs text-ink-muted">
- You can change sharing later. Team members can edit shared
- pipelines.
- </p>
- </fieldset>
- <Show when={error()}>
- <p role="alert" class="text-sm text-failure-ink">
- Could not create this pipeline. Please try again.
- </p>
- </Show>
- <div class="flex justify-end gap-2">
- <Button
- variant="ghost"
- disabled={pending()}
- onClick={props.onClose}
- >
- Cancel
- </Button>
- <Button type="submit" disabled={pending() || !name().trim()}>
- {pending() ? 'Creating…' : 'Create pipeline'}
- </Button>
- </div>
+ <form
+ class="h-full min-h-0"
+ aria-label="New pipeline"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void submit();
+ }}
+ onKeyDown={(event) => {
+ if (
+ event.key === 'Enter' &&
+ (event.metaKey || event.ctrlKey) &&
+ !event.isComposing
+ ) {
+ event.preventDefault();
+ event.stopPropagation();
+ void submit();
+ }
+ }}
+ >
+ <EntityComposer.Root>
+ <EntityComposer.Header>
+ <Dialog.Title class="sr-only">New pipeline</Dialog.Title>
+ <EntityComposer.Title class="mb-0 min-w-0 flex-1 self-center">
+ <input
+ autofocus
+ aria-label="Pipeline name"
+ placeholder="Pipeline name"
+ maxlength={200}
+ required
+ class="ph-no-capture w-full min-w-0 text-xl/7 font-medium outline-none bg-transparent placeholder:text-ink-placeholder"
+ value={name()}
+ disabled={pending()}
+ onInput={(event) => setName(event.currentTarget.value)}
+ />
+ </EntityComposer.Title>
+ <Button
+ tabIndex={-1}
+ aria-label="Close"
+ tooltip="Close"
+ size="icon-composer"
+ disabled={pending()}
+ onClick={close}
+ >
+ <XIcon />
+ </Button>
+ </EntityComposer.Header>
+ <EntityComposer.Main class="gap-4">
+ <EntityComposer.Properties class="px-2">
+ <Dropdown placement="bottom-start">
+ <Dropdown.Trigger
+ aria-label={`Track ${tracked().label}`}
+ class="rounded-full"
+ disabled={pending()}
+ >
+ <Dynamic
+ component={tracked().icon}
+ class="size-3 shrink-0"
+ />
+ {tracked().label}
+ <CaretDownIcon class="size-3 shrink-0 text-ink-muted" />
+ </Dropdown.Trigger>
+ <Dropdown.Content class="min-w-40">
+ <Dropdown.Group>
+ <Dropdown.GroupLabel>Track</Dropdown.GroupLabel>
+ <Dropdown.RadioGroup
+ value={recordType()}
+ onChange={(value) =>
+ setRecordType(value as NewPipeline['recordType'])
+ }
+ >
+ <For each={RECORD_TYPES}>
+ {(type) => (
+ <Dropdown.RadioItem
+ value={type.value}
+ closeOnSelect
+ >
+ <Dynamic
+ component={type.icon}
+ class="size-4 shrink-0"
+ />
+ <span class="flex-1">{type.label}</span>
+ <Dropdown.ItemIndicator>
+ <CheckIcon class="size-3.5 text-accent" />
+ </Dropdown.ItemIndicator>
+ </Dropdown.RadioItem>
+ )}
+ </For>
+ </Dropdown.RadioGroup>
+ </Dropdown.Group>
+ </Dropdown.Content>
+ </Dropdown>
+ </EntityComposer.Properties>
+ </EntityComposer.Main>
+ <Show when={error()}>
+ <p role="alert" class="px-2 text-sm text-failure">
+ Could not create this pipeline. Please try again.
+ </p>
+ </Show>
+ <EntityComposer.Footer class="items-center">
+ <Checkbox
+ checked={shareWithTeam()}
+ disabled={pending()}
+ onChange={setShareWithTeam}
+ >
+ <Checkbox.Control />
+ <Checkbox.Label class="text-xs text-ink-muted font-normal whitespace-nowrap">
+ Share with my team
+ </Checkbox.Label>
+ </Checkbox>
+ <EntityComposer.Submit
+ type="submit"
+ class="ml-auto"
+ hasContent={Boolean(name().trim())}
+ disabled={pending() || !name().trim()}
+ >
+ {pending() ? 'Creating…' : 'Create pipeline'}
+ </EntityComposer.Submit>
+ </EntityComposer.Footer>
+ </EntityComposer.Root>
</form>
</Panel.Body>
</Panel>
diff --git a/apps/web/src/features/crm/views/create-company.tsx b/apps/web/src/features/crm/views/create-company.tsx
index fb2cca27f5..af6df6a448 100644
--- a/apps/web/src/features/crm/views/create-company.tsx
+++ b/apps/web/src/features/crm/views/create-company.tsx
@@ -1,8 +1,8 @@
-import { isMobile } from '@core/mobile/isMobile';
import { ThrownResultError } from '@core/util/result';
-import BuildingsIcon from '@phosphor/buildings.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
+import GlobeIcon from '@phosphor/globe.svg';
import XIcon from '@phosphor/x.svg';
-import { Button, Dialog, Panel } from '@ui';
+import { Button, Dialog, EntityComposer, Panel } from '@ui';
import { createMemo, createSignal, Show } from 'solid-js';
import { useCreateCompanyMutation } from './use-crm';
@@ -56,8 +56,8 @@ export function CreateCompanyModal(props: {
resetAndClose();
}
- async function handleSubmit(event: SubmitEvent) {
- event.preventDefault();
+ async function submit() {
+ if (createCompanyMutation.isPending) return;
if (!companyName()) {
setError('Enter a company name');
return;
@@ -82,108 +82,110 @@ export function CreateCompanyModal(props: {
}
return (
- <Dialog
- open={props.open}
- onOpenChange={(open) => !open && close()}
- class="w-120"
- >
- <Panel
- depth={2}
- hideBorder={isMobile()}
- class="rounded-xl touch:h-auto *:max-h-[75vh]"
- >
+ <Dialog open={props.open} onOpenChange={(open) => !open && close()}>
+ <Panel hideBorder class="bg-transparent rounded-[inherit] *:max-h-[75vh]">
<Panel.Body>
- <form class="flex flex-col gap-4 p-5" onSubmit={handleSubmit}>
- <Dialog.CloseButton
- as={Button}
- size="icon-sm"
- label="Close"
- aria-label="Close company creation"
- class="self-end"
- tabIndex={-1}
- disabled={createCompanyMutation.isPending}
- >
- <XIcon />
- </Dialog.CloseButton>
-
- <div class="flex flex-col gap-4">
- <div class="flex items-center gap-2 px-2">
- <Dialog.Title class="sr-only">Create a company</Dialog.Title>
- <label for="new-company-name" class="sr-only">
- Name
- </label>
- <BuildingsIcon
- aria-hidden="true"
- class="size-5 shrink-0 text-ink-placeholder"
- />
- <input
- id="new-company-name"
- type="text"
- value={name()}
- onInput={(event) => {
- setName(event.currentTarget.value);
- setError(undefined);
- }}
- placeholder="Company name"
- autocomplete="off"
- data-1p-ignore
- aria-invalid={error() === 'Enter a company name'}
- class="h-10 w-full border-none bg-transparent px-0 text-xl font-medium text-ink outline-none placeholder:text-ink-placeholder focus:ring-0"
- />
- </div>
-
- <div class="flex flex-col gap-2 px-2">
- <label
- for="new-company-domain"
- class="text-xs font-medium text-ink-muted"
+ <form
+ class="h-full min-h-0"
+ aria-label="New company"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void submit();
+ }}
+ onKeyDown={(event) => {
+ if (
+ event.key === 'Enter' &&
+ (event.metaKey || event.ctrlKey) &&
+ !event.isComposing
+ ) {
+ event.preventDefault();
+ event.stopPropagation();
+ void submit();
+ }
+ }}
+ >
+ <EntityComposer.Root>
+ <EntityComposer.Header>
+ <Dialog.Title class="sr-only">New company</Dialog.Title>
+ <EntityComposer.Title class="mb-0 min-w-0 flex-1 self-center">
+ <input
+ autofocus
+ aria-label="Company name"
+ placeholder="Company name"
+ autocomplete="off"
+ data-1p-ignore
+ aria-invalid={error() === 'Enter a company name'}
+ class="ph-no-capture w-full min-w-0 text-xl/7 font-medium outline-none bg-transparent placeholder:text-ink-placeholder"
+ value={name()}
+ disabled={createCompanyMutation.isPending}
+ onInput={(event) => {
+ setName(event.currentTarget.value);
+ setError(undefined);
+ }}
+ />
+ </EntityComposer.Title>
+ <Button
+ tabIndex={-1}
+ aria-label="Close"
+ tooltip="Close"
+ size="icon-composer"
+ disabled={createCompanyMutation.isPending}
+ onClick={close}
>
- Domain
+ <XIcon />
+ </Button>
+ </EntityComposer.Header>
+ <EntityComposer.Main class="gap-4">
+ <label class="flex min-w-0 items-center gap-2 px-2 text-sm">
+ <GlobeIcon
+ aria-hidden="true"
+ class="size-4 shrink-0 text-ink-muted"
+ />
+ <input
+ aria-label="Domain"
+ placeholder="Domain, like acme.com"
+ autocomplete="off"
+ spellcheck={false}
+ data-1p-ignore
+ aria-invalid={
+ error() === 'Enter a valid domain like acme.com'
+ }
+ class="ph-no-capture w-full min-w-0 bg-transparent text-ink outline-none placeholder:text-ink-placeholder"
+ value={domain()}
+ disabled={createCompanyMutation.isPending}
+ onInput={(event) => {
+ setDomain(event.currentTarget.value);
+ setError(undefined);
+ }}
+ />
</label>
- <input
- id="new-company-domain"
- type="text"
- value={domain()}
- onInput={(event) => {
- setDomain(event.currentTarget.value);
- setError(undefined);
- }}
- placeholder="acme.com"
- autocomplete="off"
- spellcheck={false}
- data-1p-ignore
- aria-invalid={
- error() === 'Enter a valid domain like acme.com'
- }
- class="h-9 w-full rounded-lg border border-edge-muted bg-transparent px-3 text-sm text-ink outline-none placeholder:text-ink-placeholder focus:border-edge"
- />
- <span class="text-xs text-ink-extra-muted">
- Emails with this domain will be linked to the company.
- </span>
- </div>
- </div>
-
- <Show when={error()}>
- {(message) => (
- <div class="border-y border-edge-muted p-2">
- <div class="px-3 py-2 text-sm text-failure-ink" role="alert">
+ </EntityComposer.Main>
+ <Show when={error()}>
+ {(message) => (
+ <p role="alert" class="px-2 text-sm text-failure">
{message()}
- </div>
- </div>
- )}
- </Show>
-
- <div class="flex shrink-0 items-end justify-end gap-2">
- <Button
- type="submit"
- variant="strong"
- depth={3}
- disabled={!canSubmit()}
- >
- {createCompanyMutation.isPending
- ? 'Creating…'
- : 'Create Company'}
- </Button>
- </div>
+ </p>
+ )}
+ </Show>
+ <EntityComposer.Footer class="items-center">
+ <span class="flex min-w-0 items-center gap-1.5 px-2 text-xs text-ink-muted">
+ <EnvelopeIcon class="size-4 shrink-0" />
+ <span class="truncate">
+ Emails from this domain link to the company
+ </span>
+ </span>
+ <EntityComposer.Submit
+ type="submit"
+ class="ml-auto"
+ hasContent={canSubmit()}
+ disabled={!canSubmit()}
+ >
+ {createCompanyMutation.isPending
+ ? 'Creating…'
+ : 'Create Company'}
+ </EntityComposer.Submit>
+ </EntityComposer.Footer>
+ </EntityComposer.Root>
</form>
</Panel.Body>
</Panel>
diff --git a/apps/web/src/features/crm/views/create-contact.tsx b/apps/web/src/features/crm/views/create-contact.tsx
index 9d0036a09f..93269159ae 100644
--- a/apps/web/src/features/crm/views/create-contact.tsx
+++ b/apps/web/src/features/crm/views/create-contact.tsx
@@ -1,7 +1,7 @@
import { ThrownResultError } from '@core/util/result';
-import UserPlusIcon from '@phosphor/user-plus.svg';
+import EnvelopeIcon from '@phosphor/envelope.svg';
import XIcon from '@phosphor/x.svg';
-import { Button, Dialog, Panel } from '@ui';
+import { Button, Dialog, EntityComposer, Panel } from '@ui';
import { createMemo, createSignal, Show } from 'solid-js';
import {
type CompanyOption,
@@ -29,6 +29,7 @@ function createErrorMessage(cause: unknown): string {
/** Companies without a domain cannot hold contacts, whose emails must match one. */
function ContactCompanySelect(props: {
+ mount: HTMLElement | undefined;
value: CompanyOption | undefined;
onChange: (company: CompanyOption) => void;
}) {
@@ -53,7 +54,7 @@ function ContactCompanySelect(props: {
value={props.value}
onChange={props.onChange}
loading={suggestions.query.isLoading}
- portalScope="local"
+ mount={props.mount}
/>
);
}
@@ -68,6 +69,8 @@ export function CreateContactModal(props: {
const [name, setName] = createSignal('');
const [localPart, setLocalPart] = createSignal('');
const [pickedCompany, setPickedCompany] = createSignal<CompanyOption>();
+ // The panel clips overflow, so the company menu mounts on the dialog itself.
+ const [dialog, setDialog] = createSignal<HTMLElement>();
const [error, setError] = createSignal<string>();
const company = () => {
const picked = pickedCompany();
@@ -116,8 +119,8 @@ export function CreateContactModal(props: {
setError(undefined);
}
- async function handleSubmit(event: SubmitEvent) {
- event.preventDefault();
+ async function submit() {
+ if (createContactMutation.isPending) return;
const target = company();
if (!target) {
setError('Choose a company');
@@ -151,119 +154,121 @@ export function CreateContactModal(props: {
<Dialog
open={props.target !== undefined}
onOpenChange={(open) => !open && close()}
- class="w-120"
+ contentRef={(element) => setDialog(element)}
>
- <Panel depth={2} class="rounded-xl *:max-h-[75vh]">
+ <Panel hideBorder class="bg-transparent rounded-[inherit] *:max-h-[75vh]">
<Panel.Body>
- <form class="flex flex-col gap-4 p-5" onSubmit={handleSubmit}>
- <div class="flex items-center gap-1">
- <div class="flex-1" />
- <Dialog.CloseButton
- as={Button}
- size="icon-sm"
- label="Close"
- tabIndex={-1}
- disabled={createContactMutation.isPending}
- >
- <XIcon />
- </Dialog.CloseButton>
- </div>
-
- <div class="flex flex-col gap-4">
- <div class="flex items-center gap-2 px-2">
- <Dialog.Title class="sr-only">Add a contact</Dialog.Title>
- <label for="new-contact-name" class="sr-only">
- Name
- </label>
- <UserPlusIcon
- aria-hidden="true"
- class="size-5 shrink-0 text-ink-placeholder"
- />
- <input
- id="new-contact-name"
- type="text"
- value={name()}
- onInput={(event) => {
- setName(event.currentTarget.value);
- setError(undefined);
- }}
- placeholder="Contact name"
- autocomplete="off"
- data-1p-ignore
- aria-invalid={error() === 'Enter a name'}
- class="h-10 w-full border-none bg-transparent px-0 text-xl font-medium text-ink outline-none placeholder:text-ink-placeholder focus:ring-0"
- />
- </div>
-
- <Show when={!props.target?.company}>
- <div class="flex flex-col gap-2 px-2">
- <label
- for="new-contact-company"
- class="text-xs font-medium text-ink-muted"
- >
- Company
- </label>
- <ContactCompanySelect
- value={pickedCompany()}
- onChange={(picked) => {
- setPickedCompany(picked);
+ <form
+ class="h-full min-h-0"
+ aria-label="New contact"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void submit();
+ }}
+ onKeyDown={(event) => {
+ if (
+ event.key === 'Enter' &&
+ (event.metaKey || event.ctrlKey) &&
+ !event.isComposing
+ ) {
+ event.preventDefault();
+ event.stopPropagation();
+ void submit();
+ }
+ }}
+ >
+ <EntityComposer.Root>
+ <EntityComposer.Header>
+ <Dialog.Title class="sr-only">New contact</Dialog.Title>
+ <EntityComposer.Title class="mb-0 min-w-0 flex-1 self-center">
+ <input
+ autofocus
+ aria-label="Contact name"
+ placeholder="Contact name"
+ autocomplete="off"
+ data-1p-ignore
+ aria-invalid={error() === 'Enter a name'}
+ class="ph-no-capture w-full min-w-0 text-xl/7 font-medium outline-none bg-transparent placeholder:text-ink-placeholder"
+ value={name()}
+ disabled={createContactMutation.isPending}
+ onInput={(event) => {
+ setName(event.currentTarget.value);
setError(undefined);
}}
/>
- </div>
- </Show>
-
- <div class="flex flex-col gap-2 px-2">
- <label
- for="new-contact-email"
- class="text-xs font-medium text-ink-muted"
+ </EntityComposer.Title>
+ <Button
+ tabIndex={-1}
+ aria-label="Close"
+ tooltip="Close"
+ size="icon-composer"
+ disabled={createContactMutation.isPending}
+ onClick={close}
>
- Email
- </label>
- <div class="flex h-9 w-full items-center rounded-lg border border-edge-muted focus-within:border-edge">
- <input
- id="new-contact-email"
- type="text"
- value={localPart()}
- onInput={(event) =>
- handleLocalPartInput(event.currentTarget.value)
- }
- placeholder="jane"
- autocomplete="off"
- spellcheck={false}
- data-1p-ignore
- aria-invalid={
- error() === 'Enter the part of the email before the @'
- }
- class="h-full min-w-0 flex-1 border-none bg-transparent pl-3 text-sm text-ink outline-none placeholder:text-ink-placeholder focus:ring-0"
+ <XIcon />
+ </Button>
+ </EntityComposer.Header>
+ <EntityComposer.Main class="gap-4">
+ <label class="flex min-w-0 items-center gap-2 px-2 text-sm">
+ <EnvelopeIcon
+ aria-hidden="true"
+ class="size-4 shrink-0 text-ink-muted"
/>
- <span class="shrink-0 select-none pr-3 pl-0.5 text-sm text-ink-placeholder">
- @{company()?.domain ?? 'company domain'}
+ <span class="flex min-w-0 items-center">
+ <input
+ aria-label="Email"
+ placeholder="jane"
+ autocomplete="off"
+ spellcheck={false}
+ data-1p-ignore
+ aria-invalid={
+ error() === 'Enter the part of the email before the @'
+ }
+ class="ph-no-capture field-sizing-content max-w-full bg-transparent text-ink outline-none placeholder:text-ink-placeholder"
+ value={localPart()}
+ disabled={createContactMutation.isPending}
+ onInput={(event) =>
+ handleLocalPartInput(event.currentTarget.value)
+ }
+ />
+ <span class="shrink-0 select-none text-ink-muted">
+ @{company()?.domain ?? 'company domain'}
+ </span>
</span>
- </div>
- </div>
- </div>
-
- <Show when={error()}>
- {(message) => (
- <div class="border-y border-edge-muted p-2">
- <div class="px-3 py-2 text-sm text-failure-ink" role="alert">
+ </label>
+ <Show when={!props.target?.company}>
+ <EntityComposer.Properties class="px-2">
+ <ContactCompanySelect
+ mount={dialog()}
+ value={pickedCompany()}
+ onChange={(picked) => {
+ setPickedCompany(picked);
+ setError(undefined);
+ }}
+ />
+ </EntityComposer.Properties>
+ </Show>
+ </EntityComposer.Main>
+ <Show when={error()}>
+ {(message) => (
+ <p role="alert" class="px-2 text-sm text-failure">
{message()}
- </div>
- </div>
- )}
- </Show>
-
- <div class="flex shrink-0 items-end justify-end gap-2">
- <Button
- type="submit"
- variant="strong"
- depth={3}
- disabled={!canSubmit()}
- >
- {createContactMutation.isPending ? 'Adding…' : 'Add Contact'}
- </Button>
- </div>
+ </p>
+ )}
+ </Show>
+ <EntityComposer.Footer class="items-center">
+ <EntityComposer.Submit
+ type="submit"
+ class="ml-auto"
+ hasContent={canSubmit()}
+ disabled={!canSubmit()}
+ >
+ {createContactMutation.isPending
+ ? 'Creating…'
+ : 'Create Contact'}
+ </EntityComposer.Submit>
+ </EntityComposer.Footer>
+ </EntityComposer.Root>
</form>
</Panel.Body>
</Panel>
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index a4ac805449..f3b81df89d 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1896,9 +1896,12 @@ and contacts under hidden companies are excluded. Columns are Person (name and
email), Company and Last contacted (sortable). `Search people` matches name or
email on the server after a short typing pause, so results include contacts not
yet scrolled into view. **New contact** sits at the right end of the toolbar. Its
-dialog asks for a company (searchable by name or domain, from the up to 500 most
-relevant companies with a domain) and fixes the email to that company's primary
-domain; **Add contact** on a company's Team tab skips the company field.
+dialog asks for a company through a **Choose a company** pill (searchable by name
+or domain, from the up to 500 most relevant companies with a domain) and fixes
+the email to that company's primary domain; **Add contact** on a company's Team
+tab skips the company pill. The company, contact and pipeline dialogs share the
+task/project composer layout: name on the first row beside **Close**, details
+below, and a **Create …** button that also submits on Command-Enter.
`Search companies` and `Search people` use the shared Email/Tasks search bar.
Command-F focuses it, `Clear search` resets it, and Escape leaves the field.
@@ -1971,8 +1974,10 @@ storage does not appear as a separate database in navigation.
use **Open CRM settings** in the empty state to enable CRM, then return to
Customers to create a pipeline. Verify this with a newly created team as well as
an existing CRM-enabled team.
-Choose **New pipeline**, enter a name, choose **Companies** or **Contacts**, and
-choose **Just me** (the default) or **My team**. Creating opens the pipeline's
+Choose **New pipeline**, enter a name in the dialog's first row, pick
+**Companies** (the default) or **Contacts** from the record-type pill, and tick
+**Share with my team** to share it (unticked keeps it private). **Create
+pipeline** or Command-Enter submits. Creating opens the pipeline's
editable table. Team members can edit shared pipelines; the creator owns them
and can change access later through the standard **Share** dialog. Under
**Team access**, choose **Edit** to share with the team or **None** to make the