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(calls): dismiss a ringing call from the Live sidebar (#9106)

Eric Hayes322ff1401598
diff --git a/apps/web/src/features/channels-view/live-calls-sidebar.tsx b/apps/web/src/features/channels-view/live-calls-sidebar.tsx
index f0e70ff0d0..04164250d3 100644
--- a/apps/web/src/features/channels-view/live-calls-sidebar.tsx
+++ b/apps/web/src/features/channels-view/live-calls-sidebar.tsx
@@ -1,3 +1,7 @@
+import {
+ dismissIncomingCallEverywhere,
+ useVisibleIncomingCalls,
+} from '@app/features/block-call/sidebar/incoming-calls';
import { useCallContextOptional } from '@channel/Call/CallContext';
import { getMeetingPath, getMeetingShareToken } from '@channel/Call/call-link';
import { joinChannelCall } from '@channel/Call/join-channel-call';
@@ -39,6 +43,7 @@ function ChatLiveCalls() {
const callCtx = useCallContextOptional();
const channelsCtx = useChannelsContext();
const channelCalls = useActiveCallsQuery();
+ const incomingCalls = useVisibleIncomingCalls();
const flag = useQuickCallsFlag();
const quickCalls = useActiveQuickCallsSource(() =>
!flag().loading && flag().enabled ? userId() : undefined
@@ -51,6 +56,7 @@ function ChatLiveCalls() {
const quick = quickCalls.calls();
const quickCallIds = new Set(quick.map((call) => call.callId));
const channelsById = channelsCtx.channelsById();
+ const ringingCallIds = new Set(incomingCalls().map((call) => call.callId));
// A quick call is backed by a channel call; list it once, as the meeting.
const channelRows = (channelCalls.data ?? []).flatMap(
@@ -64,6 +70,7 @@ function ChatLiveCalls() {
channelId: call.channelId,
label: channel.name ?? 'Channel call',
joined: joinedCallId() === call.callId,
+ ringing: ringingCallIds.has(call.callId),
},
];
}
@@ -96,6 +103,7 @@ function ChatLiveCalls() {
})
.exhaustive()
}
+ onDismiss={(call) => dismissIncomingCallEverywhere(call.id, userId())}
/>
);
}
diff --git a/apps/web/src/features/meetings/components/live-calls-sidebar.test.tsx b/apps/web/src/features/meetings/components/live-calls-sidebar.test.tsx
index 0f3149229b..c9dfb69637 100644
--- a/apps/web/src/features/meetings/components/live-calls-sidebar.test.tsx
+++ b/apps/web/src/features/meetings/components/live-calls-sidebar.test.tsx
@@ -32,3 +32,25 @@ it('renders nothing without live calls', () => {
render(() => <LiveCallsSidebar calls={[]} onSelect={vi.fn()} />);
expect(screen.queryByText('Live')).toBeNull();
});
+
+it('offers Dismiss only for ringing calls', async () => {
+ const onSelect = vi.fn();
+ const onDismiss = vi.fn();
+ render(() => (
+ <LiveCallsSidebar
+ calls={[
+ { id: 'ring', label: 'design', joined: false, ringing: true },
+ { id: 'quiet', label: 'standup', joined: false },
+ ]}
+ onSelect={onSelect}
+ onDismiss={onDismiss}
+ />
+ ));
+
+ expect(screen.queryByRole('button', { name: 'Dismiss standup' })).toBeNull();
+ await userEvent.click(screen.getByRole('button', { name: 'Dismiss design' }));
+ expect(onDismiss).toHaveBeenCalledWith(
+ expect.objectContaining({ id: 'ring' })
+ );
+ expect(onSelect).not.toHaveBeenCalled();
+});
diff --git a/apps/web/src/features/meetings/components/live-calls-sidebar.tsx b/apps/web/src/features/meetings/components/live-calls-sidebar.tsx
index 25aabf35fa..f6b3583786 100644
--- a/apps/web/src/features/meetings/components/live-calls-sidebar.tsx
+++ b/apps/web/src/features/meetings/components/live-calls-sidebar.tsx
@@ -1,7 +1,8 @@
import { ViewSidebar } from '@app/components/view-shell/ViewSidebar';
import PhoneCallIcon from '@icon/system/fill/phone-call-fill.svg';
+import XIcon from '@icon/system/regular/x.svg';
import { Key } from '@solid-primitives/keyed';
-import { Tooltip } from '@ui';
+import { cn, Tooltip } from '@ui';
import { createUniqueId, Show } from 'solid-js';
export type LiveCallRow = {
@@ -9,11 +10,14 @@ export type LiveCallRow = {
label: string;
/** The user is already in this call, so the row opens it instead. */
joined: boolean;
+ /** The call is ringing for the user, so the row offers Dismiss. */
+ ringing?: boolean;
};
export function LiveCallsSidebar<T extends LiveCallRow>(props: {
calls: readonly T[];
onSelect: (call: T) => void;
+ onDismiss?: (call: T) => void;
}) {
const titleId = createUniqueId();
const action = (call: LiveCallRow) => (call.joined ? 'Open' : 'Join');
@@ -34,30 +38,51 @@ export function LiveCallsSidebar<T extends LiveCallRow>(props: {
</h2>
<div class="flex min-h-0 flex-col gap-(--sidebar-row-gap) overflow-y-auto overscroll-contain">
<Key each={props.calls} by="id">
- {(call) => (
- <Tooltip
- label={call().label}
- placement="right"
- class="min-w-0 shrink-0"
- >
- <ViewSidebar.Item
- aria-label={`${action(call())} ${call().label}`}
- class="bg-accent-bg text-ink not-disabled:hover:bg-accent-bg not-disabled:hover:overlay-hover"
- onClick={() => props.onSelect(call())}
- >
- <ViewSidebar.Icon class="text-accent">
- <PhoneCallIcon />
- </ViewSidebar.Icon>
- <span class="min-w-0 flex-1 truncate">{call().label}</span>
- <span
- aria-hidden="true"
- class="ml-auto shrink-0 text-xs font-medium text-accent"
+ {(call) => {
+ const dismissable = () => !!call().ringing && !!props.onDismiss;
+ return (
+ <div class="relative flex min-w-0 shrink-0 flex-col">
+ <Tooltip
+ label={call().label}
+ placement="right"
+ class="min-w-0"
>
- {action(call())}
- </span>
- </ViewSidebar.Item>
- </Tooltip>
- )}
+ <ViewSidebar.Item
+ aria-label={`${action(call())} ${call().label}`}
+ class={cn(
+ 'bg-accent-bg text-ink not-disabled:hover:bg-accent-bg not-disabled:hover:overlay-hover',
+ dismissable() && 'pr-9'
+ )}
+ onClick={() => props.onSelect(call())}
+ >
+ <ViewSidebar.Icon class="text-accent">
+ <PhoneCallIcon />
+ </ViewSidebar.Icon>
+ <span class="min-w-0 flex-1 truncate">
+ {call().label}
+ </span>
+ <span
+ aria-hidden="true"
+ class="ml-auto shrink-0 text-xs font-medium text-accent"
+ >
+ {action(call())}
+ </span>
+ </ViewSidebar.Item>
+ </Tooltip>
+ <Show when={dismissable()}>
+ <span class="absolute right-(--sidebar-action-inset) top-1/2 flex -translate-y-1/2">
+ <ViewSidebar.Control
+ class="rounded-md"
+ aria-label={`Dismiss ${call().label}`}
+ onClick={() => props.onDismiss?.(call())}
+ >
+ <XIcon class="size-3" />
+ </ViewSidebar.Control>
+ </span>
+ </Show>
+ </div>
+ );
+ }}
</Key>
</div>
</section>
diff --git a/docs/agent-guide/calls.md b/docs/agent-guide/calls.md
index ff1e85be6e..9935b2f0f9 100644
--- a/docs/agent-guide/calls.md
+++ b/docs/agent-guide/calls.md
@@ -64,7 +64,9 @@ channel.
The desktop Chat sidebar lists every live channel call and quick call in a `Live`
section above the conversations. Each row reads `Join`, or `Open` when you are
-already in that call, which returns to the channel's Call tab. To see the section
+already in that call, which returns to the channel's Call tab. A channel call that is
+still ringing for you also shows a `Dismiss` button, which declines it like the
+conversation row's Decline. To see the section
without starting a real call, answer `/call/active` and `/call/<channelId>/active`
with a fake call through CDP `Fetch` interception.