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): add join button to in-progress call page (#9052)

Eric Hayes8b4470da0507
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.test.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.test.tsx
new file mode 100644
index 0000000000..819a525346
--- /dev/null
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.test.tsx
@@ -0,0 +1,100 @@
+/**
+ * @vitest-environment jsdom
+ */
+
+import type { CallRecord } from '@service-call/client';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import type { JSX } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { CallRecordingBody } from './CallRecordingBody';
+
+const mocks = vi.hoisted(() => ({
+ callAgain: vi.fn(),
+ canCallAgain: true,
+ activeCallId: null as string | null,
+}));
+
+vi.mock('../use-call-again', () => ({
+ useCallAgain: () => ({
+ canCallAgain: () => mocks.canCallAgain,
+ callAgain: mocks.callAgain,
+ }),
+}));
+vi.mock('@channel/Call/CallContext', () => ({
+ useCallContextOptional: () => ({ activeCallId: () => mocks.activeCallId }),
+}));
+vi.mock('@app/features/chat/ChatWithAgentButton', () => ({
+ AskMacroButton: () => null,
+}));
+vi.mock('@channel/Call/chat/CallChatHistory', () => ({
+ CallChatHistory: () => null,
+}));
+vi.mock('@components/app/HeaderActionGroup', () => ({
+ HeaderActionGroup: () => null,
+}));
+vi.mock('@components/app/side-panel', () => ({
+ SidePanel: { HeaderActions: () => null },
+}));
+vi.mock('@core/component/CustomScrollbar', () => ({
+ CustomScrollbar: () => null,
+}));
+vi.mock('@core/mobile/isMobile', () => ({ isMobile: () => false }));
+vi.mock('@ui', () => ({
+ Button: (props: { onClick: () => void; children: JSX.Element }) => (
+ <button onClick={() => props.onClick()}>{props.children}</button>
+ ),
+}));
+vi.mock('./CallRecordingParticipants', () => ({
+ CallRecordingParticipantsSection: () => null,
+}));
+vi.mock('./CallRecordingSummary', () => ({
+ CallRecordingSummarySection: () => null,
+}));
+
+function callRecord(isActive: boolean): CallRecord {
+ return {
+ callId: 'call-id',
+ channelId: 'channel-id',
+ createdBy: 'user-id',
+ guests: [],
+ isActive,
+ participants: [],
+ roomName: 'room',
+ shareWithTeam: false,
+ startedAt: '2026-10-28T00:00:00Z',
+ transcript: [],
+ } as unknown as CallRecord;
+}
+
+beforeEach(() => {
+ mocks.callAgain.mockReset();
+ mocks.canCallAgain = true;
+ mocks.activeCallId = null;
+});
+
+afterEach(cleanup);
+
+describe('CallRecordingBody join button', () => {
+ it('joins an in-progress call', () => {
+ render(() => (
+ <CallRecordingBody record={callRecord(true)} callId="call-id" />
+ ));
+ fireEvent.click(screen.getByRole('button', { name: 'Join call' }));
+ expect(mocks.callAgain).toHaveBeenCalledOnce();
+ });
+
+ it('hides join for an ended call', () => {
+ render(() => (
+ <CallRecordingBody record={callRecord(false)} callId="call-id" />
+ ));
+ expect(screen.queryByRole('button', { name: 'Join call' })).toBeNull();
+ });
+
+ it('hides join when already in this call', () => {
+ mocks.activeCallId = 'call-id';
+ render(() => (
+ <CallRecordingBody record={callRecord(true)} callId="call-id" />
+ ));
+ expect(screen.queryByRole('button', { name: 'Join call' })).toBeNull();
+ });
+});
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
index 2638323136..5e7b06e0a1 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
@@ -1,11 +1,14 @@
import { AskMacroButton } from '@app/features/chat/ChatWithAgentButton';
+import { useCallContextOptional } from '@channel/Call/CallContext';
import { CallChatHistory } from '@channel/Call/chat/CallChatHistory';
import { HeaderActionGroup } from '@components/app/HeaderActionGroup';
import { SidePanel } from '@components/app/side-panel';
import { CustomScrollbar } from '@core/component/CustomScrollbar';
import { isMobile } from '@core/mobile/isMobile';
+import PhoneCallIcon from '@icon/system/regular/phone-call.svg';
import SpinnerIcon from '@icon/system/regular/spinner.svg';
import type { CallRecord } from '@service-call/client';
+import { Button } from '@ui';
import { format } from 'date-fns';
import {
createEffect,
@@ -23,6 +26,7 @@ import {
getSegmentVideoSeconds,
sortTranscriptSegments,
} from '../transcript-playback';
+import { useCallAgain } from '../use-call-again';
import { CallRecordingParticipantsSection } from './CallRecordingParticipants';
import { CallRecordingSummarySection } from './CallRecordingSummary';
import { CallRecordingVideo } from './CallRecordingVideo';
@@ -146,6 +150,16 @@ export function CallRecordingBody(props: {
return formatCallDuration(ms);
});
+ const callCtx = useCallContextOptional();
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => props.callId,
+ () => record().channelId
+ );
+ const canJoin = () =>
+ record().isActive &&
+ canCallAgain() &&
+ callCtx?.activeCallId() !== props.callId;
+
return (
<div class="relative flex-1 min-h-0 overflow-hidden">
<SidePanel.HeaderActions>
@@ -191,6 +205,17 @@ export function CallRecordingBody(props: {
<span class="text-success font-medium">In progress</span>
</Show>
</div>
+ <Show when={canJoin()}>
+ <Button
+ variant="success"
+ size="xl"
+ class="mt-6"
+ onClick={callAgain}
+ >
+ <PhoneCallIcon />
+ Join call
+ </Button>
+ </Show>
</header>
<CallRecordingParticipantsSection record={props.record} />
diff --git a/docs/agent-guide/calls.md b/docs/agent-guide/calls.md
index 6cfec9c83c..335fce1677 100644
--- a/docs/agent-guide/calls.md
+++ b/docs/agent-guide/calls.md
@@ -37,6 +37,8 @@ Old copied `/app/call/<callId>` links redirect to the Calls detail without losin
the transcript target. Existing `/app/drive/call/<callId>` links still work.
The detail shows a loading state, recording/transcript/summary, Share, and a call
side panel below the breadcrumb header; a failed load shows Retry.
+While the call is in progress, a `Join call` button under the title joins it
+(desktop and phone); it is hidden once you are in that call.
`call_transcript_id=<segmentId>` seeks the matching video segment after loading.
Check a direct link, both old link formats, a Calls-list click, a second split,
the breadcrumb return, browser Back/Forward, and clicking the same transcript