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): show long pipeline card fields in full when expanded (#8444)

gbirman285ab567b40d
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 2028b92f5b..0119335351 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
@@ -1,8 +1,16 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import { afterEach, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
import type { PipelineEntry } from '../core/pipeline-entry';
import { PipelineEntryCards } from './pipeline-entry-cards';
+const scrollIntoView = vi.fn();
+
+beforeEach(() => {
+ // jsdom has no layout, so it leaves scrolling out.
+ Element.prototype.scrollIntoView = scrollIntoView;
+ scrollIntoView.mockReset();
+});
+
afterEach(cleanup);
function entry(name: string, shared: boolean, fields: string[]): PipelineEntry {
@@ -51,8 +59,10 @@ it('shows each pipeline row as a card that collapses past four fields', () => {
expect(sales.textContent).not.toContain('Source value');
fireEvent.click(screen.getByRole('button', { name: 'Show 1 more' }));
expect(sales.textContent).toContain('Source value');
+ expect(scrollIntoView).not.toHaveBeenCalled();
fireEvent.click(screen.getByRole('button', { name: 'Show less' }));
expect(sales.textContent).not.toContain('Source value');
+ expect(scrollIntoView.mock.contexts).toEqual([sales]);
expect(screen.getByLabelText('Private pipeline')).toBeTruthy();
expect(
screen.getByRole('article', { name: 'Partners' }).textContent
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 2ae6bd17f3..c4b829b6b0 100644
--- a/apps/web/src/features/crm/components/pipeline-entry-cards.tsx
+++ b/apps/web/src/features/crm/components/pipeline-entry-cards.tsx
@@ -34,7 +34,8 @@ export function PipelineEntryCards(props: {
entries: PipelineEntry[];
renderCell: (
entry: Accessor<PipelineEntry>,
- cell: Accessor<PipelineEntryCell>
+ cell: Accessor<PipelineEntryCell>,
+ wrap: Accessor<boolean>
) => JSX.Element;
onOpenPipeline?: (pipelineId: string) => void;
}) {
@@ -63,7 +64,9 @@ export function PipelineEntryCards(props: {
{(entry) => (
<PipelineEntryCard
entry={entry()}
- renderCell={(cell) => props.renderCell(entry, cell)}
+ renderCell={(cell, wrap) =>
+ props.renderCell(entry, cell, wrap)
+ }
onOpenPipeline={
props.onOpenPipeline
? () => props.onOpenPipeline?.(entry().pipeline.id)
@@ -81,21 +84,31 @@ export function PipelineEntryCards(props: {
function PipelineEntryCard(props: {
entry: PipelineEntry;
- renderCell: (cell: Accessor<PipelineEntryCell>) => JSX.Element;
+ renderCell: (
+ cell: Accessor<PipelineEntryCell>,
+ wrap: Accessor<boolean>
+ ) => JSX.Element;
onOpenPipeline?: () => void;
}) {
+ let card: HTMLElement | undefined;
const [expanded, setExpanded] = createSignal(false);
const hidden = () => props.entry.cells.length - ROW_FIELDS;
const shown = () => {
const all = rows(props.entry.cells);
return expanded() ? all : all.slice(0, 1);
};
+ const toggle = () => {
+ setExpanded((open) => !open);
+ // Collapsing from the pinned control can leave the now shorter card above the view.
+ if (!expanded()) card?.scrollIntoView({ block: 'nearest' });
+ };
return (
<article
- class="flex min-w-0 flex-col overflow-hidden rounded-xl border border-edge-muted bg-panel"
+ ref={card}
+ class="flex min-w-0 flex-col rounded-xl border border-edge-muted bg-panel"
aria-label={props.entry.pipeline.name}
>
- <header class="flex h-10 items-center gap-2.5 border-b border-edge-muted bg-hover pl-3.5 pr-1.5">
+ <header class="flex h-10 items-center gap-2.5 rounded-t-xl border-b border-edge-muted bg-hover pl-3.5 pr-1.5">
<TableIcon class="size-4 shrink-0 text-ink-muted" />
<span class="min-w-0 truncate text-[13px] font-medium">
{props.entry.pipeline.name}
@@ -120,12 +133,12 @@ function PipelineEntryCard(props: {
)}
</Show>
</header>
- <div class="flex flex-col gap-3 px-4 pb-3.5 pt-3">
+ <div class="@container/card flex flex-col gap-3 px-4 pb-3.5 pt-3">
<Key each={shown()} by={(row) => row[0]?.column.id}>
{(row) => (
<div
- class="grid gap-x-6"
- style={{ 'grid-template-columns': rowColumns(row()) }}
+ class="grid grid-cols-2 gap-x-6 gap-y-3 @lg/card:grid-cols-(--row-columns)"
+ style={{ '--row-columns': rowColumns(row()) }}
>
<Key each={row()} by={(cell) => cell.column.id}>
{(cell) => (
@@ -143,7 +156,7 @@ function PipelineEntryCard(props: {
</div>
{/* Cells pad their own hit area; pull it out to align values with the labels. */}
<div class="-mx-2.5 -my-1.5 min-w-0">
- {props.renderCell(cell)}
+ {props.renderCell(cell, expanded)}
</div>
</div>
)}
@@ -151,17 +164,25 @@ function PipelineEntryCard(props: {
</div>
)}
</Key>
- <Show when={hidden() > 0}>
+ </div>
+ <Show when={hidden() > 0}>
+ {/* An expanded card can be taller than the view; its control stays pinned in sight.
+ Sticky offsets start inside the record scroller's 3rem bottom padding, so reach past it. */}
+ <footer
+ class="rounded-b-xl border-t border-edge-muted bg-panel px-4 py-1.5"
+ classList={{ 'sticky -bottom-12': expanded() }}
+ >
<Button
variant="ghost"
size="xs"
- class="-ml-2 self-start text-ink-muted"
- onClick={() => setExpanded((open) => !open)}
+ class="-ml-2 text-ink-muted"
+ aria-expanded={expanded()}
+ onClick={toggle}
>
{expanded() ? 'Show less' : `Show ${hidden()} more`}
</Button>
- </Show>
- </div>
+ </footer>
+ </Show>
</article>
);
}
diff --git a/apps/web/src/features/crm/components/record-overview.tsx b/apps/web/src/features/crm/components/record-overview.tsx
index 54cc6f63bd..abc244e02a 100644
--- a/apps/web/src/features/crm/components/record-overview.tsx
+++ b/apps/web/src/features/crm/components/record-overview.tsx
@@ -3,7 +3,7 @@ import type { ParentProps } from 'solid-js';
/** Full-frame record content scrolls beneath the floating split chrome. */
export function RecordOverview(props: ParentProps) {
return (
- <div class="h-full overflow-y-auto px-6 pb-12 pt-12 scrollbar-hidden touch:pt-[calc(var(--mobile-content-inset-top,0px)+1.5rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
+ <div class="h-full scroll-pt-12 overflow-y-auto px-6 pb-12 pt-12 scrollbar-hidden touch:scroll-pt-[calc(var(--mobile-content-inset-top,0px)+1.5rem)] touch:pt-[calc(var(--mobile-content-inset-top,0px)+1.5rem)] touch:pb-[calc(var(--mobile-content-inset-bottom,0px)+3rem)]">
<div class="mx-auto flex max-w-3xl min-w-0 flex-col gap-6">
{props.children}
</div>
diff --git a/apps/web/src/features/crm/pipeline-entries-adapter.tsx b/apps/web/src/features/crm/pipeline-entries-adapter.tsx
index ba6b2f3453..22b2c4cf3a 100644
--- a/apps/web/src/features/crm/pipeline-entries-adapter.tsx
+++ b/apps/web/src/features/crm/pipeline-entries-adapter.tsx
@@ -70,10 +70,11 @@ export function createCrmPipelineEntries(
<PipelineEntryCards
entries={query.entries()}
onOpenPipeline={props.onOpenPipeline}
- renderCell={(entry, cell) => (
+ renderCell={(entry, cell, wrap) => (
<GridCell
column={cell().column}
value={shownValue(entry(), cell())}
+ wrap={wrap()}
canEdit={entry().pipeline.canEdit}
renderTextEditor={(editor) => <DatabaseTextEditor {...editor} />}
renderTextValue={(value) => <DatabaseTextValue value={value} />}
diff --git a/apps/web/src/features/database/components/grid-cell.tsx b/apps/web/src/features/database/components/grid-cell.tsx
index c2eee0ac7a..1412aeb739 100644
--- a/apps/web/src/features/database/components/grid-cell.tsx
+++ b/apps/web/src/features/database/components/grid-cell.tsx
@@ -67,6 +67,8 @@ export type GridCellProps = GridCellEditorOptions & {
column: DatabaseViewColumn;
value: DatabaseCellValue;
emptyLabel?: string;
+ /** Text values wrap onto as many lines as they need instead of truncating to one. */
+ wrap?: boolean;
canEdit: boolean;
renderTextEditor?: (props: DatabaseTextEditorProps) => JSX.Element;
renderTextValue?: (value: string) => JSX.Element;
@@ -415,6 +417,7 @@ export function GridCell(props: GridCellProps) {
column={props.column}
value={props.value}
emptyLabel={props.emptyLabel}
+ wrap={props.wrap}
editable={editable()}
isEntity={isEntity()}
mentionPreview={mentionPreview()}
@@ -547,6 +550,7 @@ function TextCell(props: {
column: DatabaseViewColumn;
value: DatabaseCellValue;
emptyLabel?: string;
+ wrap?: boolean;
editable: boolean;
isEntity: boolean;
mentionPreview: MentionPreview | undefined;
@@ -638,7 +642,12 @@ function TextCell(props: {
<Show when={props.hasResolvedMentionLabel}>
<span class="sr-only">{props.column.name}: </span>
</Show>
- <span class="truncate">
+ <span
+ classList={{
+ truncate: !props.wrap,
+ 'min-w-0 wrap-break-word': props.wrap,
+ }}
+ >
<Switch
fallback={
(props.column.dataType === 'STRING' &&
diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.md
index 668906e2a7..0a484961ea 100644
--- a/docs/agent-guide/crm.md
+++ b/docs/agent-guide/crm.md
@@ -161,10 +161,13 @@ 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
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
+four fields sit side by side, label over value (two per row on a narrow card),
+and the rest wait behind `Show N more` in the card's footer. Expanded, text
+values wrap to their full length instead of truncating, the footer's
+`Show less` stays pinned to the bottom of the view while the card runs past it,
+and collapsing scrolls the card back into view. 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