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(call): channel call panel (#6982)

Will Hutchinson74b8d4a299c1
diff --git a/apps/web/src/features/channel/Channel/ActiveCallMessage.tsx b/apps/web/src/features/channel/Channel/ActiveCallMessage.tsx
index e7aa23b2e4..63b42495ca 100644
--- a/apps/web/src/features/channel/Channel/ActiveCallMessage.tsx
+++ b/apps/web/src/features/channel/Channel/ActiveCallMessage.tsx
@@ -1,9 +1,10 @@
-import { useCallContextOptional } from '@channel/Call/CallContext';
-import { joinChannelCall } from '@channel/Call/join-channel-call';
+import { getCallJoinTab } from '@channel/Call/call-tabs';
+import { useCall } from '@channel/Call/use-call';
import PhoneIcon from '@phosphor/phone-call.svg';
import { useActiveCallQuery } from '@queries/call/call';
import { Button } from '@ui';
import { createMemo, createSignal, onCleanup, Show } from 'solid-js';
+import { useChannelTab } from './ChannelTabContext';
function formatDuration(startedAt: string | undefined, nowMs: number) {
const startedAtMs = startedAt ? new Date(startedAt).getTime() : Number.NaN;
@@ -20,7 +21,10 @@ function formatDuration(startedAt: string | undefined, nowMs: number) {
export function ActiveCallMessage(props: { channelId: string }) {
const activeCallQuery = useActiveCallQuery(() => props.channelId);
- const callCtx = useCallContextOptional();
+ const { setActiveTab } = useChannelTab();
+ const call = useCall(() => props.channelId, {
+ onJoin: () => setActiveTab(getCallJoinTab()),
+ });
const [nowMs, setNowMs] = createSignal(Date.now());
const durationTimer = globalThis.setInterval(
() => setNowMs(Date.now()),
@@ -28,13 +32,19 @@ export function ActiveCallMessage(props: { channelId: string }) {
);
onCleanup(() => globalThis.clearInterval(durationTimer));
- const shouldShow = () =>
- !!activeCallQuery.data &&
- (!callCtx?.isInCall() || callCtx.activeChannelId() !== props.channelId);
+ const shouldShow = () => !!activeCallQuery.data && !call.isInThisChannel();
const duration = createMemo(() =>
formatDuration(activeCallQuery.data?.createdAt, nowMs())
);
+ async function handleJoin() {
+ try {
+ await call.joinCall();
+ } catch (error) {
+ console.error('Failed to join call', error);
+ }
+ }
+
return (
<Show when={shouldShow()}>
{/* Full-frame mobile/tablet: place above the floating input/dock stack. */}
@@ -77,7 +87,7 @@ export function ActiveCallMessage(props: { channelId: string }) {
variant="success"
size="sm"
class="shrink-0"
- onClick={() => void joinChannelCall(props.channelId)}
+ onClick={() => void handleJoin()}
>
<PhoneIcon class="size-3.5" />
Join
diff --git a/apps/web/src/features/channel/Channel/tests/active-call-message.test.tsx b/apps/web/src/features/channel/Channel/tests/active-call-message.test.tsx
new file mode 100644
index 0000000000..84693d041d
--- /dev/null
+++ b/apps/web/src/features/channel/Channel/tests/active-call-message.test.tsx
@@ -0,0 +1,68 @@
+/**
+ * @vitest-environment jsdom
+ */
+
+import { render, screen } from '@solidjs/testing-library';
+import userEvent from '@testing-library/user-event';
+import type { JSX } from 'solid-js';
+import { createSignal, Match, Switch } from 'solid-js';
+import { describe, expect, it, vi } from 'vitest';
+import { ActiveCallMessage } from '../ActiveCallMessage';
+import { ChannelTabProvider } from '../ChannelTabContext';
+
+vi.mock('@channel/Call/use-call', () => ({
+ useCall: (_channelId: () => string, options?: { onJoin?: () => void }) => ({
+ isInThisChannel: () => false,
+ joinCall: async () => options?.onJoin?.(),
+ }),
+}));
+
+vi.mock('@queries/call/call', () => ({
+ useActiveCallQuery: () => ({
+ data: { createdAt: '2026-09-25T14:00:00.000Z' },
+ }),
+}));
+
+vi.mock('@phosphor/phone-call.svg', () => ({
+ default: () => <span aria-hidden="true" />,
+}));
+
+vi.mock('@ui', () => ({
+ Button: (props: {
+ children: JSX.Element;
+ disabled?: boolean;
+ onClick?: JSX.EventHandlerUnion<HTMLButtonElement, MouseEvent>;
+ }) => (
+ <button type="button" disabled={props.disabled} onClick={props.onClick}>
+ {props.children}
+ </button>
+ ),
+}));
+
+describe('ActiveCallMessage', () => {
+ it('opens the call when the user clicks Join', async () => {
+ const [activeTab, setActiveTab] = createSignal<'messages' | 'call'>(
+ 'messages'
+ );
+
+ render(() => (
+ <ChannelTabProvider
+ activeTab={activeTab}
+ setActiveTab={(tab) => setActiveTab(tab as 'messages' | 'call')}
+ >
+ <Switch>
+ <Match when={activeTab() === 'messages'}>
+ <ActiveCallMessage channelId="channel-1" />
+ </Match>
+ <Match when={activeTab() === 'call'}>
+ <div>Call controls</div>
+ </Match>
+ </Switch>
+ </ChannelTabProvider>
+ ));
+
+ await userEvent.click(screen.getByRole('button', { name: 'Join' }));
+
+ expect(screen.getByText('Call controls')).toBeTruthy();
+ });
+});
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index 681ffc71b2..32522520d8 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -553,10 +553,12 @@ that requests them.
## Call lifecycle
-The channel's call tab and floating call controls share one session. Repeated
-Join clicks while connecting should produce one connection; leaving from either
-control ends the same call. Navigate away and return while connected to check
-that the call and its controls remain usable.
+The active-call panel above the composer, the channel's call tab, and floating
+call controls share one session. Joining from the panel switches the current
+channel surface to the live call. Repeated Join clicks while connecting should
+produce one connection; leaving from either control ends the same call. Navigate
+away and return while connected to check that the call and its controls remain
+usable.
For recovery checks, keep another participant connected and briefly interrupt
the first participant's network. Recovery may rejoin that same live call. It