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 split close beside the collapsed CRM sidebar toggle (#8218)

teo216581afbc09
diff --git a/apps/web/src/features/crm/views/crm-workspace.test.tsx b/apps/web/src/features/crm/views/crm-workspace.test.tsx
index 3e4bfb9d68..0df382acbc 100644
--- a/apps/web/src/features/crm/views/crm-workspace.test.tsx
+++ b/apps/web/src/features/crm/views/crm-workspace.test.tsx
@@ -56,6 +56,12 @@ vi.mock('@ui', async () => ({
props: JSX.ButtonHTMLAttributes<HTMLButtonElement> & { label?: string }
) => <button aria-label={props.label} {...props} />,
}));
+vi.mock('@components/app/split-panel', () => ({
+ SplitPanel: {
+ ControlGroup: (props: ParentProps) => <div>{props.children}</div>,
+ CloseButton: () => <button type="button" aria-label="Close split" />,
+ },
+}));
vi.mock('@ui/components/Tour', () => ({ tourTarget: () => () => {} }));
vi.mock('@app/components/view-shell/tour', () => ({
VIEW_SHELL_TOUR: { sidebarToggle: 'sidebar-toggle' },
@@ -156,9 +162,11 @@ vi.mock('./import-companies', () => ({ CrmImport: () => null }));
vi.mock('./pipeline', () => ({
PipelineView: (props: {
pipeline: { name: string };
+ navigation?: JSX.Element;
onOpenRecord(record: { type: 'company'; id: string }): void;
}) => (
<div>
+ <header>{props.navigation}</header>
{props.pipeline.name} table
<button
type="button"
@@ -304,6 +312,15 @@ it('shows a pipeline another view asks for, in place of an open record', () => {
expect(screen.queryByText('Sales record company:acme')).toBeNull();
});
+it('keeps the split close beside the collapsed sidebar toggle on a pipeline', () => {
+ fixture.touch = false;
+ setup('pipeline:sales');
+ const close = screen.getByRole('button', { name: 'Close split' });
+ expect(close.nextElementSibling?.getAttribute('aria-label')).toBe(
+ 'Expand CRM sidebar'
+ );
+});
+
it('opens the company of a pipeline row in its own split on touch', () => {
setup('pipeline:sales');
fireEvent.click(screen.getByRole('button', { name: 'Open Acme' }));
diff --git a/apps/web/src/features/crm/views/crm-workspace.tsx b/apps/web/src/features/crm/views/crm-workspace.tsx
index cc351ad3e8..4fa9499331 100644
--- a/apps/web/src/features/crm/views/crm-workspace.tsx
+++ b/apps/web/src/features/crm/views/crm-workspace.tsx
@@ -15,6 +15,7 @@ import { SoupViewContextSort } from '@app/features/next-soup/soup-view/filters-b
import { UnifiedFilterDropdown } from '@app/features/next-soup/soup-view/filters-bar/unified-filter-dropdown';
import { useFilterRefinements } from '@app/features/next-soup/soup-view/filters-bar/use-filter-refinements';
import { usePreference } from '@app/preferences/use-preference';
+import { SplitPanel } from '@components/app/split-panel';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { debounce } from '@core/util/debounce';
import {
@@ -67,45 +68,52 @@ function NavigationToggle(props: {
const toggleTarget = tourTarget(VIEW_SHELL_TOUR.sidebarToggle);
return (
<Show when={!isTouchDevice() && shell.aside.isCollapsed()}>
- <Show
- when={shell.breakpoints.narrow?.()}
- fallback={
- <Tooltip label="Expand CRM sidebar">
- <Button
- variant="ghost"
- size="icon-sm"
- label="Expand CRM sidebar"
- ref={toggleTarget}
- onClick={props.onExpand}
- >
- <ListIcon class="size-4" />
- </Button>
- </Tooltip>
- }
- >
- <Dropdown open={open()} onOpenChange={setOpen} placement="bottom-start">
- <Tooltip label="Show CRM navigation">
- <Dropdown.Trigger
- variant="ghost"
- size="icon-sm"
- aria-label="Show CRM navigation"
- ref={toggleTarget}
- >
- <ListIcon class="size-4" />
- </Dropdown.Trigger>
- </Tooltip>
- <Dropdown.Content class="w-55 max-h-[80vh] overflow-auto p-0">
- <div
- onClick={(event) => {
- if ((event.target as HTMLElement).closest('nav button'))
- setOpen(false);
- }}
- >
- {props.children}
- </div>
- </Dropdown.Content>
- </Dropdown>
- </Show>
+ <SplitPanel.ControlGroup>
+ <SplitPanel.CloseButton />
+ <Show
+ when={shell.breakpoints.narrow?.()}
+ fallback={
+ <Tooltip label="Expand CRM sidebar">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ label="Expand CRM sidebar"
+ ref={toggleTarget}
+ onClick={props.onExpand}
+ >
+ <ListIcon class="size-4" />
+ </Button>
+ </Tooltip>
+ }
+ >
+ <Dropdown
+ open={open()}
+ onOpenChange={setOpen}
+ placement="bottom-start"
+ >
+ <Tooltip label="Show CRM navigation">
+ <Dropdown.Trigger
+ variant="ghost"
+ size="icon-sm"
+ aria-label="Show CRM navigation"
+ ref={toggleTarget}
+ >
+ <ListIcon class="size-4" />
+ </Dropdown.Trigger>
+ </Tooltip>
+ <Dropdown.Content class="w-55 max-h-[80vh] overflow-auto p-0">
+ <div
+ onClick={(event) => {
+ if ((event.target as HTMLElement).closest('nav button'))
+ setOpen(false);
+ }}
+ >
+ {props.children}
+ </div>
+ </Dropdown.Content>
+ </Dropdown>
+ </Show>
+ </SplitPanel.ControlGroup>
</Show>
);
}
diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.md
index 12339ec6ea..49259da1e5 100644
--- a/docs/agent-guide/crm.md
+++ b/docs/agent-guide/crm.md
@@ -162,6 +162,8 @@ editors without changing hosted data.
`Collapse CRM sidebar` persists across visits; `Expand CRM sidebar` restores it.
At narrow widths, `Show CRM navigation` opens the same navigation in a menu.
+While the sidebar is collapsed, the split's **Close** sits before either toggle,
+including on a pipeline, and stays hidden when the split cannot close.
The sidebar's Records and Lists sections can also collapse independently.
**Pipelines** in the CRM sidebar hold company or contact entries in the shared