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): make the record page's Pipelines section collapsible (#8014)

teo2eef5d281721
diff --git a/apps/web/src/features/crm/components/pipeline-entry-cards.test.tsx b/apps/web/src/features/crm/components/pipeline-entry-cards.test.tsx
index 7b92520570..2028b92f5b 100644
--- a/apps/web/src/features/crm/components/pipeline-entry-cards.test.tsx
+++ b/apps/web/src/features/crm/components/pipeline-entry-cards.test.tsx
@@ -59,6 +59,25 @@ it('shows each pipeline row as a card that collapses past four fields', () => {
).not.toContain('more');
});
+it('collapses and expands the section from its header', () => {
+ render(() => (
+ <PipelineEntryCards
+ entries={[entry('Sales', true, ['Stage']), entry('Partners', true, [])]}
+ renderCell={(_, cell) => cell().value}
+ />
+ ));
+ const toggle = screen.getByRole('button', { name: 'Pipelines' });
+ expect(toggle.getAttribute('aria-expanded')).toBe('true');
+ expect(screen.getAllByRole('article')).toHaveLength(2);
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute('aria-expanded')).toBe('false');
+ expect(screen.queryAllByRole('article')).toHaveLength(0);
+ expect(screen.getByRole('region', { name: 'Pipelines' })).toBeTruthy();
+ fireEvent.click(toggle);
+ expect(toggle.getAttribute('aria-expanded')).toBe('true');
+ expect(screen.getAllByRole('article')).toHaveLength(2);
+});
+
it('opens a card’s pipeline when the host can show it', () => {
const onOpenPipeline = vi.fn();
render(() => (
diff --git a/apps/web/src/features/crm/components/pipeline-entry-cards.tsx b/apps/web/src/features/crm/components/pipeline-entry-cards.tsx
index 91cffbfc7f..2ae6bd17f3 100644
--- a/apps/web/src/features/crm/components/pipeline-entry-cards.tsx
+++ b/apps/web/src/features/crm/components/pipeline-entry-cards.tsx
@@ -1,4 +1,6 @@
import ArrowUpRightIcon from '@phosphor/arrow-up-right.svg';
+import CaretDownIcon from '@phosphor/caret-down.svg';
+import CaretRightIcon from '@phosphor/caret-right.svg';
import LockIcon from '@phosphor/lock-simple.svg';
import TableIcon from '@phosphor/table.svg';
import { Key } from '@solid-primitives/keyed';
@@ -36,25 +38,42 @@ export function PipelineEntryCards(props: {
) => JSX.Element;
onOpenPipeline?: (pipelineId: string) => void;
}) {
+ const [expanded, setExpanded] = createSignal(true);
return (
<Show when={props.entries.length > 0}>
<section class="flex flex-col gap-2.5" aria-label="Pipelines">
- <h2 class="text-[13px] font-medium text-ink-muted">Pipelines</h2>
- <div class="flex flex-col gap-3">
- <Key each={props.entries} by="rowId">
- {(entry) => (
- <PipelineEntryCard
- entry={entry()}
- renderCell={(cell) => props.renderCell(entry, cell)}
- onOpenPipeline={
- props.onOpenPipeline
- ? () => props.onOpenPipeline?.(entry().pipeline.id)
- : undefined
- }
- />
+ <h2 class="flex">
+ <button
+ type="button"
+ class="flex items-center gap-1"
+ aria-expanded={expanded()}
+ onClick={() => setExpanded((open) => !open)}
+ >
+ {expanded() ? (
+ <CaretDownIcon class="size-3" />
+ ) : (
+ <CaretRightIcon class="size-3" />
)}
- </Key>
- </div>
+ <span class="text-xs">Pipelines</span>
+ </button>
+ </h2>
+ <Show when={expanded()}>
+ <div class="flex flex-col gap-3">
+ <Key each={props.entries} by="rowId">
+ {(entry) => (
+ <PipelineEntryCard
+ entry={entry()}
+ renderCell={(cell) => props.renderCell(entry, cell)}
+ onOpenPipeline={
+ props.onOpenPipeline
+ ? () => props.onOpenPipeline?.(entry().pipeline.id)
+ : undefined
+ }
+ />
+ )}
+ </Key>
+ </div>
+ </Show>
</section>
</Show>
);
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index cd2c2a668f..804934952a 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -2038,6 +2038,8 @@ strip names the pipeline (a lock marks a private one); below it, the row's first
four fields sit side by side, label over value, and the rest wait behind
`Show N more`. Cells edit like the pipeline table's when you can edit that
pipeline. Inside Customers, the header's `Open <pipeline>` button opens it. The
+`Pipelines` caret header collapses and expands the cards, like the Discussion
+header; both start expanded on each visit. The
section is absent when the record is in no pipeline. Team lists the contacts with `Add contact`. Emails keeps the
`Signal`/`All` and `Team`/`Me` toggles. Files lists non-task documents whose
`Companies` property references the company, plus attachments of emails with