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(calls): offer an instant call from the New call button (#7984)

Eric Hayes63197dc915a0
diff --git a/apps/web/src/features/channel/Call/NewMeetingButton.tsx b/apps/web/src/features/channel/Call/NewMeetingButton.tsx
index bd07416912..e7c450eaea 100644
--- a/apps/web/src/features/channel/Call/NewMeetingButton.tsx
+++ b/apps/web/src/features/channel/Call/NewMeetingButton.tsx
@@ -1,12 +1,20 @@
import { ManageMeetingsDialog } from '@app/features/meetings/manage-meetings-dialog';
import CaretDownIcon from '@phosphor/caret-down.svg';
+import PhoneIcon from '@phosphor/phone.svg';
import UsersIcon from '@phosphor/users.svg';
import VideoCameraIcon from '@phosphor/video-camera.svg';
import { Button, Dropdown } from '@ui';
import { createSignal, Show } from 'solid-js';
import { useQuickCallsFlag } from '../../meetings/use-quick-calls-flag';
-export function NewMeetingButton(props: { onChannelCall: () => void }) {
+type NewMeetingActions = {
+ /** Opens the recipient picker for a channel or direct-message call. */
+ onChannelCall: () => void;
+ /** Opens instant call setup; only offered when quick calls are enabled. */
+ onInstantCall: () => void;
+};
+
+export function NewMeetingButton(props: NewMeetingActions) {
const flag = useQuickCallsFlag();
return (
<Show
@@ -18,12 +26,15 @@ export function NewMeetingButton(props: { onChannelCall: () => void }) {
</Button>
}
>
- <NewMeetingMenu onChannelCall={props.onChannelCall} />
+ <NewMeetingMenu
+ onChannelCall={props.onChannelCall}
+ onInstantCall={props.onInstantCall}
+ />
</Show>
);
}
-function NewMeetingMenu(props: { onChannelCall: () => void }) {
+function NewMeetingMenu(props: NewMeetingActions) {
const [managing, setManaging] = createSignal(false);
return (
<>
@@ -39,6 +50,10 @@ function NewMeetingMenu(props: { onChannelCall: () => void }) {
<CaretDownIcon class="size-3" />
</Dropdown.Trigger>
<Dropdown.Content class="min-w-60" blockingBackdrop>
+ <Dropdown.Item closeOnSelect onSelect={props.onInstantCall}>
+ <PhoneIcon class="size-4 shrink-0" />
+ <span>Start an instant call</span>
+ </Dropdown.Item>
<Dropdown.Item closeOnSelect onSelect={props.onChannelCall}>
<UsersIcon class="size-4 shrink-0" />
<span>Call a channel or contact</span>
diff --git a/apps/web/src/features/channel/Call/tests/new-meeting-button.test.tsx b/apps/web/src/features/channel/Call/tests/new-meeting-button.test.tsx
new file mode 100644
index 0000000000..592e931fd9
--- /dev/null
+++ b/apps/web/src/features/channel/Call/tests/new-meeting-button.test.tsx
@@ -0,0 +1,81 @@
+/** @vitest-environment jsdom */
+import {
+ cleanup,
+ fireEvent,
+ render,
+ screen,
+ waitFor,
+} from '@solidjs/testing-library';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { NewMeetingButton } from '../NewMeetingButton';
+
+const mocks = vi.hoisted(() => ({
+ flag: { loading: false, enabled: true },
+}));
+
+vi.mock('../../../meetings/use-quick-calls-flag', () => ({
+ useQuickCallsFlag: () => () => mocks.flag,
+}));
+
+vi.mock('@app/features/meetings/manage-meetings-dialog', () => ({
+ ManageMeetingsDialog: () => <div>Manage dialog</div>,
+}));
+
+describe('NewMeetingButton', () => {
+ let motionStyles: HTMLStyleElement;
+ beforeEach(() => {
+ mocks.flag = { loading: false, enabled: true };
+ // jsdom omits the CSS motion defaults required by Kobalte's presence tracking.
+ motionStyles = document.createElement('style');
+ motionStyles.textContent =
+ '[role="menu"] { animation-name: none; transition-duration: 0s; }';
+ document.head.append(motionStyles);
+ vi.stubGlobal('scrollTo', vi.fn());
+ });
+ afterEach(() => {
+ cleanup();
+ motionStyles.remove();
+ vi.unstubAllGlobals();
+ });
+
+ it('offers an instant call first when quick calls are enabled', async () => {
+ const onInstantCall = vi.fn();
+ const onChannelCall = vi.fn();
+ render(() => (
+ <NewMeetingButton
+ onChannelCall={onChannelCall}
+ onInstantCall={onInstantCall}
+ />
+ ));
+ fireEvent.keyDown(screen.getByRole('button', { name: 'New call' }), {
+ key: 'Enter',
+ });
+ const items = screen.getAllByRole('menuitem');
+ expect(items.map((item) => item.textContent)).toEqual([
+ 'Start an instant call',
+ 'Call a channel or contact',
+ 'Manage call links',
+ ]);
+
+ fireEvent.keyDown(items[0], { key: 'Enter' });
+ expect(onInstantCall).toHaveBeenCalledOnce();
+ expect(onChannelCall).not.toHaveBeenCalled();
+ await waitFor(() => expect(screen.queryByRole('menu')).toBeNull());
+ });
+
+ it('keeps the channel picker as the only action without quick calls', () => {
+ mocks.flag = { loading: false, enabled: false };
+ const onInstantCall = vi.fn();
+ const onChannelCall = vi.fn();
+ render(() => (
+ <NewMeetingButton
+ onChannelCall={onChannelCall}
+ onInstantCall={onInstantCall}
+ />
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'New call' }));
+ expect(onChannelCall).toHaveBeenCalledOnce();
+ expect(onInstantCall).not.toHaveBeenCalled();
+ expect(screen.queryByRole('menu')).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/next-soup/soup-view/NewCallButton.test.tsx b/apps/web/src/features/next-soup/soup-view/NewCallButton.test.tsx
index 2434c289f2..da95c12f00 100644
--- a/apps/web/src/features/next-soup/soup-view/NewCallButton.test.tsx
+++ b/apps/web/src/features/next-soup/soup-view/NewCallButton.test.tsx
@@ -15,17 +15,28 @@ import { NewCallButton } from './NewCallButton';
const mocks = vi.hoisted(() => ({
joinChannelCall: vi.fn<(_: string) => Promise<void>>(),
+ navigate: vi.fn<(_: string) => void>(),
}));
vi.mock('@channel/Call/join-channel-call', () => ({
joinChannelCall: mocks.joinChannelCall,
}));
+vi.mock('@solidjs/router', () => ({ useNavigate: () => mocks.navigate }));
+
vi.mock('@channel/Call/NewMeetingButton', () => ({
- NewMeetingButton: (props: { onChannelCall: () => void }) => (
- <button type="button" onClick={props.onChannelCall}>
- New channel call
- </button>
+ NewMeetingButton: (props: {
+ onChannelCall: () => void;
+ onInstantCall: () => void;
+ }) => (
+ <>
+ <button type="button" onClick={props.onChannelCall}>
+ New channel call
+ </button>
+ <button type="button" onClick={props.onInstantCall}>
+ New instant call
+ </button>
+ </>
),
}));
@@ -90,10 +101,20 @@ vi.mock('@ui', () => {
beforeEach(() => {
mocks.joinChannelCall.mockReset();
mocks.joinChannelCall.mockResolvedValue();
+ mocks.navigate.mockReset();
});
afterEach(cleanup);
describe('NewCallButton', () => {
+ it('opens instant call setup without creating a channel call', () => {
+ render(() => <NewCallButton />);
+ fireEvent.click(screen.getByRole('button', { name: 'New instant call' }));
+
+ expect(mocks.navigate).toHaveBeenCalledExactlyOnceWith('/meet/new');
+ expect(mocks.joinChannelCall).not.toHaveBeenCalled();
+ expect(screen.queryByRole('button', { name: 'Start Call' })).toBeNull();
+ });
+
it('starts the selected channel through the mounted-channel call flow', async () => {
render(() => <NewCallButton />);
fireEvent.click(screen.getByRole('button', { name: 'New channel call' }));
diff --git a/apps/web/src/features/next-soup/soup-view/NewCallButton.tsx b/apps/web/src/features/next-soup/soup-view/NewCallButton.tsx
index 454c368237..bc5d63328c 100644
--- a/apps/web/src/features/next-soup/soup-view/NewCallButton.tsx
+++ b/apps/web/src/features/next-soup/soup-view/NewCallButton.tsx
@@ -11,10 +11,12 @@ import {
useGetOrCreateDirectMessageMutation,
useGetOrCreatePrivateChannelMutation,
} from '@queries/channel/get-or-create-dm';
+import { useNavigate } from '@solidjs/router';
import { Button, Dialog, Surface } from '@ui';
import { createSignal } from 'solid-js';
export function NewCallButton() {
+ const navigate = useNavigate();
const [isOpen, setIsOpen] = createSignal(false);
const { all: destinationOptions } = useCombinedRecipients();
const [selectedOptions, setSelectedOptions] = createSignal<
@@ -82,7 +84,10 @@ export function NewCallButton() {
return (
<>
- <NewMeetingButton onChannelCall={() => setIsOpen(true)} />
+ <NewMeetingButton
+ onChannelCall={() => setIsOpen(true)}
+ onInstantCall={() => navigate('/meet/new')}
+ />
<Dialog
open={isOpen()}
onOpenChange={(open) => {
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 7458c324f3..4f108a950e 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -1792,11 +1792,12 @@ a `Channels` section listing channels seen in loaded calls, and `Tags`. Choosing
a type, channel, or tag shows only that one; choosing it again clears it. These
refinements carry across the three views. Sort, group, filter, and `New call`
sit in the list's top bar. Phones keep pill tabs and the header search.
-`New call` offers `Call a channel or contact`
-and, with `enable-quick-calls` enabled, `Manage call links`. Create Quick Calls
-with `New Call` beside Calendar's
-`New event`, or with `Create` → `Call` (`C C`). Scheduled calls are created through
-Calendar and can be shared with people who do not have a Macro account.
+With `enable-quick-calls` enabled, `New call` opens a menu with `Start an instant
+call`, `Call a channel or contact`, and `Manage call links`; without the flag it
+opens the recipient picker directly. `Start an instant call` opens `/app/meet/new`
+without creating a meeting, the same setup reached from `New Call` beside
+Calendar's `New event` or `Create` → `Call` (`C C`). Scheduled calls are created
+through Calendar and can be shared with people who do not have a Macro account.
The channel/contact option opens the recipient picker.
Recordings, transcriptions
and summaries appear here; empty state notes "Calls are available to agents."