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.

refactor(web): deblockify pr and calls (#6949)

dev-rbae2310693719
diff --git a/apps/web/src/components/app/split-layout/split-router/app-middleware.ts b/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
index 7e9b0b6ca8..30bc21d573 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
+++ b/apps/web/src/components/app/split-layout/split-router/app-middleware.ts
@@ -22,6 +22,7 @@ import {
type SplitRouterMiddlewareResult,
} from '@app/lib/split-router';
import { replaceSplitSearchParams } from '@app/lib/split-router/search';
+import { URL_PARAMS as CALL_URL_PARAMS } from '@block-call/constants';
import { URL_PARAMS as CHANNEL_URL_PARAMS } from '@block-channel/constants';
import { URL_PARAMS as MD_URL_PARAMS } from '@block-md/constants';
import { URL_PARAMS as PDF_URL_PARAMS } from '@block-pdf/constants';
@@ -170,6 +171,10 @@ function migrateLegacySearch({
namespace: CALENDAR_SEARCH_NAMESPACE,
fields: [['eventId', 'eventId']] as const,
}))
+ .with('call-detail', () => ({
+ namespace: 'call-detail',
+ fields: [[CALL_URL_PARAMS.transcriptId, 'transcriptId']] as const,
+ }))
.otherwise(() => undefined);
if (!mapping) return;
diff --git a/apps/web/src/components/app/split-layout/split-router/app-routes.ts b/apps/web/src/components/app/split-layout/split-router/app-routes.ts
index 54b1b75e08..e02f02f7e2 100644
--- a/apps/web/src/components/app/split-layout/split-router/app-routes.ts
+++ b/apps/web/src/components/app/split-layout/split-router/app-routes.ts
@@ -5,6 +5,8 @@ import {
agentsViewRoute,
codersRoute,
} from '@app/features/agents-view/route';
+import { callDetailRoute } from '@app/features/block-call/route';
+import { prDetailRoute } from '@app/features/block-pr/route';
import { calendarSplitRoute } from '@app/features/calendar-view/route';
import { channelsSplitRoute } from '@app/features/channels-view/route';
import { companiesRoute } from '@app/features/companies/route';
@@ -45,9 +47,11 @@ export const appSplitRoutes = defineRoutes({
calendarSplitRoute,
channelsSplitRoute,
callsRoute,
+ callDetailRoute,
companiesRoute,
foldersRoute,
searchRoute,
+ prDetailRoute,
...debugRoutes,
legacySplitRoute,
],
diff --git a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts b/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
index ea7cf50ab4..5b5141b1d8 100644
--- a/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
+++ b/apps/web/src/components/app/split-layout/split-router/legacy-route.ts
@@ -243,6 +243,22 @@ export function splitLocationFromContent(
};
}
+ if (content.type === 'pr') {
+ return {
+ route: {
+ matches: [{ id: 'pr-detail', params: { foreignEntityId: content.id } }],
+ },
+ };
+ }
+
+ if (content.type === 'call') {
+ return {
+ route: {
+ matches: [{ id: 'call-detail', params: { callId: content.id } }],
+ },
+ };
+ }
+
if (content.type === 'component' && content.id === 'documents') {
return { route: { matches: [{ id: 'drive', params: {} }] } };
}
@@ -331,6 +347,20 @@ export function splitContentFromLocation(
return { type: 'component', id: root.id.slice('view-'.length) };
if (root.id === 'drive') return { type: 'component', id: 'documents' };
if (root.id === 'settings') return { type: 'component', id: 'settings' };
+ if (root.id === 'pr-detail') {
+ const { foreignEntityId } = routeParams(location.route);
+ if (typeof foreignEntityId === 'string' && foreignEntityId.length > 0) {
+ return { type: 'pr', id: foreignEntityId };
+ }
+ throw new Error('Invalid PR detail split route');
+ }
+ if (root.id === 'call-detail') {
+ const { callId } = routeParams(location.route);
+ if (typeof callId === 'string' && callId.length > 0) {
+ return { type: 'call', id: callId };
+ }
+ throw new Error('Invalid call detail split route');
+ }
const params = routeParams(location.route);
if (
diff --git a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
index def025a7d6..0c9e99737e 100644
--- a/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
+++ b/apps/web/src/components/app/split-layout/tests/layoutManager.test.ts
@@ -900,6 +900,113 @@ describe('layoutManager', () => {
}
);
+ it('opens a PR on its standalone route and keeps the existing block content identity', async () => {
+ const { manager, location, router, dispose } = ingressRouter('/pr/pr-1');
+ await router.settled();
+ const split = manager.splits()[0];
+ expect(split.content).toMatchObject({ type: 'pr', id: 'pr-1' });
+ expect(router.route(split.id)?.matches).toEqual([
+ { id: 'pr-detail', params: { foreignEntityId: 'pr-1' } },
+ ]);
+ expect(location.read().pathname).toBe('/pr/pr-1');
+ router.dispose();
+ dispose();
+ });
+
+ it('uses the PR route for existing split navigation', async () => {
+ const { manager, location, router, dispose } = ingressRouter('/inbox');
+ await router.settled();
+ manager.getSplit(manager.splits()[0].id)!.replace({
+ next: { type: 'pr', id: 'pr-2' },
+ });
+ await router.settled();
+ expect(location.read().pathname).toBe('/pr/pr-2');
+ router.dispose();
+ dispose();
+ });
+
+ it('opens a call on its detail route with the existing block content identity', async () => {
+ const { manager, location, router, dispose } =
+ ingressRouter('/call/call-1');
+ await router.settled();
+ const split = manager.splits()[0];
+ expect(split.content).toMatchObject({ type: 'call', id: 'call-1' });
+ expect(router.route(split.id)?.matches).toEqual([
+ { id: 'call-detail', params: { callId: 'call-1' } },
+ ]);
+ expect(location.read().pathname).toBe('/call/call-1');
+ router.dispose();
+ dispose();
+ });
+
+ it('uses the call detail route for existing split navigation', async () => {
+ const { manager, location, router, dispose } = ingressRouter('/inbox');
+ await router.settled();
+ manager.getSplit(manager.splits()[0].id)!.replace({
+ next: { type: 'call', id: 'call-2' },
+ });
+ await router.settled();
+ expect(location.read().pathname).toBe('/call/call-2');
+ router.dispose();
+ dispose();
+ });
+
+ it('retains pane-local transcript targeting during call navigation', async () => {
+ const { manager, router, dispose } = ingressRouter('/inbox');
+ await router.settled();
+ const split = manager.getSplit(manager.splits()[0].id)!;
+ split.replace({
+ next: {
+ type: 'call',
+ id: 'call-2',
+ entryMetadata: {
+ search: { 'call-detail': { transcriptId: ['segment-2'] } },
+ },
+ },
+ });
+ await router.settled();
+ expect(router.search(split.id, 'call-detail')).toEqual({
+ transcriptId: ['segment-2'],
+ });
+ const mount = manager.splits()[0].mount;
+ split.replace({
+ next: {
+ type: 'call',
+ id: 'call-2',
+ entryMetadata: {
+ search: {
+ 'call-detail': { transcriptId: ['segment-2'], seek: ['again'] },
+ },
+ },
+ },
+ mergeHistory: true,
+ });
+ await router.settled();
+ expect(router.search(split.id, 'call-detail')).toEqual({
+ transcriptId: ['segment-2'],
+ seek: ['again'],
+ });
+ expect(manager.splits()[0].mount).toBe(mount);
+ router.dispose();
+ dispose();
+ });
+
+ it('restores a call transcript target from a copied link', async () => {
+ const { manager, location, router, dispose } = ingressRouter(
+ '/call/call-1?call_transcript_id=segment-1'
+ );
+ await router.settled();
+ const split = manager.splits()[0];
+ expect(router.search(split.id, 'call-detail')).toEqual({
+ transcriptId: ['segment-1'],
+ });
+ expect(
+ new URLSearchParams(location.read().search).get('call_transcript_id')
+ ).toBe('segment-1');
+ router.dispose();
+ dispose();
+ });
+
it('keeps Drive list routes on touch', async () => {
const { location, router, dispose } = ingressRouter(
'/drive/~/drive/shared/~/drive/folder/folder',
diff --git a/apps/web/src/features/block-call/call-route.ts b/apps/web/src/features/block-call/call-route.ts
new file mode 100644
index 0000000000..f1313156d0
--- /dev/null
+++ b/apps/web/src/features/block-call/call-route.ts
@@ -0,0 +1,10 @@
+import { createSearchParamsCodec } from '@app/lib/split-router';
+import { z } from 'zod';
+
+export const callDetailSearch = {
+ namespace: 'call-detail',
+ schema: z.object({ transcriptId: z.string(), seek: z.string() }),
+ defaults: { transcriptId: '', seek: '' },
+};
+
+export const callDetailSearchCodec = createSearchParamsCodec(callDetailSearch);
diff --git a/apps/web/src/features/block-call/component/CallBlockAdapter.tsx b/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
index 510e991d52..b3d43f2584 100644
--- a/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
+++ b/apps/web/src/features/block-call/component/CallBlockAdapter.tsx
@@ -1,5 +1,9 @@
import { globalSplitManager } from '@app/signal/splitLayout';
-import { URL_PARAMS } from '@block-call/constants';
+import {
+ type CallBlockProps,
+ type CallTranscriptTarget,
+ URL_PARAMS,
+} from '@block-call/constants';
import { SidePanel } from '@components/app/side-panel';
import { useBlockId } from '@core/block';
import { DocumentBlockContainer } from '@core/component/DocumentBlockContainer';
@@ -9,15 +13,10 @@ import { useCallRecordQuery } from '@queries/call/call';
import { useSearchParams } from '@solidjs/router';
import { createSignal, Show } from 'solid-js';
import { CallRecordingBody } from './CallRecording/CallRecordingBody';
+import { CallRecordingSplitHeader } from './CallRecording/CallRecordingSplitHeader';
import { ModalsProvider } from './ModalsProvider';
import { CallSidePanelSections } from './sidepanel/CallSidePanelSections';
-export type CallBlockProps = {
- [URL_PARAMS.transcriptId]?: string;
-};
-
-export type CallTranscriptTarget = { transcriptId: string; gen: number };
-
export function CallBlockAdapter(props: CallBlockProps) {
const callId = useBlockId();
const callRecord = useCallRecordQuery(() => callId);
@@ -62,10 +61,12 @@ export function CallBlockAdapter(props: CallBlockProps) {
<Show when={callRecord.data}>
{(data) => (
<SidePanel.Layout>
- <CallSidePanelSections record={data} />
+ <CallSidePanelSections record={data} callId={callId} />
<div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden @container">
+ <CallRecordingSplitHeader record={data} />
<CallRecordingBody
data={data}
+ callId={callId}
transcriptTarget={transcriptTarget}
/>
</div>
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 ec13739a0b..58ec1878bf 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingBody.tsx
@@ -1,14 +1,13 @@
import { AskMacroButton } from '@app/features/chat/ChatWithAgentButton';
import { SidePanel } from '@components/app/side-panel';
-import { useBlockId } from '@core/block';
import { CustomScrollbar } from '@core/component/CustomScrollbar';
import { isMobile } from '@core/mobile/isMobile';
import type { CallRecord } from '@service-call/client';
import { format } from 'date-fns';
import type { Accessor } from 'solid-js';
import { createEffect, createMemo, createSignal, on, Show } from 'solid-js';
+import type { CallTranscriptTarget } from '../../constants';
import { formatCallDuration } from '../../utils';
-import type { CallTranscriptTarget } from '../CallBlockAdapter';
import { CallTranscript } from '../CallTranscript';
import {
getActiveTranscriptSequenceNum,
@@ -16,7 +15,6 @@ import {
sortTranscriptSegments,
} from '../transcript-playback';
import { CallRecordingParticipantsSection } from './CallRecordingParticipants';
-import { CallRecordingSplitHeader } from './CallRecordingSplitHeader';
import { CallRecordingSummarySection } from './CallRecordingSummary';
import { CallRecordingVideo } from './CallRecordingVideo';
import {
@@ -26,10 +24,10 @@ import {
export function CallRecordingBody(props: {
data: Accessor<CallRecord>;
+ callId: string;
transcriptTarget?: Accessor<CallTranscriptTarget | undefined>;
}) {
const record = props.data;
- const blockId = useBlockId();
const hasTranscripts = createMemo(() => record().transcript.length > 0);
const [playbackSeconds, setPlaybackSeconds] = createSignal(0);
const [allowFutureLead, setAllowFutureLead] = createSignal(true);
@@ -136,99 +134,96 @@ export function CallRecordingBody(props: {
});
return (
- <>
- <CallRecordingSplitHeader record={record} />
- <div class="relative flex-1 min-h-0 overflow-hidden">
- <SidePanel.Section
- id="call-ai-actions"
- title="Actions"
- defaultOpen
- order={0}
- >
- <div class="m-px flex items-center justify-start gap-2">
- <AskMacroButton
- entity={{
- type: 'document',
- id: blockId,
- name: callTitle(),
- fileType: 'call',
- }}
- />
- </div>
- </SidePanel.Section>
- <div
- class="h-full min-h-0 overflow-y-auto scrollbar-hidden"
- ref={setScrollRef}
- >
- <div class="mx-auto max-w-3xl min-w-0 px-6 pt-12 pb-16 touch:pt-(--mobile-content-inset-top) touch:pb-(--mobile-content-inset-bottom)">
- <div class="flex flex-col gap-10">
- <header>
- <Show when={!isMobile()}>
- <div class="h-8 mb-4" />
- </Show>
- <h1 class="text-2xl font-semibold text-ink text-balance">
- {callTitle()}
- </h1>
- <div class="mt-3 flex flex-wrap items-center gap-x-2 text-sm text-ink-muted">
- <Show when={formattedDate()}>
- {(date) => <span>{date()}</span>}
- </Show>
- <Show when={formattedDuration()}>
- {(dur) => (
- <>
- <span class="text-ink-extra-muted">&middot;</span>
- <span>{dur()}</span>
- </>
- )}
- </Show>
- <Show when={record().isActive}>
- <span class="text-success font-medium">In progress</span>
- </Show>
- </div>
- </header>
-
- <CallRecordingParticipantsSection record={record} />
-
- <CallRecordingSummarySection record={record} />
-
- <Show when={record().recordingUrl}>
- {(url) => (
- <section class="flex flex-col gap-3">
- <h3 class="text-sm font-semibold text-ink">Recording</h3>
- <div class="overflow-hidden rounded border border-edge-muted/50">
- <CallRecordingVideo
- url={url()}
- posterUrl={record().recordingPreviewUrl ?? undefined}
- onTimeUpdate={handleTimeUpdate}
- setVideoRef={setVideoRef}
- />
- </div>
- </section>
- )}
+ <div class="relative flex-1 min-h-0 overflow-hidden">
+ <SidePanel.Section
+ id="call-ai-actions"
+ title="Actions"
+ defaultOpen
+ order={0}
+ >
+ <div class="m-px flex items-center justify-start gap-2">
+ <AskMacroButton
+ entity={{
+ type: 'document',
+ id: props.callId,
+ name: callTitle(),
+ fileType: 'call',
+ }}
+ />
+ </div>
+ </SidePanel.Section>
+ <div
+ class="h-full min-h-0 overflow-y-auto scrollbar-hidden"
+ ref={setScrollRef}
+ >
+ <div class="mx-auto max-w-3xl min-w-0 px-6 pt-12 pb-16 touch:pt-(--mobile-content-inset-top) touch:pb-(--mobile-content-inset-bottom)">
+ <div class="flex flex-col gap-10">
+ <header>
+ <Show when={!isMobile()}>
+ <div class="h-8 mb-4" />
</Show>
+ <h1 class="text-2xl font-semibold text-ink text-balance">
+ {callTitle()}
+ </h1>
+ <div class="mt-3 flex flex-wrap items-center gap-x-2 text-sm text-ink-muted">
+ <Show when={formattedDate()}>
+ {(date) => <span>{date()}</span>}
+ </Show>
+ <Show when={formattedDuration()}>
+ {(dur) => (
+ <>
+ <span class="text-ink-extra-muted">&middot;</span>
+ <span>{dur()}</span>
+ </>
+ )}
+ </Show>
+ <Show when={record().isActive}>
+ <span class="text-success font-medium">In progress</span>
+ </Show>
+ </div>
+ </header>
+
+ <CallRecordingParticipantsSection record={record} />
+
+ <CallRecordingSummarySection record={record} />
- <Show when={hasTranscripts()}>
+ <Show when={record().recordingUrl}>
+ {(url) => (
<section class="flex flex-col gap-3">
- <h3 class="text-sm font-semibold text-ink">Transcript</h3>
- <div class="flex flex-col max-h-[min(600px,60vh)] overflow-hidden rounded border border-edge-muted/50">
- <CallTranscript
- transcript={record().transcript}
- channelId={record().channelId}
- record={record()}
- timelineStartMs={timelineStartMs()}
- activeSequenceNum={activeSequenceNum()}
- videoSeekGeneration={videoSeekGeneration()}
- onSeekToSeconds={seekToSeconds}
- hideHeader
+ <h3 class="text-sm font-semibold text-ink">Recording</h3>
+ <div class="overflow-hidden rounded border border-edge-muted/50">
+ <CallRecordingVideo
+ url={url()}
+ posterUrl={record().recordingPreviewUrl ?? undefined}
+ onTimeUpdate={handleTimeUpdate}
+ setVideoRef={setVideoRef}
/>
</div>
</section>
- </Show>
- </div>
+ )}
+ </Show>
+
+ <Show when={hasTranscripts()}>
+ <section class="flex flex-col gap-3">
+ <h3 class="text-sm font-semibold text-ink">Transcript</h3>
+ <div class="flex flex-col max-h-[min(600px,60vh)] overflow-hidden rounded border border-edge-muted/50">
+ <CallTranscript
+ transcript={record().transcript}
+ channelId={record().channelId}
+ record={record()}
+ timelineStartMs={timelineStartMs()}
+ activeSequenceNum={activeSequenceNum()}
+ videoSeekGeneration={videoSeekGeneration()}
+ onSeekToSeconds={seekToSeconds}
+ hideHeader
+ />
+ </div>
+ </section>
+ </Show>
</div>
</div>
- <CustomScrollbar scrollContainer={scrollRef} />
</div>
- </>
+ <CustomScrollbar scrollContainer={scrollRef} />
+ </div>
);
}
diff --git a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx
index 4e543a267d..2ea9edd237 100644
--- a/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx
+++ b/apps/web/src/features/block-call/component/CallRecording/CallRecordingSplitHeader.tsx
@@ -3,9 +3,6 @@ import {
ChatWithAgentIcon,
openChatWithAgent,
} from '@app/features/chat/ChatWithAgentButton';
-import { useQuickCallsFlag } from '@app/features/meetings/use-quick-calls-flag';
-import { getMeetingPath } from '@channel/Call/call-link';
-import { joinChannelCall } from '@channel/Call/join-channel-call';
import {
type BlockTool,
ResponsiveBlockToolbar,
@@ -28,11 +25,10 @@ import { isMobile } from '@core/mobile/isMobile';
import { buildEntityData } from '@entity';
import IconShared from '@icon/share.svg';
import PhoneCallIcon from '@phosphor/phone-call.svg';
-import { useCallLinkQuery } from '@queries/call/meetings';
import type { CallRecord } from '@service-call/client';
-import { useNavigate } from '@solidjs/router';
import { Button } from '@ui';
import { type Accessor, Show } from 'solid-js';
+import { useCallAgain } from '../use-call-again';
export function CallRecordingSplitHeaderLoading() {
return (
@@ -58,26 +54,10 @@ export function CallRecordingSplitHeader(props: {
const blockId = useBlockId();
const shareCtx = useShareDialogContext();
const callName = () => record().customName ?? record().channelName ?? 'Call';
- const navigate = useNavigate();
- const flag = useQuickCallsFlag();
- const quickCallsEnabled = () => !flag().loading && flag().enabled;
- const meeting = useCallLinkQuery(() =>
- quickCallsEnabled() && !record().channelId ? record().callId : undefined
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => record().callId,
+ () => record().channelId
);
- const shareToken = () =>
- quickCallsEnabled() && meeting.isSuccess
- ? meeting.data?.shareToken
- : undefined;
- const canCallAgain = () => Boolean(record().channelId || shareToken());
- const callAgain = () => {
- const channelId = record().channelId;
- if (channelId) {
- void joinChannelCall(channelId);
- return;
- }
- const token = shareToken();
- if (token) navigate(getMeetingPath(token));
- };
const shareTool: BlockTool = {
label: 'Share',
diff --git a/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx b/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
index ec67512244..fbda7cbc1a 100644
--- a/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
+++ b/apps/web/src/features/block-call/component/sidepanel/CallSidePanelSections.tsx
@@ -2,7 +2,6 @@ import { EntityActivitySectionConditional } from '@app/features/activity/views/e
import { EntityPropertiesSection } from '@app/features/property/side-panel/properties';
import { useCallContextOptional } from '@channel/Call/CallContext';
import { SidePanel } from '@components/app/side-panel';
-import { useBlockId } from '@core/block';
import { References } from '@core/component/References';
import { UserIcon } from '@core/component/UserIcon';
import { useUserId } from '@core/context/user';
@@ -22,11 +21,10 @@ import { formatCallDuration } from '../../utils';
interface CallSidePanelSectionsProps {
record: Accessor<CallRecord>;
+ callId: string;
}
export function CallSidePanelSections(props: CallSidePanelSectionsProps) {
- const blockId = useBlockId();
-
return (
<>
<SidePanel.Section id="details" title="Details" defaultOpen order={10}>
@@ -50,7 +48,7 @@ export function CallSidePanelSections(props: CallSidePanelSectionsProps) {
entityType="CALL_RECORD"
order={40}
/>
- <ReferencesSectionConditional callId={blockId} />
+ <ReferencesSectionConditional callId={props.callId} />
</>
);
}
@@ -232,7 +230,7 @@ function ReferencesSectionConditional(props: { callId: string }) {
() => 'call'
);
- const count = () => references.data?.length ?? 0;
+ const count = () => (references.isSuccess ? references.data.length : 0);
return (
<Show when={count() > 0}>
diff --git a/apps/web/src/features/block-call/component/use-call-again.test.ts b/apps/web/src/features/block-call/component/use-call-again.test.ts
new file mode 100644
index 0000000000..980a428fb0
--- /dev/null
+++ b/apps/web/src/features/block-call/component/use-call-again.test.ts
@@ -0,0 +1,85 @@
+import { createRoot } from 'solid-js';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { useCallAgain } from './use-call-again';
+
+const mocks = vi.hoisted(() => ({
+ navigate: vi.fn(),
+ joinChannelCall: vi.fn(),
+ state: { enabled: true, shareToken: undefined as string | undefined },
+}));
+
+vi.mock('@solidjs/router', () => ({ useNavigate: () => mocks.navigate }));
+vi.mock('@channel/Call/join-channel-call', () => ({
+ joinChannelCall: mocks.joinChannelCall,
+}));
+vi.mock('@app/features/meetings/use-quick-calls-flag', () => ({
+ useQuickCallsFlag: () => () => ({
+ loading: false,
+ enabled: mocks.state.enabled,
+ }),
+}));
+vi.mock('@queries/call/meetings', () => ({
+ useCallLinkQuery: (callId: () => string | undefined) => ({
+ get isSuccess() {
+ return Boolean(callId() && mocks.state.shareToken);
+ },
+ get data() {
+ return mocks.state.shareToken
+ ? { shareToken: mocks.state.shareToken }
+ : undefined;
+ },
+ }),
+}));
+
+beforeEach(() => {
+ mocks.navigate.mockReset();
+ mocks.joinChannelCall.mockReset();
+ mocks.state.enabled = true;
+ mocks.state.shareToken = undefined;
+});
+
+describe('useCallAgain', () => {
+ it('rejoins a channel call without opening a meeting link', () => {
+ createRoot((dispose) => {
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => 'call-id',
+ () => 'channel-id'
+ );
+ expect(canCallAgain()).toBe(true);
+ callAgain();
+ expect(mocks.joinChannelCall).toHaveBeenCalledWith('channel-id');
+ expect(mocks.navigate).not.toHaveBeenCalled();
+ dispose();
+ });
+ });
+
+ it('opens a standalone meeting invitation when quick calls are enabled', () => {
+ mocks.state.shareToken = 'invite-token';
+ createRoot((dispose) => {
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => 'call-id',
+ () => null
+ );
+ expect(canCallAgain()).toBe(true);
+ callAgain();
+ expect(mocks.navigate).toHaveBeenCalledWith('/meet/join/invite-token');
+ expect(mocks.joinChannelCall).not.toHaveBeenCalled();
+ dispose();
+ });
+ });
+
+ it('hides standalone rejoin when quick calls are disabled', () => {
+ mocks.state.shareToken = 'invite-token';
+ mocks.state.enabled = false;
+ createRoot((dispose) => {
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => 'call-id',
+ () => undefined
+ );
+ expect(canCallAgain()).toBe(false);
+ callAgain();
+ expect(mocks.navigate).not.toHaveBeenCalled();
+ dispose();
+ });
+ });
+});
diff --git a/apps/web/src/features/block-call/component/use-call-again.ts b/apps/web/src/features/block-call/component/use-call-again.ts
new file mode 100644
index 0000000000..6acaabe724
--- /dev/null
+++ b/apps/web/src/features/block-call/component/use-call-again.ts
@@ -0,0 +1,35 @@
+import { useQuickCallsFlag } from '@app/features/meetings/use-quick-calls-flag';
+import { getMeetingPath } from '@channel/Call/call-link';
+import { joinChannelCall } from '@channel/Call/join-channel-call';
+import { useCallLinkQuery } from '@queries/call/meetings';
+import { useNavigate } from '@solidjs/router';
+import type { Accessor } from 'solid-js';
+
+/** Rejoin a channel call or open the invitation for a standalone meeting. */
+export function useCallAgain(
+ callId: Accessor<string>,
+ channelId: Accessor<string | null | undefined>
+) {
+ const navigate = useNavigate();
+ const flag = useQuickCallsFlag();
+ const quickCallsEnabled = () => !flag().loading && flag().enabled;
+ const meeting = useCallLinkQuery(() =>
+ quickCallsEnabled() && !channelId() ? callId() : undefined
+ );
+ const shareToken = () =>
+ quickCallsEnabled() && meeting.isSuccess
+ ? meeting.data?.shareToken
+ : undefined;
+ const canCallAgain = () => Boolean(channelId() || shareToken());
+ const callAgain = () => {
+ const channel = channelId();
+ if (channel) {
+ void joinChannelCall(channel);
+ return;
+ }
+ const token = shareToken();
+ if (token) navigate(getMeetingPath(token));
+ };
+
+ return { canCallAgain, callAgain };
+}
diff --git a/apps/web/src/features/block-call/constants.ts b/apps/web/src/features/block-call/constants.ts
index 91effbc02d..961ed282ed 100644
--- a/apps/web/src/features/block-call/constants.ts
+++ b/apps/web/src/features/block-call/constants.ts
@@ -1,3 +1,9 @@
export const URL_PARAMS = {
transcriptId: 'call_transcript_id',
};
+
+export type CallBlockProps = {
+ [URL_PARAMS.transcriptId]?: string;
+};
+
+export type CallTranscriptTarget = { transcriptId: string; gen: number };
diff --git a/apps/web/src/features/block-call/route.tsx b/apps/web/src/features/block-call/route.tsx
new file mode 100644
index 0000000000..3810124335
--- /dev/null
+++ b/apps/web/src/features/block-call/route.tsx
@@ -0,0 +1,35 @@
+import { useAnalytics } from '@app/lib/analytics/analytics-context';
+import { defineRoute, useRouteParams } from '@app/lib/split-router';
+import { withAuth } from '@components/app/split-layout/split-router/app-route-shell';
+import { lazy, onMount } from 'solid-js';
+import { z } from 'zod';
+import { callDetailSearch } from './call-route';
+import { URL_PARAMS } from './constants';
+
+const CallDetailView = lazy(async () => ({
+ default: (await import('./views/CallDetailView')).CallDetailView,
+}));
+
+const CallDetailRouteView = withAuth(() => {
+ const params = useRouteParams(callDetailRoute);
+ const analytics = useAnalytics();
+ onMount(() => {
+ analytics.pageView('call');
+ analytics.track('open_entity', {
+ entityType: 'call',
+ entityId: params.callId,
+ });
+ });
+ return <CallDetailView callId={params.callId} />;
+});
+
+export const callDetailRoute = defineRoute({
+ id: 'call-detail',
+ path: 'call/:callId',
+ params: z.object({ callId: z.string().min(1) }),
+ search: [callDetailSearch.namespace],
+ externalSearch: [URL_PARAMS.transcriptId],
+ component: CallDetailRouteView,
+ remountKey: ({ callId }) => callId,
+ claim: ({ callId }) => ({ namespace: 'block', id: `call:${callId}` }),
+});
diff --git a/apps/web/src/features/block-call/views/CallDetailView.tsx b/apps/web/src/features/block-call/views/CallDetailView.tsx
new file mode 100644
index 0000000000..6465d1715d
--- /dev/null
+++ b/apps/web/src/features/block-call/views/CallDetailView.tsx
@@ -0,0 +1,197 @@
+import { ViewShell } from '@app/components/view-shell';
+import { ChatWithAgentButton } from '@app/features/chat/ChatWithAgentButton';
+import { createSearchParams } from '@app/lib/split-router';
+import { SidePanel } from '@components/app/side-panel';
+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
+import { SplitPanel } from '@components/app/split-panel';
+import { getPermissions } from '@core/component/SharePermissions';
+import {
+ ShareDialogContext,
+ ShareModal,
+ ShareTrigger,
+} from '@core/component/TopBar/ShareButton';
+import { isMobile } from '@core/mobile/isMobile';
+import PhoneCallIcon from '@phosphor/phone-call.svg';
+import SpinnerIcon from '@phosphor/spinner.svg';
+import { useCallRecordQuery } from '@queries/call/call';
+import {
+ hasSoupEntity,
+ optimisticUpdateSoupItemViewedAt,
+ refetchSoupEntity,
+} from '@queries/soup/cache';
+import type { CallRecord } from '@service-storage/generated/schemas/callRecord';
+import { Button } from '@ui';
+import {
+ type Accessor,
+ createEffect,
+ createSignal,
+ Match,
+ on,
+ onMount,
+ Show,
+ Suspense,
+ Switch,
+} from 'solid-js';
+import { callDetailSearch } from '../call-route';
+import { CallRecordingBody } from '../component/CallRecording/CallRecordingBody';
+import { CallSidePanelSections } from '../component/sidepanel/CallSidePanelSections';
+import { useCallAgain } from '../component/use-call-again';
+import type { CallTranscriptTarget } from '../constants';
+
+function CallDetailContent(props: {
+ callId: string;
+ record: Accessor<CallRecord>;
+ transcriptTarget: Accessor<CallTranscriptTarget | undefined>;
+}) {
+ const panel = useSplitPanelOrThrow();
+ const [shareOpen, setShareOpen] = createSignal(false);
+ const { canCallAgain, callAgain } = useCallAgain(
+ () => props.callId,
+ () => props.record().channelId
+ );
+ const callName = () =>
+ props.record().customName ?? props.record().channelName ?? 'Call Recording';
+
+ onMount(() => {
+ optimisticUpdateSoupItemViewedAt(props.callId);
+ if (!hasSoupEntity(props.callId)) {
+ void refetchSoupEntity(props.callId, 'call');
+ }
+ });
+
+ return (
+ <ShareDialogContext.Provider
+ value={{
+ isOpen: shareOpen,
+ open: () => setShareOpen(true),
+ close: () => setShareOpen(false),
+ }}
+ >
+ <SidePanel.Layout
+ persistKey={`call:${props.callId}`}
+ headerToggle={false}
+ >
+ <CallSidePanelSections callId={props.callId} record={props.record} />
+ <div class="flex size-full min-h-0 min-w-0 flex-col overflow-hidden @container">
+ <ViewShell.TopBar class="touch:flex">
+ <SplitPanel.CloseButton class="hidden shrink-0 touch:flex" />
+ <PhoneCallIcon class="size-4 shrink-0 text-ink-muted" />
+ <span class="min-w-0 truncate text-sm font-semibold">
+ {callName()}
+ </span>
+ <div class="ml-auto flex shrink-0 items-center gap-2">
+ <Show
+ when={!isMobile() && !props.record().isActive && canCallAgain()}
+ >
+ <Button variant="outline" size="sm" onClick={callAgain}>
+ <PhoneCallIcon class="size-4" />
+ Call Again
+ </Button>
+ </Show>
+ <ChatWithAgentButton
+ entity={{
+ type: 'document',
+ id: props.callId,
+ name: callName(),
+ fileType: 'call',
+ }}
+ />
+ <ShareTrigger
+ id={props.callId}
+ blockType="call"
+ hotkeyScope={panel.splitHotkeyScope}
+ />
+ <SidePanel.Toggle />
+ </div>
+ </ViewShell.TopBar>
+ <CallRecordingBody
+ data={props.record}
+ callId={props.callId}
+ transcriptTarget={props.transcriptTarget}
+ />
+ </div>
+ </SidePanel.Layout>
+ <Suspense>
+ <ShareModal
+ isSharePermOpen={shareOpen()}
+ setIsSharePermOpen={setShareOpen}
+ id={props.callId}
+ blockAlias="call"
+ itemType="call"
+ name={callName()}
+ userPermissions={getPermissions(
+ props.record().userAccessLevel ?? undefined
+ )}
+ owner={props.record().createdBy}
+ />
+ </Suspense>
+ </ShareDialogContext.Provider>
+ );
+}
+
+export function CallDetailView(props: { callId: string }) {
+ const callRecord = useCallRecordQuery(() => props.callId);
+ const [searchParams] = createSearchParams(callDetailSearch);
+ const initialTranscriptId = searchParams.transcriptId;
+ const [transcriptTarget, setTranscriptTarget] = createSignal<
+ CallTranscriptTarget | undefined
+ >(
+ initialTranscriptId
+ ? { transcriptId: initialTranscriptId, gen: 0 }
+ : undefined
+ );
+ const navigateToTranscript = (transcriptId: string) => {
+ if (!transcriptId) return;
+ setTranscriptTarget((previous) => ({
+ transcriptId,
+ gen: (previous?.gen ?? 0) + 1,
+ }));
+ };
+
+ // Seek again when the same transcript is selected from another list result.
+ createEffect(
+ on(
+ () => [searchParams.transcriptId, searchParams.seek] as const,
+ ([id]) => {
+ if (id) navigateToTranscript(id);
+ },
+ { defer: true }
+ )
+ );
+
+ return (
+ <Switch>
+ <Match when={callRecord.isLoading}>
+ <div class="grid size-full place-items-center text-ink-muted">
+ <SpinnerIcon
+ aria-label="Loading call recording"
+ class="size-5 animate-spin"
+ />
+ </div>
+ </Match>
+ <Match when={callRecord.isError}>
+ <div class="grid size-full place-items-center text-ink-muted">
+ <div class="flex flex-col items-center gap-3 text-sm">
+ <span>This call recording could not be displayed.</span>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => void callRecord.refetch()}
+ >
+ Retry
+ </Button>
+ </div>
+ </div>
+ </Match>
+ <Match when={callRecord.isSuccess ? callRecord.data : undefined}>
+ {(record) => (
+ <CallDetailContent
+ callId={props.callId}
+ record={record}
+ transcriptTarget={transcriptTarget}
+ />
+ )}
+ </Match>
+ </Switch>
+ );
+}
diff --git a/apps/web/src/features/block-pr/component/Block.tsx b/apps/web/src/features/block-pr/component/Block.tsx
index 46bbbedc61..07c7ad9744 100644
--- a/apps/web/src/features/block-pr/component/Block.tsx
+++ b/apps/web/src/features/block-pr/component/Block.tsx
@@ -1,208 +1,7 @@
-import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
-import { SidePanel } from '@components/app/side-panel';
import { useBlockId } from '@core/block';
-import {
- StaticMarkdown,
- StaticMarkdownContext,
-} from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
-import { DebouncedNotificationReadMarker } from '@notifications';
-import type { GithubPullRequestWithDetails } from '@queries/storage/github-pull-requests';
-import { cn, Layer, Scroll } from '@ui';
-import { type Accessor, createMemo, Show } from 'solid-js';
-
-import { createPrDiscussionSource } from '../data/prDiscussionSource';
-import { usePrForeignEntityQuery } from '../data/queries';
-import {
- cleanGithubMarkdown,
- githubAvatarUrl,
- githubDisplayLogin,
-} from '../util/githubMarkdown';
-import type { PrRef } from '../util/prKey';
-import { prDisplayName } from '../util/prKey';
-import {
- PrDescriptionSkeleton,
- PrMetadataSkeleton,
- PrTimelineSkeleton,
- PrTitleSkeleton,
-} from './PrSkeletons';
-import { PR_PILL_CLASS, PrSplitHeader, PrStatusChip } from './PrSplitHeader';
-import { PrTimeline } from './PrTimeline';
-import { PrSidePanelSections } from './sidepanel/PrSidePanelSections';
+import { PrDetail } from '../views/PrDetail';
+/** Legacy block boundary for previews until the block runtime is retired. */
export default function PrBlock() {
- const blockId = useBlockId();
-
- return (
- <Show when={blockId}>
- {(id) => <PrBlockContent foreignEntityId={id()} />}
- </Show>
- );
-}
-
-function PrBlockContent(props: { foreignEntityId: string }) {
- const notificationSource = useGlobalNotificationSource();
- const foreignEntityQuery = usePrForeignEntityQuery(
- () => props.foreignEntityId
- );
-
- const prRef = createMemo(() => foreignEntityQuery.data?.prRef);
- const pullRequest = createMemo(() => foreignEntityQuery.data?.pullRequest);
-
- const loadFailed = createMemo(
- () => !pullRequest() && !!foreignEntityQuery.error
- );
-
- // Block-lifetime local Macro discussion (prototype-only, lost on reload).
- const discussionSource = createPrDiscussionSource();
-
- return (
- <div class="size-full overflow-hidden flex flex-col relative">
- <DebouncedNotificationReadMarker
- notificationSource={notificationSource}
- entity={{ type: 'foreign_entity', id: props.foreignEntityId }}
- />
- <SidePanel.Layout>
- <PrSidePanelSections enrichment={pullRequest} />
- <div class="flex flex-col size-full min-w-0">
- <Show when={prRef()}>
- {(ref) => (
- <PrSplitHeader prRef={ref()} enrichment={pullRequest()} />
- )}
- </Show>
-
- <Scroll class="flex-1 min-h-0">
- <div class="max-w-3xl mx-auto px-6 pt-12 pb-12 min-w-0">
- <Show
- when={prRef()}
- fallback={
- <>
- <PrTitleSkeleton />
- <div class="spacer h-3" />
- <PrMetadataSkeleton />
- <PrDescriptionSkeleton />
- <PrTimelineSkeleton />
- </>
- }
- >
- {(ref) => (
- <>
- <PrTitle prRef={ref()} pullRequest={pullRequest} />
- <div class="spacer h-3" />
- <PrMetadata prRef={ref()} pullRequest={pullRequest} />
- <PrDescription pullRequest={pullRequest} />
- <PrLoadErrorBanner loadFailed={loadFailed} />
- <PrTimeline
- githubItems={pullRequest()?.comments ?? []}
- source={discussionSource}
- />
- </>
- )}
- </Show>
- </div>
- </Scroll>
- </div>
- </SidePanel.Layout>
- </div>
- );
-}
-
-function PrTitle(props: {
- prRef: PrRef;
- pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
-}) {
- return (
- <h1 class="ph-no-capture text-2xl font-semibold">
- {props.pullRequest()?.name ?? prDisplayName(props.prRef)}
- </h1>
- );
-}
-
-function PrMetadata(props: {
- prRef: PrRef;
- pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
-}) {
- const pullRequest = () => props.pullRequest();
-
- return (
- <div class="mb-6 flex flex-row flex-wrap items-center gap-2 text-sm empty:hidden">
- <Show when={pullRequest()?.status}>
- {(status) => <PrStatusChip status={status()} />}
- </Show>
- <Show when={pullRequest()?.authorLogin}>
- {(authorLogin) => (
- <Layer depth={2}>
- <a
- href={`https://github.com/${githubDisplayLogin(authorLogin())}`}
- target="_blank"
- rel="noreferrer"
- class={cn(PR_PILL_CLASS, 'text-ink-muted hover:bg-hover')}
- >
- <img
- src={githubAvatarUrl(authorLogin())}
- alt=""
- class="size-3.5 rounded-full shrink-0"
- loading="lazy"
- />
- <span class="truncate">{githubDisplayLogin(authorLogin())}</span>
- </a>
- </Layer>
- )}
- </Show>
- <Layer depth={2}>
- <a
- href={pullRequest()?.url}
- target="_blank"
- rel="noreferrer"
- class={cn(PR_PILL_CLASS, 'text-ink-muted hover:bg-hover')}
- >
- {prDisplayName(props.prRef)}
- </a>
- </Layer>
- <Show
- when={
- pullRequest()?.additions != null || pullRequest()?.deletions != null
- }
- >
- <Layer depth={2}>
- <span class={PR_PILL_CLASS}>
- <span class="text-success">+{pullRequest()?.additions ?? 0}</span>
- <span class="text-failure">−{pullRequest()?.deletions ?? 0}</span>
- </span>
- </Layer>
- </Show>
- </div>
- );
-}
-
-function PrDescription(props: {
- pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
-}) {
- const description = createMemo(() => {
- const raw = props.pullRequest()?.description;
- if (!raw) return null;
- const cleaned = cleanGithubMarkdown(raw);
- return cleaned || null;
- });
-
- return (
- <Show when={description()}>
- {(markdown) => (
- <StaticMarkdownContext>
- <div class="ph-no-capture text-sm wrap-break-word max-w-full overflow-x-auto">
- <StaticMarkdown markdown={markdown()} target="internal" />
- </div>
- </StaticMarkdownContext>
- )}
- </Show>
- );
-}
-
-function PrLoadErrorBanner(props: { loadFailed: Accessor<boolean> }) {
- return (
- <Show when={props.loadFailed()}>
- <div class="mt-6 px-3 py-2 rounded-lg border border-edge-muted text-xs text-ink-muted">
- Couldn't load this pull request from cached GitHub data.
- </div>
- </Show>
- );
+ return <PrDetail foreignEntityId={useBlockId()} />;
}
diff --git a/apps/web/src/features/block-pr/component/PrSplitHeader.tsx b/apps/web/src/features/block-pr/component/PrSplitHeader.tsx
index 2b37cecdec..45d0cc187d 100644
--- a/apps/web/src/features/block-pr/component/PrSplitHeader.tsx
+++ b/apps/web/src/features/block-pr/component/PrSplitHeader.tsx
@@ -1,11 +1,14 @@
import {
- type BlockTool,
- ResponsiveBlockToolbar,
-} from '@components/app/ResponsiveBlockToolbar';
-import type { FileOperation } from '@components/app/split-layout/components/SplitFileMenu';
+ type FileOperation,
+ SplitFileMenu,
+} from '@components/app/split-layout/components/SplitFileMenu';
import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';
-import { StaticSplitLabel } from '@components/app/split-layout/components/SplitLabel';
-import { useBlockId } from '@core/block';
+import {
+ SplitTitleFileMenu,
+ StaticSplitLabel,
+} from '@components/app/split-layout/components/SplitLabel';
+import { Permissions } from '@core/component/SharePermissions';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { openExternalUrl } from '@core/util/url';
import GithubIcon from '@icon/mcp-github.svg';
import GitMerge from '@phosphor/git-merge.svg';
@@ -74,15 +77,15 @@ export function PrStatusChip(props: { status: string; class?: string }) {
}
/**
- * PR identity in the split header chrome plus the standard split toolbar:
- * file menu (open on GitHub), side panel toggle, and narrow content/info
- * tabs — matching the other block types.
+ * PR identity in the split header chrome and file menu, independent of the
+ * legacy block context. Foreign PRs have the same read-only permission that
+ * the legacy BlockLoader supplied by default.
*/
export function PrSplitHeader(props: {
+ foreignEntityId: string;
prRef: PrRef;
enrichment: GithubPullRequest | undefined;
}) {
- const blockId = useBlockId();
const title = () => props.enrichment?.name ?? prDisplayName(props.prRef);
const githubUrl = () => props.enrichment?.url ?? prHtmlUrl(props.prRef);
@@ -94,8 +97,6 @@ export function PrSplitHeader(props: {
},
];
- const tools: BlockTool[] = [];
-
return (
<>
<SplitHeaderLeft>
@@ -110,13 +111,17 @@ export function PrSplitHeader(props: {
/>
</SplitHeaderLeft>
- <ResponsiveBlockToolbar
- tools={tools}
- ops={ops}
- id={blockId}
- itemType="foreign"
- name={title()}
- />
+ <SplitTitleFileMenu>
+ <SplitFileMenu
+ id={props.foreignEntityId}
+ itemType="foreign"
+ entityKind="pr"
+ permissions={Permissions.CAN_VIEW}
+ name={title()}
+ ops={ops}
+ buttonClass={isTouchDevice() ? 'order-last' : 'order-first'}
+ />
+ </SplitTitleFileMenu>
</>
);
}
diff --git a/apps/web/src/features/block-pr/route.tsx b/apps/web/src/features/block-pr/route.tsx
new file mode 100644
index 0000000000..fc4fa4f061
--- /dev/null
+++ b/apps/web/src/features/block-pr/route.tsx
@@ -0,0 +1,34 @@
+import { useAnalytics } from '@app/lib/analytics/analytics-context';
+import { defineRoute, useParams } from '@app/lib/split-router';
+import { withAuth } from '@components/app/split-layout/split-router/app-route-shell';
+import { lazy, onMount } from 'solid-js';
+import { z } from 'zod';
+
+const PrDetail = lazy(async () => ({
+ default: (await import('./views/PrDetail')).PrDetail,
+}));
+
+const PrDetailRouteView = withAuth(() => {
+ const params = useParams<{ foreignEntityId: string }>();
+ const analytics = useAnalytics();
+ onMount(() => {
+ analytics.pageView('pr');
+ analytics.track('open_entity', {
+ entityType: 'pr',
+ entityId: params.foreignEntityId,
+ });
+ });
+ return <PrDetail foreignEntityId={params.foreignEntityId} />;
+});
+
+export const prDetailRoute = defineRoute({
+ id: 'pr-detail',
+ path: 'pr/:foreignEntityId',
+ params: z.object({ foreignEntityId: z.string().min(1) }),
+ component: PrDetailRouteView,
+ remountKey: ({ foreignEntityId }) => foreignEntityId,
+ claim: ({ foreignEntityId }) => ({
+ namespace: 'block',
+ id: `pr:${foreignEntityId}`,
+ }),
+});
diff --git a/apps/web/src/features/block-pr/views/PrDetail.tsx b/apps/web/src/features/block-pr/views/PrDetail.tsx
new file mode 100644
index 0000000000..4d272ed7ca
--- /dev/null
+++ b/apps/web/src/features/block-pr/views/PrDetail.tsx
@@ -0,0 +1,204 @@
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import { SidePanel } from '@components/app/side-panel';
+import {
+ StaticMarkdown,
+ StaticMarkdownContext,
+} from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
+import { DebouncedNotificationReadMarker } from '@notifications';
+import type { GithubPullRequestWithDetails } from '@queries/storage/github-pull-requests';
+import { cn, Layer, Scroll } from '@ui';
+import { type Accessor, createMemo, Show } from 'solid-js';
+import {
+ PrDescriptionSkeleton,
+ PrMetadataSkeleton,
+ PrTimelineSkeleton,
+ PrTitleSkeleton,
+} from '../component/PrSkeletons';
+import {
+ PR_PILL_CLASS,
+ PrSplitHeader,
+ PrStatusChip,
+} from '../component/PrSplitHeader';
+import { PrTimeline } from '../component/PrTimeline';
+import { PrSidePanelSections } from '../component/sidepanel/PrSidePanelSections';
+import { createPrDiscussionSource } from '../data/prDiscussionSource';
+import { usePrForeignEntityQuery } from '../data/queries';
+import {
+ cleanGithubMarkdown,
+ githubAvatarUrl,
+ githubDisplayLogin,
+} from '../util/githubMarkdown';
+import type { PrRef } from '../util/prKey';
+import { prDisplayName } from '../util/prKey';
+
+export function PrDetail(props: { foreignEntityId: string }) {
+ const notificationSource = useGlobalNotificationSource();
+ const foreignEntityQuery = usePrForeignEntityQuery(
+ () => props.foreignEntityId
+ );
+
+ const prRef = createMemo(() => foreignEntityQuery.data?.prRef);
+ const pullRequest = createMemo(() => foreignEntityQuery.data?.pullRequest);
+
+ const loadFailed = createMemo(
+ () => !pullRequest() && !!foreignEntityQuery.error
+ );
+
+ // Detail-lifetime local Macro discussion (prototype-only, lost on reload).
+ const discussionSource = createPrDiscussionSource();
+
+ return (
+ <div class="size-full overflow-hidden flex flex-col relative">
+ <DebouncedNotificationReadMarker
+ notificationSource={notificationSource}
+ entity={{ type: 'foreign_entity', id: props.foreignEntityId }}
+ />
+ <SidePanel.Layout>
+ <PrSidePanelSections enrichment={pullRequest} />
+ <div class="flex flex-col size-full min-w-0">
+ <Show when={prRef()}>
+ {(ref) => (
+ <PrSplitHeader
+ foreignEntityId={props.foreignEntityId}
+ prRef={ref()}
+ enrichment={pullRequest()}
+ />
+ )}
+ </Show>
+
+ <Scroll class="flex-1 min-h-0">
+ <div class="max-w-3xl mx-auto px-6 pt-12 pb-12 min-w-0">
+ <Show
+ when={prRef()}
+ fallback={
+ <>
+ <PrTitleSkeleton />
+ <div class="spacer h-3" />
+ <PrMetadataSkeleton />
+ <PrDescriptionSkeleton />
+ <PrTimelineSkeleton />
+ </>
+ }
+ >
+ {(ref) => (
+ <>
+ <PrTitle prRef={ref()} pullRequest={pullRequest} />
+ <div class="spacer h-3" />
+ <PrMetadata prRef={ref()} pullRequest={pullRequest} />
+ <PrDescription pullRequest={pullRequest} />
+ <PrLoadErrorBanner loadFailed={loadFailed} />
+ <PrTimeline
+ githubItems={pullRequest()?.comments ?? []}
+ source={discussionSource}
+ />
+ </>
+ )}
+ </Show>
+ </div>
+ </Scroll>
+ </div>
+ </SidePanel.Layout>
+ </div>
+ );
+}
+
+function PrTitle(props: {
+ prRef: PrRef;
+ pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
+}) {
+ return (
+ <h1 class="ph-no-capture text-2xl font-semibold">
+ {props.pullRequest()?.name ?? prDisplayName(props.prRef)}
+ </h1>
+ );
+}
+
+function PrMetadata(props: {
+ prRef: PrRef;
+ pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
+}) {
+ const pullRequest = () => props.pullRequest();
+
+ return (
+ <div class="mb-6 flex flex-row flex-wrap items-center gap-2 text-sm empty:hidden">
+ <Show when={pullRequest()?.status}>
+ {(status) => <PrStatusChip status={status()} />}
+ </Show>
+ <Show when={pullRequest()?.authorLogin}>
+ {(authorLogin) => (
+ <Layer depth={2}>
+ <a
+ href={`https://github.com/${githubDisplayLogin(authorLogin())}`}
+ target="_blank"
+ rel="noreferrer"
+ class={cn(PR_PILL_CLASS, 'text-ink-muted hover:bg-hover')}
+ >
+ <img
+ src={githubAvatarUrl(authorLogin())}
+ alt=""
+ class="size-3.5 rounded-full shrink-0"
+ loading="lazy"
+ />
+ <span class="truncate">{githubDisplayLogin(authorLogin())}</span>
+ </a>
+ </Layer>
+ )}
+ </Show>
+ <Layer depth={2}>
+ <a
+ href={pullRequest()?.url}
+ target="_blank"
+ rel="noreferrer"
+ class={cn(PR_PILL_CLASS, 'text-ink-muted hover:bg-hover')}
+ >
+ {prDisplayName(props.prRef)}
+ </a>
+ </Layer>
+ <Show
+ when={
+ pullRequest()?.additions != null || pullRequest()?.deletions != null
+ }
+ >
+ <Layer depth={2}>
+ <span class={PR_PILL_CLASS}>
+ <span class="text-success">+{pullRequest()?.additions ?? 0}</span>
+ <span class="text-failure">−{pullRequest()?.deletions ?? 0}</span>
+ </span>
+ </Layer>
+ </Show>
+ </div>
+ );
+}
+
+function PrDescription(props: {
+ pullRequest: Accessor<GithubPullRequestWithDetails | undefined>;
+}) {
+ const description = createMemo(() => {
+ const raw = props.pullRequest()?.description;
+ if (!raw) return null;
+ const cleaned = cleanGithubMarkdown(raw);
+ return cleaned || null;
+ });
+
+ return (
+ <Show when={description()}>
+ {(markdown) => (
+ <StaticMarkdownContext>
+ <div class="ph-no-capture text-sm wrap-break-word max-w-full overflow-x-auto">
+ <StaticMarkdown markdown={markdown()} target="internal" />
+ </div>
+ </StaticMarkdownContext>
+ )}
+ </Show>
+ );
+}
+
+function PrLoadErrorBanner(props: { loadFailed: Accessor<boolean> }) {
+ return (
+ <Show when={props.loadFailed()}>
+ <div class="mt-6 px-3 py-2 rounded-lg border border-edge-muted text-xs text-ink-muted">
+ Couldn't load this pull request from cached GitHub data.
+ </div>
+ </Show>
+ );
+}
diff --git a/apps/web/src/features/next-soup/utils.ts b/apps/web/src/features/next-soup/utils.ts
index e914b665b9..cf9e7e381c 100644
--- a/apps/web/src/features/next-soup/utils.ts
+++ b/apps/web/src/features/next-soup/utils.ts
@@ -21,6 +21,7 @@ import {
getEntityNotifications,
scopeChannelNotificationsForEntity,
} from '@app/features/soup/entity-notifications';
+import { isRecord } from '@app/lib/split-router/utils';
import { globalSplitManager } from '@app/signal/splitLayout';
import { CALENDAR_BLOCK_ID } from '@block-calendar/types';
import { URL_PARAMS as CALL_PARAMS } from '@block-call/constants';
@@ -809,6 +810,26 @@ export const openEntityInSplitFromUnifiedList = async (
let splitContent: SplitContent = driveDocument
? driveSplitContent({ kind: 'tab', tab: 'owned' }, driveDocument)
: { ...content, params };
+ const callTranscriptId =
+ entity.type === 'call' && location?.type === 'call_record'
+ ? location.transcriptId
+ : undefined;
+ if (callTranscriptId) {
+ splitContent = {
+ ...splitContent,
+ entryMetadata: {
+ ...(isRecord(splitContent.entryMetadata)
+ ? splitContent.entryMetadata
+ : {}),
+ search: {
+ 'call-detail': {
+ transcriptId: [callTranscriptId],
+ seek: [`${Date.now()}-${Math.random()}`],
+ },
+ },
+ },
+ };
+ }
if (splitHandle && referredFrom && isListViewID(referredFrom)) {
splitContent = withListNavigationSource(splitContent, splitHandle);
}
@@ -833,8 +854,21 @@ export const openEntityInSplitFromUnifiedList = async (
toast.alert('Content already open');
}
- // Navigate to specific location if provided
- if (location) {
+ // Routed calls have no block handle. Update a reused split's route search
+ // instead of waiting for a legacy block method that will never register.
+ if (location?.type === 'call_record') {
+ if (result.status === 'reused' && result.split && callTranscriptId) {
+ result.split.replace({
+ next: {
+ ...result.split.content(),
+ entryMetadata: splitContent.entryMetadata,
+ },
+ mergeHistory: true,
+ });
+ } else if (result.status === 'reused' && !result.split) {
+ await navigateToLocation(content.id, location, blockOrchestrator);
+ }
+ } else if (location) {
await navigateToLocation(content.id, location, blockOrchestrator);
} else if (channelMessageTarget) {
// NOTE: This will force target message navigation in case the split is already open.
diff --git a/docs/AGENT_GUIDE/ai-chat.md b/docs/AGENT_GUIDE/ai-chat.md
index 664227c1df..191627e146 100644
--- a/docs/AGENT_GUIDE/ai-chat.md
+++ b/docs/AGENT_GUIDE/ai-chat.md
@@ -48,8 +48,10 @@ permission failures should display a failed tool call without a successful resul
**#<number>** beneath the title (icon colored by open / merged / closed; no
status word). Clicking it opens the synced
GitHub PR entity in a split (the same destination as the session header chip
- and Magic Chip). Until GitHub has synced the entity it opens GitHub in a new
- tab. Either click leaves the session unopened. Changing the composer mode does not filter the sidebar.
+ and Magic Chip). A synced PR opens at `/pr/<foreign-entity-id>`; existing
+ inline previews retain their legacy block host. Until GitHub has synced the
+ entity it opens GitHub in a new tab. Either click leaves the session unopened.
+ Changing the composer mode does not filter the sidebar.
Selecting a row opens its own mode; Shift-click opens it in a new split.
Right-click (or long-press on mobile) opens the same entity menu as Home:
Rename, Favorite, Copy link, Share, Delete, and the other session actions.
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 218fd47074..2520a7482e 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -841,6 +841,13 @@ The channel/contact option opens the recipient picker.
Recordings, transcriptions
and summaries appear here; empty state notes "Calls are available to agents."
+Opening a recording uses the standalone `/app/call/<callId>` detail route, including
+old copied call links and split navigation. The detail shows a loading state,
+recording/transcript/summary, Share, and the call side panel; a failed load shows
+Try again. A link with `call_transcript_id=<segmentId>` seeks the matching video
+segment after loading. Check a direct link, a Calls-list click, a second split,
+and clicking the same transcript search hit twice after playing elsewhere.
+
On phones, recorded call headers omit the **Call Again** action.
A channel's `Calls` tab lists that channel's recordings with the same rows, filtered