Skip to content

The open alternative to Salesforce, designed for AI.

Add a native video player to call recording transcripts (#24518)

nitin4e3d4ca76f3a
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/__tests__/useCalendarEventCallRecording.test.tsx b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/__tests__/useCalendarEventCallRecording.test.tsx
index ca3c5281860..72179f194c9 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/__tests__/useCalendarEventCallRecording.test.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/__tests__/useCalendarEventCallRecording.test.tsx
@@ -19,6 +19,7 @@ const mockLayoutRenderingContext: {
let findManyRecordsResult: {
records: Record<string, unknown>[];
+ totalCount: number | undefined;
loading: boolean;
error: Error | undefined;
refetch: jest.Mock;
@@ -38,6 +39,7 @@ jest.mock('@/object-metadata/hooks/useObjectMetadataItem', () => ({
{ id: 'status-field-id', name: 'status', label: 'Status' },
{ id: 'transcript-field-id', name: 'transcript', label: 'Transcript' },
{ id: 'summary-field-id', name: 'summary', label: 'Summary' },
+ { id: 'video-field-id', name: 'video', label: 'Video' },
{
id: 'created-at-field-id',
name: 'createdAt',
@@ -101,6 +103,7 @@ describe('useCalendarEventCallRecording', () => {
};
findManyRecordsResult = {
records: [],
+ totalCount: 0,
loading: false,
error: undefined,
refetch: jest.fn(),
@@ -111,7 +114,7 @@ describe('useCalendarEventCallRecording', () => {
};
});
- it('queries every call recording field for the current calendar event in arrival order', () => {
+ it('queries transcript fields for the current calendar event in arrival order', () => {
renderHook(() =>
useCalendarEventCallRecording({
queryScope: 'call-recording-transcript',
@@ -127,7 +130,7 @@ describe('useCalendarEventCallRecording', () => {
id: true,
status: true,
transcript: true,
- summary: true,
+ video: true,
createdAt: true,
},
skip: false,
@@ -256,6 +259,47 @@ describe('useCalendarEventCallRecording', () => {
expect(transcriptResult.current.restriction).toBeUndefined();
});
+ it('keeps transcripts available when the optional video field is restricted', () => {
+ findManyRecordsResult.totalCount = 3;
+ objectPermissionsResult = {
+ canReadObjectRecords: true,
+ restrictedFields: { 'video-field-id': { canRead: false } },
+ };
+
+ const { result: transcriptResult } = renderHook(() =>
+ useCalendarEventCallRecording({
+ queryScope: 'call-recording-transcript',
+ }),
+ );
+
+ expect(transcriptResult.current.restriction).toBeUndefined();
+ expect(transcriptResult.current.callRecordingsCount).toBe(3);
+ expect(mockUseFindManyRecords).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ recordGqlFields: {
+ id: true,
+ status: true,
+ transcript: true,
+ createdAt: true,
+ },
+ skip: false,
+ }),
+ );
+ });
+
+ it('returns the total call recording count beyond the fetched page', () => {
+ findManyRecordsResult.records = [readyCallRecording];
+ findManyRecordsResult.totalCount = 75;
+
+ const { result } = renderHook(() =>
+ useCalendarEventCallRecording({
+ queryScope: 'call-recording-transcript',
+ }),
+ );
+
+ expect(result.current.callRecordingsCount).toBe(75);
+ });
+
it('passes loading through and resolves to no recording without records', () => {
findManyRecordsResult.loading = true;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventCallRecording.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventCallRecording.ts
index 80cf9d5d0a4..3d001970438 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventCallRecording.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventCallRecording.ts
@@ -2,11 +2,11 @@ import { useListenToObjectRecordOperationBrowserEvent } from '@/browser-event/ho
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { useObjectPermissionsForObject } from '@/object-record/hooks/useObjectPermissionsForObject';
+import { useCalendarEventTargetRecordId } from '@/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId';
import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
import { selectCalendarEventCallRecording } from '@/page-layout/widgets/calendar-event-call-recording/utils/selectCalendarEventCallRecording';
import { type WidgetAccessDenialInfo } from '@/page-layout/widgets/types/WidgetAccessDenialInfo';
import { useListenToEventsForQuery } from '@/sse-db-event/hooks/useListenToEventsForQuery';
-import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';
import { isNonEmptyString } from '@sniptt/guards';
import { useCallback, useMemo } from 'react';
import {
@@ -18,14 +18,25 @@ import { isDefined } from 'twenty-shared/utils';
const CALL_RECORDING_QUERY_LIMIT = 50;
-const CALL_RECORDING_RECORD_FIELDS = {
+const CALL_RECORDING_SUMMARY_RECORD_FIELDS = {
id: true,
status: true,
- transcript: true,
summary: true,
createdAt: true,
} as const satisfies RecordGqlOperationGqlRecordFields;
+const CALL_RECORDING_TRANSCRIPT_RECORD_FIELDS = {
+ id: true,
+ status: true,
+ transcript: true,
+ createdAt: true,
+} as const satisfies RecordGqlOperationGqlRecordFields;
+
+const CALL_RECORDING_TRANSCRIPT_WITH_VIDEO_RECORD_FIELDS = {
+ ...CALL_RECORDING_TRANSCRIPT_RECORD_FIELDS,
+ video: true,
+} as const satisfies RecordGqlOperationGqlRecordFields;
+
const CALL_RECORDING_ORDER_BY: RecordGqlOperationOrderBy = [
{ createdAt: 'AscNullsLast' },
{ id: 'AscNullsFirst' },
@@ -43,17 +54,37 @@ const REQUIRED_FIELD_NAMES_BY_QUERY_SCOPE: Record<
'call-recording-transcript': ['status', 'transcript', 'createdAt'],
};
+const getCallRecordingRecordFields = ({
+ queryScope,
+ isVideoFieldRestricted,
+}: {
+ queryScope: CalendarEventCallRecordingQueryScope;
+ isVideoFieldRestricted: boolean;
+}): RecordGqlOperationGqlRecordFields => {
+ if (queryScope === 'call-recording-summary') {
+ return CALL_RECORDING_SUMMARY_RECORD_FIELDS;
+ }
+
+ if (isVideoFieldRestricted) {
+ return CALL_RECORDING_TRANSCRIPT_RECORD_FIELDS;
+ }
+
+ return CALL_RECORDING_TRANSCRIPT_WITH_VIDEO_RECORD_FIELDS;
+};
+
export const useCalendarEventCallRecording = ({
queryScope,
}: {
queryScope: CalendarEventCallRecordingQueryScope;
}): {
callRecording: CalendarEventCallRecordingCandidate | undefined;
+ callRecordingsCount: number;
loading: boolean;
error: Error | undefined;
restriction: WidgetAccessDenialInfo | undefined;
+ refetch: () => Promise<unknown>;
} => {
- const { targetRecordIdentifier } = useLayoutRenderingContext();
+ const calendarEventId = useCalendarEventTargetRecordId();
const { objectMetadataItem: callRecordingObjectMetadataItem } =
useObjectMetadataItem({
@@ -64,28 +95,22 @@ export const useCalendarEventCallRecording = ({
callRecordingObjectMetadataItem.id,
);
- const calendarEventId =
- targetRecordIdentifier?.targetObjectNameSingular ===
- CoreObjectNameSingular.CalendarEvent
- ? targetRecordIdentifier.id
- : undefined;
+ const isCallRecordingFieldRestricted = (fieldMetadataItem: { id: string }) =>
+ callRecordingObjectPermissions.restrictedFields[fieldMetadataItem.id]
+ ?.canRead === false;
const requiredFieldMetadataItems = REQUIRED_FIELD_NAMES_BY_QUERY_SCOPE[
queryScope
]
.map((requiredFieldName) =>
callRecordingObjectMetadataItem.fields.find(
- (field) => field.name === requiredFieldName,
+ (fieldMetadataItem) => fieldMetadataItem.name === requiredFieldName,
),
)
.filter(isDefined);
const restrictedFieldNames = requiredFieldMetadataItems
- .filter(
- (fieldMetadataItem) =>
- callRecordingObjectPermissions.restrictedFields[fieldMetadataItem.id]
- ?.canRead === false,
- )
+ .filter(isCallRecordingFieldRestricted)
.map((fieldMetadataItem) =>
isNonEmptyString(fieldMetadataItem.label)
? fieldMetadataItem.label
@@ -109,6 +134,19 @@ export const useCalendarEventCallRecording = ({
const shouldSkipQuery = !isDefined(calendarEventId) || isDefined(restriction);
+ const videoFieldMetadataItem = callRecordingObjectMetadataItem.fields.find(
+ (fieldMetadataItem) => fieldMetadataItem.name === 'video',
+ );
+
+ const isVideoFieldRestricted =
+ isDefined(videoFieldMetadataItem) &&
+ isCallRecordingFieldRestricted(videoFieldMetadataItem);
+
+ const callRecordingRecordFields = getCallRecordingRecordFields({
+ queryScope,
+ isVideoFieldRestricted,
+ });
+
const callRecordingFilter = useMemo(
() =>
isDefined(calendarEventId)
@@ -119,6 +157,7 @@ export const useCalendarEventCallRecording = ({
const {
records: callRecordings,
+ totalCount: callRecordingsTotalCount,
loading,
error,
refetch,
@@ -126,7 +165,7 @@ export const useCalendarEventCallRecording = ({
objectNameSingular: CoreObjectNameSingular.CallRecording,
filter: callRecordingFilter,
orderBy: CALL_RECORDING_ORDER_BY,
- recordGqlFields: CALL_RECORDING_RECORD_FIELDS,
+ recordGqlFields: callRecordingRecordFields,
limit: CALL_RECORDING_QUERY_LIMIT,
skip: shouldSkipQuery,
});
@@ -167,5 +206,12 @@ export const useCalendarEventCallRecording = ({
const callRecording = selectCalendarEventCallRecording(callRecordings);
- return { callRecording, loading, error, restriction };
+ return {
+ callRecording,
+ callRecordingsCount: callRecordingsTotalCount ?? callRecordings.length,
+ loading,
+ error,
+ restriction,
+ refetch,
+ };
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId.ts
new file mode 100644
index 00000000000..3004b81e6cf
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId.ts
@@ -0,0 +1,11 @@
+import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';
+import { CoreObjectNameSingular } from 'twenty-shared/types';
+
+export const useCalendarEventTargetRecordId = (): string | undefined => {
+ const { targetRecordIdentifier } = useLayoutRenderingContext();
+
+ return targetRecordIdentifier?.targetObjectNameSingular ===
+ CoreObjectNameSingular.CalendarEvent
+ ? targetRecordIdentifier.id
+ : undefined;
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCallRecordingsSeeAllHref.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCallRecordingsSeeAllHref.ts
new file mode 100644
index 00000000000..5ab4098a90a
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useCallRecordingsSeeAllHref.ts
@@ -0,0 +1,51 @@
+import { objectMetadataItemFamilySelector } from '@/object-metadata/states/objectMetadataItemFamilySelector';
+import { useCalendarEventTargetRecordId } from '@/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId';
+import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
+import { indexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/indexViewIdFromObjectMetadataItemFamilySelector';
+import {
+ AppPath,
+ CoreObjectNameSingular,
+ ViewFilterOperand,
+} from 'twenty-shared/types';
+import { getAppPath, isDefined } from 'twenty-shared/utils';
+
+export const useCallRecordingsSeeAllHref = (): string | undefined => {
+ const calendarEventId = useCalendarEventTargetRecordId();
+
+ const callRecordingObjectMetadataItem = useAtomFamilySelectorValue(
+ objectMetadataItemFamilySelector,
+ {
+ objectName: CoreObjectNameSingular.CallRecording,
+ objectNameType: 'singular',
+ },
+ );
+
+ const indexViewId = useAtomFamilySelectorValue(
+ indexViewIdFromObjectMetadataItemFamilySelector,
+ { objectMetadataItemId: callRecordingObjectMetadataItem?.id ?? '' },
+ );
+
+ if (
+ !isDefined(calendarEventId) ||
+ !isDefined(callRecordingObjectMetadataItem)
+ ) {
+ return undefined;
+ }
+
+ return getAppPath(
+ AppPath.RecordIndexPage,
+ {
+ objectNamePlural: callRecordingObjectMetadataItem.namePlural,
+ },
+ {
+ filter: {
+ calendarEvent: {
+ [ViewFilterOperand.IS]: {
+ selectedRecordIds: [calendarEventId],
+ },
+ },
+ },
+ viewId: indexViewId,
+ },
+ );
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useIsCalendarEventCallRecordingWidgetVisible.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useIsCalendarEventCallRecordingWidgetVisible.ts
index 0e5f6d83393..b6533170816 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useIsCalendarEventCallRecordingWidgetVisible.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/hooks/useIsCalendarEventCallRecordingWidgetVisible.ts
@@ -1,19 +1,18 @@
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
-import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';
+import { useCalendarEventTargetRecordId } from '@/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventTargetRecordId';
import { CoreObjectNameSingular } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
export const useIsCalendarEventCallRecordingWidgetVisible = (): boolean => {
const { objectMetadataItems } = useObjectMetadataItems();
- const { targetRecordIdentifier } = useLayoutRenderingContext();
+ const calendarEventTargetRecordId = useCalendarEventTargetRecordId();
const hasCallRecordingObjectMetadata = objectMetadataItems.some(
(objectMetadataItem) =>
objectMetadataItem.nameSingular === CoreObjectNameSingular.CallRecording,
);
- const isCalendarEventTarget =
- targetRecordIdentifier?.targetObjectNameSingular ===
- CoreObjectNameSingular.CalendarEvent;
-
- return hasCallRecordingObjectMetadata && isCalendarEventTarget;
+ return (
+ hasCallRecordingObjectMetadata && isDefined(calendarEventTargetRecordId)
+ );
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/testing/getCallRecordingWidgetStoryDecorator.tsx b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/testing/getCallRecordingWidgetStoryDecorator.tsx
index b0d6e88edfb..ffa88eec894 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/testing/getCallRecordingWidgetStoryDecorator.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/testing/getCallRecordingWidgetStoryDecorator.tsx
@@ -8,13 +8,20 @@ import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDr
import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState';
import { type PageLayout } from '@/page-layout/types/PageLayout';
import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext';
+import { WidgetCard } from '@/page-layout/widgets/widget-card/components/WidgetCard';
+import { WidgetCardContent } from '@/page-layout/widgets/widget-card/components/WidgetCardContent';
+import { WidgetCardHeader } from '@/page-layout/widgets/widget-card/components/WidgetCardHeader';
import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';
+import { StyledWidgetScrollContainer } from '@/ui/layout/components/WidgetContentContainer';
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
import { type Decorator } from '@storybook/react-vite';
+import { CoreObjectNameSingular } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
import {
PageLayoutTabLayoutMode,
PageLayoutType,
} from '~/generated-metadata/graphql';
+import { getMockObjectMetadataItemOrThrow } from '~/testing/utils/getMockObjectMetadataItemOrThrow';
import { getTestEnrichedObjectMetadataItemsMock } from '~/testing/utils/getTestEnrichedObjectMetadataItemsMock';
import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';
@@ -29,10 +36,30 @@ export const getCallRecordingWidgetStoryDecorator =
widgetId: string;
}): Decorator =>
(Story) => {
- setTestObjectMetadataItemsInMetadataStore(
- jotaiStore,
- getTestEnrichedObjectMetadataItemsMock(),
+ const widget = pageLayout.tabs
+ .flatMap((tab) => tab.widgets)
+ .find((pageLayoutWidget) => pageLayoutWidget.id === widgetId);
+
+ if (!isDefined(widget)) {
+ throw new Error(`Widget ${widgetId} was not found in the page layout`);
+ }
+
+ const calendarEventObjectMetadataItem = getMockObjectMetadataItemOrThrow(
+ CoreObjectNameSingular.CalendarEvent,
);
+
+ setTestObjectMetadataItemsInMetadataStore(jotaiStore, [
+ ...getTestEnrichedObjectMetadataItemsMock(),
+ {
+ ...calendarEventObjectMetadataItem,
+ id: 'call-recording-object-metadata-id',
+ nameSingular: CoreObjectNameSingular.CallRecording,
+ namePlural: 'callRecordings',
+ labelSingular: 'Call Recording',
+ labelPlural: 'Call Recordings',
+ fields: [],
+ },
+ ]);
jotaiStore.set(isMinimalMetadataReadyState.atom, true);
jotaiStore.set(
pageLayoutPersistedComponentState.atomFamily({
@@ -48,13 +75,16 @@ export const getCallRecordingWidgetStoryDecorator =
);
return (
- <div style={{ width: '500px', height: '360px', display: 'flex' }}>
+ <div style={{ display: 'flex', height: 360, width: 500 }}>
<PageLayoutTestWrapper store={jotaiStore}>
<LayoutRenderingProvider
value={{
isInSidePanel: false,
layoutType: PageLayoutType.RECORD_PAGE,
- targetRecordIdentifier: undefined,
+ targetRecordIdentifier: {
+ id: 'calendar-event-id',
+ targetObjectNameSingular: CoreObjectNameSingular.CalendarEvent,
+ },
}}
>
<PageLayoutContentProvider
@@ -65,9 +95,34 @@ export const getCallRecordingWidgetStoryDecorator =
}}
>
<WidgetComponentInstanceContext.Provider
- value={{ instanceId: widgetId }}
+ value={{ instanceId: widget.id }}
>
- <Story />
+ <WidgetCard
+ variant="flush"
+ isEditable={false}
+ isEditing={false}
+ isDragging={false}
+ isResizing={false}
+ >
+ <WidgetCardHeader
+ className="widget-card-header"
+ widgetId={widget.id}
+ variant="flush"
+ isInEditMode={false}
+ hasAccess={true}
+ isResizing={false}
+ title={widget.title}
+ />
+ <WidgetCardContent
+ variant="flush"
+ hasHeader={true}
+ isEditable={false}
+ >
+ <StyledWidgetScrollContainer>
+ <Story />
+ </StyledWidgetScrollContainer>
+ </WidgetCardContent>
+ </WidgetCard>
</WidgetComponentInstanceContext.Provider>
</PageLayoutContentProvider>
</LayoutRenderingProvider>
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate.ts
index 94624fe90c0..21ab74e2020 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate.ts
@@ -1,10 +1,12 @@
+import { type FieldFilesValue } from '@/object-record/record-field/ui/types/FieldMetadata';
import { type CallRecordingStatus } from '~/generated/graphql';
export type CalendarEventCallRecordingCandidate = {
__typename: 'CallRecording';
id: string;
status: CallRecordingStatus;
- transcript: unknown;
- summary: { markdown: string | null } | null | undefined;
+ transcript?: unknown;
+ summary?: { markdown: string | null } | null;
+ video?: FieldFilesValue[] | null;
createdAt: string | null | undefined;
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/getCallRecordingVideoFileUrl.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/getCallRecordingVideoFileUrl.test.ts
new file mode 100644
index 00000000000..979a0e1abd9
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/getCallRecordingVideoFileUrl.test.ts
@@ -0,0 +1,44 @@
+import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
+import { getCallRecordingVideoFileUrl } from '@/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl';
+import { CallRecordingStatus } from '~/generated/graphql';
+
+const makeCallRecording = (
+ video: CalendarEventCallRecordingCandidate['video'],
+): CalendarEventCallRecordingCandidate => ({
+ __typename: 'CallRecording',
+ id: 'call-recording-id',
+ status: CallRecordingStatus.COMPLETED,
+ transcript: null,
+ summary: null,
+ video,
+ createdAt: '2026-01-01T00:00:00Z',
+});
+
+describe('getCallRecordingVideoFileUrl', () => {
+ it('returns the first video file url with a non-empty url', () => {
+ expect(
+ getCallRecordingVideoFileUrl(
+ makeCallRecording([
+ {
+ fileId: 'file-without-url',
+ label: 'broken.mp4',
+ extension: 'mp4',
+ },
+ {
+ fileId: 'file-with-url',
+ label: 'recording.mp4',
+ extension: 'mp4',
+ url: 'https://files.example.com/recording.mp4',
+ },
+ ]),
+ ),
+ ).toBe('https://files.example.com/recording.mp4');
+ });
+
+ it('returns undefined without a playable video file', () => {
+ expect(getCallRecordingVideoFileUrl(makeCallRecording(null))).toBe(
+ undefined,
+ );
+ expect(getCallRecordingVideoFileUrl(makeCallRecording([]))).toBe(undefined);
+ });
+});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingInProgress.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingInProgress.test.ts
index de889a1e1ee..939a3fd2e26 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingInProgress.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingInProgress.test.ts
@@ -7,6 +7,7 @@ const createCallRecording = (status: CallRecordingStatus) => ({
status,
transcript: null,
summary: null,
+ video: null,
createdAt: '2026-08-01T00:00:00.000Z',
});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptFailed.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptFailed.test.ts
index 14911e13699..ec9f8b02e05 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptFailed.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptFailed.test.ts
@@ -13,6 +13,7 @@ const createCallRecording = ({
status,
transcript,
summary: null,
+ video: null,
createdAt: '2026-08-01T00:00:00.000Z',
});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptPending.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptPending.test.ts
index c614801c702..6e6a7013832 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptPending.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/isCallRecordingTranscriptPending.test.ts
@@ -13,6 +13,7 @@ const createCallRecording = ({
status,
transcript,
summary: null,
+ video: null,
createdAt: '2026-08-01T00:00:00.000Z',
});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/selectCalendarEventCallRecording.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/selectCalendarEventCallRecording.test.ts
index ae1bccd1e9d..2e9b1b1c2f5 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/selectCalendarEventCallRecording.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/__tests__/selectCalendarEventCallRecording.test.ts
@@ -13,6 +13,7 @@ const createCallRecording = ({
status,
transcript: null,
summary: null,
+ video: null,
createdAt: '2026-08-01T00:00:00.000Z',
});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl.ts b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl.ts
new file mode 100644
index 00000000000..082bc5eee28
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl.ts
@@ -0,0 +1,8 @@
+import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
+import { isNonEmptyString } from '@sniptt/guards';
+
+export const getCallRecordingVideoFileUrl = (
+ callRecording: Pick<CalendarEventCallRecordingCandidate, 'video'> | undefined,
+): string | undefined =>
+ callRecording?.video?.find((videoFile) => isNonEmptyString(videoFile.url))
+ ?.url;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx
index 26d9b9e1fb6..652db113de1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-summary/components/__stories__/CallRecordingSummaryBody.stories.tsx
@@ -94,6 +94,7 @@ const summarizedCallRecording: CalendarEventCallRecordingCandidate = {
status: CallRecordingStatus.COMPLETED,
transcript: [],
summary: { markdown: summaryMarkdown },
+ video: null,
createdAt: '2026-01-01T00:00:00Z',
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody.tsx
index 9b374137d30..6f4709a7eb1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody.tsx
@@ -1,32 +1,52 @@
import { CallRecordingWidgetEmptyStateDisplay } from '@/page-layout/widgets/calendar-event-call-recording/components/CallRecordingWidgetEmptyStateDisplay';
import { CallRecordingWidgetForbiddenDisplay } from '@/page-layout/widgets/calendar-event-call-recording/components/CallRecordingWidgetForbiddenDisplay';
import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
-import { isCallRecordingTranscriptFailed } from '@/page-layout/widgets/calendar-event-call-recording/utils/isCallRecordingTranscriptFailed';
-import { isCallRecordingTranscriptPending } from '@/page-layout/widgets/calendar-event-call-recording/utils/isCallRecordingTranscriptPending';
-import { CallRecordingTranscriptEntryList } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryList';
+import { CallRecordingTranscriptContent } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptContent';
+import { CallRecordingVideoPlayer } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingVideoPlayer';
import { PageLayoutWidgetErrorDisplay } from '@/page-layout/widgets/components/PageLayoutWidgetErrorDisplay';
import { WidgetSkeletonLoader } from '@/page-layout/widgets/components/WidgetSkeletonLoader';
import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget';
import { type WidgetAccessDenialInfo } from '@/page-layout/widgets/types/WidgetAccessDenialInfo';
+import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import {
- isDefined,
- isNonEmptyArray,
- parseCallRecordingTranscriptEntries,
-} from 'twenty-shared/utils';
+import { type CallRecordingParsedTranscriptEntry } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+const StyledRecordingLayout = styled.div`
+ display: grid;
+ flex: 1;
+ grid-template-rows: auto minmax(0, 1fr);
+ min-height: 0;
+`;
+
+const StyledPlayerSection = styled.div`
+ padding: ${themeCssVariables.spacing[2]} ${themeCssVariables.spacing[6]} 0;
+`;
+
+const StyledTranscriptScrollContainer = styled.div`
+ min-height: 0;
+ overflow-y: auto;
+`;
type CallRecordingTranscriptBodyProps = {
callRecording: CalendarEventCallRecordingCandidate | undefined;
+ transcriptEntries: CallRecordingParsedTranscriptEntry[] | undefined;
+ videoFileUrl: string | undefined;
loading: boolean;
error: Error | undefined;
restriction: WidgetAccessDenialInfo | undefined;
+ refetchCallRecording: () => Promise<unknown>;
};
export const CallRecordingTranscriptBody = ({
callRecording,
+ transcriptEntries,
+ videoFileUrl,
loading,
error,
restriction,
+ refetchCallRecording,
}: CallRecordingTranscriptBodyProps) => {
const widget = useCurrentWidget();
@@ -52,39 +72,30 @@ export const CallRecordingTranscriptBody = ({
);
}
- const transcriptEntries = parseCallRecordingTranscriptEntries(
- callRecording.transcript,
- );
-
- if (isNonEmptyArray(transcriptEntries)) {
- return <CallRecordingTranscriptEntryList entries={transcriptEntries} />;
- }
-
- if (isCallRecordingTranscriptPending(callRecording)) {
- return (
- <CallRecordingWidgetEmptyStateDisplay
- animatedPlaceholderType="loadingMessages"
- title={t`Preparing Transcript`}
- subTitle={t`Transcript is being prepared…`}
- />
- );
- }
-
- if (isCallRecordingTranscriptFailed(callRecording)) {
+ if (!isDefined(videoFileUrl)) {
return (
- <CallRecordingWidgetEmptyStateDisplay
- animatedPlaceholderType="errorIndex"
- title={t`Transcript Failed`}
- subTitle={t`The transcript could not be generated.`}
+ <CallRecordingTranscriptContent
+ callRecording={callRecording}
+ transcriptEntries={transcriptEntries}
/>
);
}
return (
- <CallRecordingWidgetEmptyStateDisplay
- animatedPlaceholderType="noMatchRecord"
- title={t`No Transcript`}
- subTitle={t`No transcript is available for this recording.`}
- />
+ <StyledRecordingLayout>
+ <StyledPlayerSection>
+ <CallRecordingVideoPlayer
+ key={videoFileUrl}
+ src={videoFileUrl}
+ onRetry={refetchCallRecording}
+ />
+ </StyledPlayerSection>
+ <StyledTranscriptScrollContainer>
+ <CallRecordingTranscriptContent
+ callRecording={callRecording}
+ transcriptEntries={transcriptEntries}
+ />
+ </StyledTranscriptScrollContainer>
+ </StyledRecordingLayout>
);
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptContent.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptContent.tsx
new file mode 100644
index 00000000000..4dca8791782
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptContent.tsx
@@ -0,0 +1,50 @@
+import { CallRecordingWidgetEmptyStateDisplay } from '@/page-layout/widgets/calendar-event-call-recording/components/CallRecordingWidgetEmptyStateDisplay';
+import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
+import { isCallRecordingTranscriptFailed } from '@/page-layout/widgets/calendar-event-call-recording/utils/isCallRecordingTranscriptFailed';
+import { isCallRecordingTranscriptPending } from '@/page-layout/widgets/calendar-event-call-recording/utils/isCallRecordingTranscriptPending';
+import { CallRecordingTranscriptEntryList } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptEntryList';
+import { t } from '@lingui/core/macro';
+import { type CallRecordingParsedTranscriptEntry } from 'twenty-shared/types';
+import { isNonEmptyArray } from 'twenty-shared/utils';
+
+type CallRecordingTranscriptContentProps = {
+ callRecording: CalendarEventCallRecordingCandidate;
+ transcriptEntries: CallRecordingParsedTranscriptEntry[] | undefined;
+};
+
+export const CallRecordingTranscriptContent = ({
+ callRecording,
+ transcriptEntries,
+}: CallRecordingTranscriptContentProps) => {
+ if (isNonEmptyArray(transcriptEntries)) {
+ return <CallRecordingTranscriptEntryList entries={transcriptEntries} />;
+ }
+
+ if (isCallRecordingTranscriptPending(callRecording)) {
+ return (
+ <CallRecordingWidgetEmptyStateDisplay
+ animatedPlaceholderType="loadingMessages"
+ title={t`Preparing Transcript`}
+ subTitle={t`Transcript is being prepared…`}
+ />
+ );
+ }
+
+ if (isCallRecordingTranscriptFailed(callRecording)) {
+ return (
+ <CallRecordingWidgetEmptyStateDisplay
+ animatedPlaceholderType="errorIndex"
+ title={t`Transcript Failed`}
+ subTitle={t`The transcript could not be generated.`}
+ />
+ );
+ }
+
+ return (
+ <CallRecordingWidgetEmptyStateDisplay
+ animatedPlaceholderType="noMatchRecord"
+ title={t`No Transcript`}
+ subTitle={t`No transcript is available for this recording.`}
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptHeaderDataEffect.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptHeaderDataEffect.tsx
new file mode 100644
index 00000000000..7a4f9437a0e
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptHeaderDataEffect.tsx
@@ -0,0 +1,43 @@
+import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget';
+import { callRecordingTranscriptHeaderDataComponentFamilyState } from '@/page-layout/widgets/call-recording-transcript/states/callRecordingTranscriptHeaderDataComponentFamilyState';
+import { buildCallRecordingTranscriptPlainText } from '@/page-layout/widgets/call-recording-transcript/utils/buildCallRecordingTranscriptPlainText';
+import { useSetAtomComponentFamilyState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentFamilyState';
+import { useEffect } from 'react';
+import { type CallRecordingParsedTranscriptEntry } from 'twenty-shared/types';
+import { isNonEmptyArray } from 'twenty-shared/utils';
+
+type CallRecordingTranscriptHeaderDataEffectProps = {
+ transcriptEntries: CallRecordingParsedTranscriptEntry[] | undefined;
+ videoFileUrl: string | undefined;
+};
+
+export const CallRecordingTranscriptHeaderDataEffect = ({
+ transcriptEntries,
+ videoFileUrl,
+}: CallRecordingTranscriptHeaderDataEffectProps) => {
+ const widget = useCurrentWidget();
+ const setCallRecordingTranscriptHeaderData = useSetAtomComponentFamilyState(
+ callRecordingTranscriptHeaderDataComponentFamilyState,
+ widget.id,
+ );
+
+ const transcriptPlainText = isNonEmptyArray(transcriptEntries)
+ ? buildCallRecordingTranscriptPlainText(transcriptEntries)
+ : undefined;
+
+ useEffect(() => {
+ setCallRecordingTranscriptHeaderData({
+ transcriptPlainText,
+ videoFileUrl,
+ });
+ }, [transcriptPlainText, videoFileUrl, setCallRecordingTranscriptHeaderData]);
+
+ useEffect(
+ () => () => {
+ setCallRecordingTranscriptHeaderData(null);
+ },
+ [setCallRecordingTranscriptHeaderData],
+ );
+
+ return null;
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptWidgetContent.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptWidgetContent.tsx
index abb921f9742..ebf974c2570 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptWidgetContent.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptWidgetContent.tsx
@@ -1,16 +1,59 @@
import { useCalendarEventCallRecording } from '@/page-layout/widgets/calendar-event-call-recording/hooks/useCalendarEventCallRecording';
+import { getCallRecordingVideoFileUrl } from '@/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl';
import { CallRecordingTranscriptBody } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody';
+import { CallRecordingTranscriptHeaderDataEffect } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptHeaderDataEffect';
+import { WidgetHeaderCountEffect } from '@/page-layout/widgets/components/WidgetHeaderCountEffect';
+import { useMemo } from 'react';
+import {
+ isDefined,
+ parseCallRecordingTranscriptEntries,
+} from 'twenty-shared/utils';
export const CallRecordingTranscriptWidgetContent = () => {
- const { callRecording, loading, error, restriction } =
- useCalendarEventCallRecording({ queryScope: 'call-recording-transcript' });
+ const {
+ callRecording,
+ callRecordingsCount,
+ loading,
+ error,
+ restriction,
+ refetch,
+ } = useCalendarEventCallRecording({
+ queryScope: 'call-recording-transcript',
+ });
+
+ const canExposeCallRecordingHeaderData =
+ !loading && !isDefined(error) && !isDefined(restriction);
+
+ const callRecordingForHeader = canExposeCallRecordingHeaderData
+ ? callRecording
+ : undefined;
+
+ const transcriptEntries = useMemo(
+ () =>
+ parseCallRecordingTranscriptEntries(callRecordingForHeader?.transcript),
+ [callRecordingForHeader?.transcript],
+ );
+
+ const videoFileUrl = getCallRecordingVideoFileUrl(callRecordingForHeader);
return (
- <CallRecordingTranscriptBody
- callRecording={callRecording}
- loading={loading}
- error={error}
- restriction={restriction}
- />
+ <>
+ <WidgetHeaderCountEffect
+ count={canExposeCallRecordingHeaderData ? callRecordingsCount : 0}
+ />
+ <CallRecordingTranscriptHeaderDataEffect
+ transcriptEntries={transcriptEntries}
+ videoFileUrl={videoFileUrl}
+ />
+ <CallRecordingTranscriptBody
+ callRecording={callRecording}
+ transcriptEntries={transcriptEntries}
+ videoFileUrl={videoFileUrl}
+ loading={loading}
+ error={error}
+ restriction={restriction}
+ refetchCallRecording={refetch}
+ />
+ </>
);
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingVideoPlayer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingVideoPlayer.tsx
new file mode 100644
index 00000000000..15617d4ee83
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/CallRecordingVideoPlayer.tsx
@@ -0,0 +1,170 @@
+import { styled } from '@linaria/react';
+import { t } from '@lingui/core/macro';
+import { useState } from 'react';
+import { CircularProgressBar } from 'twenty-ui/feedback';
+import { Button } from 'twenty-ui/input';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+// Forces Safari to decode the first frame under preload="metadata".
+const FIRST_FRAME_SEEK_FRAGMENT = '#t=0.001';
+
+type CallRecordingVideoLoadState = 'awaiting-first-frame' | 'ready' | 'errored';
+
+const StyledVideoViewport = styled.div`
+ aspect-ratio: 16 / 9;
+ background: ${themeCssVariables.background.primary};
+ border-radius: ${themeCssVariables.border.radius.sm};
+ overflow: hidden;
+ position: relative;
+ width: 100%;
+`;
+
+const StyledVideo = styled.video<{ isFirstFrameReady: boolean }>`
+ accent-color: ${themeCssVariables.accent.accent9};
+ background: ${themeCssVariables.background.primary};
+ color-scheme: light dark;
+ display: block;
+ height: 100%;
+ object-fit: contain;
+ opacity: ${({ isFirstFrameReady }) => (isFirstFrameReady ? 1 : 0)};
+ transition: opacity calc(${themeCssVariables.animation.duration.fast} * 1s)
+ ease;
+ width: 100%;
+
+ @media (prefers-reduced-motion: reduce) {
+ transition: none;
+ }
+`;
+
+const StyledBufferingOverlay = styled.div<{ isVisible: boolean }>`
+ align-items: center;
+ color: ${themeCssVariables.font.color.tertiary};
+ display: flex;
+ inset: 0;
+ justify-content: center;
+ opacity: ${({ isVisible }) => (isVisible ? 1 : 0)};
+ pointer-events: none;
+ position: absolute;
+ transition: opacity calc(${themeCssVariables.animation.duration.fast} * 1s)
+ ease;
+ transition-delay: ${({ isVisible }) =>
+ isVisible
+ ? `calc(${themeCssVariables.animation.duration.normal} * 1s)`
+ : '0s'};
+
+ @media (prefers-reduced-motion: reduce) {
+ transition-duration: 0ms;
+ }
+`;
+
+const StyledPlaybackErrorState = styled.div`
+ align-items: center;
+ box-sizing: border-box;
+ display: flex;
+ flex-direction: column;
+ gap: ${themeCssVariables.spacing[2]};
+ height: 100%;
+ justify-content: center;
+ padding: ${themeCssVariables.spacing[4]};
+`;
+
+const StyledPlaybackErrorTitle = styled.span`
+ color: ${themeCssVariables.font.color.primary};
+ font-size: ${themeCssVariables.font.size.sm};
+ font-weight: ${themeCssVariables.font.weight.medium};
+`;
+
+const StyledPlaybackErrorDescription = styled.span`
+ color: ${themeCssVariables.font.color.secondary};
+ font-size: ${themeCssVariables.font.size.xs};
+`;
+
+type CallRecordingVideoPlayerProps = {
+ src: string;
+ onRetry: () => Promise<unknown>;
+};
+
+export const CallRecordingVideoPlayer = ({
+ src,
+ onRetry,
+}: CallRecordingVideoPlayerProps) => {
+ const [loadState, setLoadState] = useState<CallRecordingVideoLoadState>(
+ 'awaiting-first-frame',
+ );
+ const [isPlaybackStalled, setIsPlaybackStalled] = useState(false);
+ const [isRetrying, setIsRetrying] = useState(false);
+
+ const markFirstFrameReady = () => {
+ setLoadState((previousLoadState) =>
+ previousLoadState === 'awaiting-first-frame'
+ ? 'ready'
+ : previousLoadState,
+ );
+ setIsPlaybackStalled(false);
+ };
+
+ const handleWaiting = () => setIsPlaybackStalled(true);
+
+ const handlePause = () => setIsPlaybackStalled(false);
+
+ const handleError = () => setLoadState('errored');
+
+ const handleRetry = async () => {
+ setIsRetrying(true);
+ setIsPlaybackStalled(false);
+
+ try {
+ await onRetry();
+ setLoadState('awaiting-first-frame');
+ } catch {
+ // A failed refetch surfaces through the widget's query error state.
+ } finally {
+ setIsRetrying(false);
+ }
+ };
+
+ if (loadState === 'errored') {
+ return (
+ <StyledVideoViewport>
+ <StyledPlaybackErrorState>
+ <StyledPlaybackErrorTitle>{t`Playback failed`}</StyledPlaybackErrorTitle>
+ <StyledPlaybackErrorDescription>
+ {t`The recording could not be loaded.`}
+ </StyledPlaybackErrorDescription>
+ <Button
+ title={t`Retry`}
+ variant="secondary"
+ disabled={isRetrying}
+ isLoading={isRetrying}
+ onClick={handleRetry}
+ />
+ </StyledPlaybackErrorState>
+ </StyledVideoViewport>
+ );
+ }
+
+ return (
+ <StyledVideoViewport>
+ <StyledVideo
+ isFirstFrameReady={loadState === 'ready'}
+ controls
+ playsInline
+ preload="metadata"
+ src={`${src}${FIRST_FRAME_SEEK_FRAGMENT}`}
+ onCanPlay={markFirstFrameReady}
+ onError={handleError}
+ onLoadedData={markFirstFrameReady}
+ onPause={handlePause}
+ onSeeking={markFirstFrameReady}
+ onSeeked={markFirstFrameReady}
+ onTimeUpdate={markFirstFrameReady}
+ onWaiting={handleWaiting}
+ />
+ <StyledBufferingOverlay
+ isVisible={loadState === 'awaiting-first-frame' || isPlaybackStalled}
+ >
+ <CircularProgressBar barWidth={3} size={24} />
+ </StyledBufferingOverlay>
+ </StyledVideoViewport>
+ );
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/WidgetActionCallRecordingTranscript.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/WidgetActionCallRecordingTranscript.tsx
new file mode 100644
index 00000000000..5305b82083d
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/WidgetActionCallRecordingTranscript.tsx
@@ -0,0 +1,64 @@
+import { useCallRecordingsSeeAllHref } from '@/page-layout/widgets/calendar-event-call-recording/hooks/useCallRecordingsSeeAllHref';
+import { useCurrentWidget } from '@/page-layout/widgets/hooks/useCurrentWidget';
+import { callRecordingTranscriptHeaderDataComponentFamilyState } from '@/page-layout/widgets/call-recording-transcript/states/callRecordingTranscriptHeaderDataComponentFamilyState';
+import { widgetHeaderCountComponentFamilyState } from '@/page-layout/widgets/states/widgetHeaderCountComponentFamilyState';
+import { WidgetCardHeaderActionButton } from '@/page-layout/widgets/widget-card/components/WidgetCardHeaderActionButton';
+import { WidgetCardHeaderActionLink } from '@/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink';
+import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue';
+import { t } from '@lingui/core/macro';
+import { isDefined } from 'twenty-shared/utils';
+import { IconArrowUpRight, IconCopy, IconLink } from 'twenty-ui/icon';
+import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
+
+export const WidgetActionCallRecordingTranscript = () => {
+ const widget = useCurrentWidget();
+ const callRecordingTranscriptHeaderData = useAtomComponentFamilyStateValue(
+ callRecordingTranscriptHeaderDataComponentFamilyState,
+ widget.id,
+ );
+ const widgetHeaderCount = useAtomComponentFamilyStateValue(
+ widgetHeaderCountComponentFamilyState,
+ widget.id,
+ );
+ const callRecordingsSeeAllHref = useCallRecordingsSeeAllHref();
+ const { copyToClipboard } = useCopyToClipboard();
+
+ const transcriptPlainText =
+ callRecordingTranscriptHeaderData?.transcriptPlainText;
+ const videoFileUrl = callRecordingTranscriptHeaderData?.videoFileUrl;
+
+ return (
+ <>
+ {isDefined(transcriptPlainText) && (
+ <WidgetCardHeaderActionButton
+ Icon={IconCopy}
+ label={t`Copy transcript`}
+ onClick={() =>
+ copyToClipboard(
+ transcriptPlainText,
+ t`Transcript copied to clipboard`,
+ )
+ }
+ />
+ )}
+ {isDefined(videoFileUrl) && (
+ <WidgetCardHeaderActionButton
+ Icon={IconLink}
+ label={t`Copy video download link`}
+ onClick={() =>
+ copyToClipboard(videoFileUrl, t`Link copied to clipboard`)
+ }
+ />
+ )}
+ {isDefined(callRecordingsSeeAllHref) &&
+ isDefined(widgetHeaderCount) &&
+ widgetHeaderCount > 0 && (
+ <WidgetCardHeaderActionLink
+ Icon={IconArrowUpRight}
+ label={t`See all call recordings linked to this calendar event`}
+ to={callRecordingsSeeAllHref}
+ />
+ )}
+ </>
+ );
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx
index 0fb1dfe1aa0..f8b58b1e96d 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/components/__stories__/CallRecordingTranscriptBody.stories.tsx
@@ -3,9 +3,18 @@ import { type PageLayout } from '@/page-layout/types/PageLayout';
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
import { getCallRecordingWidgetStoryDecorator } from '@/page-layout/widgets/calendar-event-call-recording/testing/getCallRecordingWidgetStoryDecorator';
import { type CalendarEventCallRecordingCandidate } from '@/page-layout/widgets/calendar-event-call-recording/types/CalendarEventCallRecordingCandidate';
+import { getCallRecordingVideoFileUrl } from '@/page-layout/widgets/calendar-event-call-recording/utils/getCallRecordingVideoFileUrl';
import { CallRecordingTranscriptBody } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptBody';
+import { CallRecordingTranscriptHeaderDataEffect } from '@/page-layout/widgets/call-recording-transcript/components/CallRecordingTranscriptHeaderDataEffect';
+import { WidgetHeaderCountEffect } from '@/page-layout/widgets/components/WidgetHeaderCountEffect';
import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { expect, waitFor, within } from 'storybook/test';
+import { delay, http } from 'msw';
+import { useState, type ComponentProps } from 'react';
+import { expect, fn, spyOn, userEvent, waitFor, within } from 'storybook/test';
+import {
+ isDefined,
+ parseCallRecordingTranscriptEntries,
+} from 'twenty-shared/utils';
import { ComponentDecorator } from 'twenty-ui/testing';
import {
PageLayoutType,
@@ -13,9 +22,12 @@ import {
WidgetType,
} from '~/generated-metadata/graphql';
import { CallRecordingStatus } from '~/generated/graphql';
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
const TRANSCRIPT_WIDGET_ID = 'transcript-widget';
const CALL_RECORDING_TAB_ID = 'call-recording-tab';
+const VIDEO_URL = '/storybook/call-recording.mp4';
const transcriptWidget: PageLayoutWidget = {
__typename: 'PageLayoutWidget',
@@ -80,6 +92,7 @@ const completedCallRecording: CalendarEventCallRecordingCandidate = {
status: CallRecordingStatus.COMPLETED,
transcript: [],
summary: null,
+ video: null,
createdAt: '2026-01-01T00:00:00Z',
};
@@ -127,24 +140,116 @@ const readableCallRecording: CalendarEventCallRecordingCandidate = {
transcript: rawTranscript,
};
-const meta: Meta<typeof CallRecordingTranscriptBody> = {
+const recordedCallRecording: CalendarEventCallRecordingCandidate = {
+ ...readableCallRecording,
+ video: [
+ {
+ fileId: 'video-file-id',
+ label: 'recording.mp4',
+ extension: 'mp4',
+ url: VIDEO_URL,
+ },
+ ],
+};
+
+const unplayableRecordedCallRecording: CalendarEventCallRecordingCandidate = {
+ ...recordedCallRecording,
+ video: [
+ {
+ fileId: 'unplayable-video-file-id',
+ label: 'unplayable-recording.mp4',
+ extension: 'mp4',
+ url: 'data:video/mp4,not-a-video',
+ },
+ ],
+};
+
+type CallRecordingTranscriptBodyStoryProps = Omit<
+ ComponentProps<typeof CallRecordingTranscriptBody>,
+ 'transcriptEntries' | 'videoFileUrl'
+>;
+
+const CallRecordingTranscriptBodyStory = (
+ args: CallRecordingTranscriptBodyStoryProps,
+) => {
+ const canExposeCallRecordingHeaderData =
+ !args.loading && !isDefined(args.error) && !isDefined(args.restriction);
+
+ const callRecordingForHeader = canExposeCallRecordingHeaderData
+ ? args.callRecording
+ : undefined;
+
+ const transcriptEntries = parseCallRecordingTranscriptEntries(
+ callRecordingForHeader?.transcript,
+ );
+ const videoFileUrl = getCallRecordingVideoFileUrl(callRecordingForHeader);
+
+ return (
+ <>
+ <WidgetHeaderCountEffect
+ count={
+ canExposeCallRecordingHeaderData && isDefined(args.callRecording)
+ ? 1
+ : 0
+ }
+ />
+ <CallRecordingTranscriptHeaderDataEffect
+ transcriptEntries={transcriptEntries}
+ videoFileUrl={videoFileUrl}
+ />
+ <CallRecordingTranscriptBody
+ {...args}
+ transcriptEntries={transcriptEntries}
+ videoFileUrl={videoFileUrl}
+ />
+ </>
+ );
+};
+
+const PlaybackErrorRecoveryStory = (
+ args: CallRecordingTranscriptBodyStoryProps,
+) => {
+ const [callRecording, setCallRecording] = useState(args.callRecording);
+
+ const refetchCallRecording = async () => {
+ await args.refetchCallRecording();
+ setCallRecording(recordedCallRecording);
+ };
+
+ return (
+ <CallRecordingTranscriptBodyStory
+ {...args}
+ callRecording={callRecording}
+ refetchCallRecording={refetchCallRecording}
+ />
+ );
+};
+
+const meta: Meta<typeof CallRecordingTranscriptBodyStory> = {
title: 'Modules/PageLayout/Widgets/CallRecordingTranscriptBody',
- component: CallRecordingTranscriptBody,
+ component: CallRecordingTranscriptBodyStory,
decorators: [
getCallRecordingWidgetStoryDecorator({
pageLayout: pageLayoutWithTranscriptWidget,
tabId: CALL_RECORDING_TAB_ID,
widgetId: TRANSCRIPT_WIDGET_ID,
}),
+ MemoryRouterDecorator,
+ SnackBarDecorator,
ComponentDecorator,
],
parameters: {
layout: 'centered',
+ msw: { handlers: [http.get(VIDEO_URL, () => delay('infinite'))] },
+ },
+ render: CallRecordingTranscriptBodyStory,
+ args: {
+ refetchCallRecording: async () => {},
},
};
export default meta;
-type Story = StoryObj<typeof CallRecordingTranscriptBody>;
+type Story = StoryObj<typeof CallRecordingTranscriptBodyStory>;
export const Ready: Story = {
args: {
@@ -164,6 +269,78 @@ export const Ready: Story = {
},
};
+export const WithVideo: Story = {
+ args: {
+ callRecording: recordedCallRecording,
+ loading: false,
+ error: undefined,
+ restriction: undefined,
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ expect(await canvas.findByText('Transcript')).toBeVisible();
+ expect(canvasElement.querySelector('video')).not.toBeNull();
+ const copyTranscriptButton = await canvas.findByRole('button', {
+ name: 'Copy transcript',
+ });
+ const copyVideoLinkButton = canvas.getByRole('button', {
+ name: 'Copy video download link',
+ });
+ const writeText = spyOn(
+ navigator.clipboard,
+ 'writeText',
+ ).mockResolvedValue();
+
+ await userEvent.click(copyTranscriptButton);
+
+ expect(writeText).toHaveBeenLastCalledWith(
+ 'Ada Lovelace (0:12)\nThanks for joining, let us walk through the quarterly numbers.\n\nGrace Hopper (0:24)\nHappy to. Pipeline grew twenty percent since the last call.\n\nUnknown speaker\nInaudible segment.',
+ );
+
+ await userEvent.click(copyVideoLinkButton);
+
+ expect(writeText).toHaveBeenLastCalledWith(VIDEO_URL);
+
+ writeText.mockRestore();
+
+ const seeAllLink = canvas.getByRole('link', {
+ name: 'See all call recordings linked to this calendar event',
+ });
+
+ expect(seeAllLink).toHaveAttribute(
+ 'href',
+ expect.stringContaining('calendar-event-id'),
+ );
+ },
+};
+
+export const PlaybackError: Story = {
+ args: {
+ callRecording: unplayableRecordedCallRecording,
+ loading: false,
+ error: undefined,
+ restriction: undefined,
+ refetchCallRecording: fn(async () => {}),
+ },
+ render: PlaybackErrorRecoveryStory,
+ play: async ({ args, canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ await canvas.findByText('Playback failed');
+ await userEvent.click(canvas.getByRole('button', { name: /^Retry/ }));
+
+ expect(args.refetchCallRecording).toHaveBeenCalledTimes(1);
+
+ await waitFor(() =>
+ expect(canvasElement.querySelector('video')).toHaveAttribute(
+ 'src',
+ `${VIDEO_URL}#t=0.001`,
+ ),
+ );
+ },
+};
+
export const Loading: Story = {
args: {
callRecording: undefined,
@@ -238,7 +415,7 @@ export const NoRecording: Story = {
export const Forbidden: Story = {
args: {
- callRecording: undefined,
+ callRecording: recordedCallRecording,
loading: false,
error: undefined,
restriction: { type: 'field', fieldNames: ['Transcript'] },
@@ -247,6 +424,17 @@ export const Forbidden: Story = {
const canvas = within(canvasElement);
await canvas.findByText('Not shared');
+ expect(
+ canvas.queryByRole('button', { name: 'Copy transcript' }),
+ ).not.toBeInTheDocument();
+ expect(
+ canvas.queryByRole('button', { name: 'Copy video download link' }),
+ ).not.toBeInTheDocument();
+ expect(
+ canvas.queryByRole('link', {
+ name: 'See all call recordings linked to this calendar event',
+ }),
+ ).not.toBeInTheDocument();
},
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/states/callRecordingTranscriptHeaderDataComponentFamilyState.ts b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/states/callRecordingTranscriptHeaderDataComponentFamilyState.ts
new file mode 100644
index 00000000000..cd4c94d50bd
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/states/callRecordingTranscriptHeaderDataComponentFamilyState.ts
@@ -0,0 +1,17 @@
+import { PageLayoutComponentInstanceContext } from '@/page-layout/states/contexts/PageLayoutComponentInstanceContext';
+import { createAtomComponentFamilyState } from '@/ui/utilities/state/jotai/utils/createAtomComponentFamilyState';
+
+export type CallRecordingTranscriptHeaderData = {
+ transcriptPlainText: string | undefined;
+ videoFileUrl: string | undefined;
+};
+
+export const callRecordingTranscriptHeaderDataComponentFamilyState =
+ createAtomComponentFamilyState<
+ CallRecordingTranscriptHeaderData | null,
+ string
+ >({
+ key: 'callRecordingTranscriptHeaderDataComponentFamilyState',
+ defaultValue: null,
+ componentInstanceContext: PageLayoutComponentInstanceContext,
+ });
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/__tests__/buildCallRecordingTranscriptPlainText.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/__tests__/buildCallRecordingTranscriptPlainText.test.ts
new file mode 100644
index 00000000000..6568c692206
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/__tests__/buildCallRecordingTranscriptPlainText.test.ts
@@ -0,0 +1,42 @@
+import { buildCallRecordingTranscriptPlainText } from '@/page-layout/widgets/call-recording-transcript/utils/buildCallRecordingTranscriptPlainText';
+import { type CallRecordingParsedTranscriptEntry } from 'twenty-shared/types';
+
+const makeTranscriptEntry = (
+ overrides: Partial<CallRecordingParsedTranscriptEntry>,
+): CallRecordingParsedTranscriptEntry => ({
+ speakerName: 'Ada Lovelace',
+ startSeconds: 12,
+ endSeconds: 21,
+ text: 'Hello there.',
+ words: [],
+ ...overrides,
+});
+
+describe('buildCallRecordingTranscriptPlainText', () => {
+ it('renders speaker, timestamp and text per entry separated by blank lines', () => {
+ expect(
+ buildCallRecordingTranscriptPlainText([
+ makeTranscriptEntry({}),
+ makeTranscriptEntry({
+ speakerName: 'Grace Hopper',
+ startSeconds: 3675,
+ text: 'Pipeline grew.',
+ }),
+ ]),
+ ).toBe(
+ 'Ada Lovelace (0:12)\nHello there.\n\nGrace Hopper (1:01:15)\nPipeline grew.',
+ );
+ });
+
+ it('falls back to an unknown speaker and omits missing timestamps', () => {
+ expect(
+ buildCallRecordingTranscriptPlainText([
+ makeTranscriptEntry({
+ speakerName: undefined,
+ startSeconds: undefined,
+ text: 'Inaudible segment.',
+ }),
+ ]),
+ ).toBe('Unknown speaker\nInaudible segment.');
+ });
+});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/buildCallRecordingTranscriptPlainText.ts b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/buildCallRecordingTranscriptPlainText.ts
new file mode 100644
index 00000000000..c050ee59d57
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/call-recording-transcript/utils/buildCallRecordingTranscriptPlainText.ts
@@ -0,0 +1,18 @@
+import { formatCallRecordingTranscriptTimestamp } from '@/page-layout/widgets/call-recording-transcript/utils/formatCallRecordingTranscriptTimestamp';
+import { t } from '@lingui/core/macro';
+import { type CallRecordingParsedTranscriptEntry } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
+
+export const buildCallRecordingTranscriptPlainText = (
+ entries: CallRecordingParsedTranscriptEntry[],
+): string =>
+ entries
+ .map((entry) => {
+ const speakerName = entry.speakerName ?? t`Unknown speaker`;
+ const timestamp = isDefined(entry.startSeconds)
+ ? ` (${formatCallRecordingTranscriptTimestamp(entry.startSeconds)})`
+ : '';
+
+ return `${speakerName}${timestamp}\n${entry.text}`;
+ })
+ .join('\n\n');
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx
index 5817552fe9a..da69662a90e 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetActionFieldSeeAll.tsx
@@ -2,25 +2,14 @@ import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadat
import { isFieldRelation } from '@/object-record/record-field/ui/types/guards/isFieldRelation';
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
import { useFieldWidgetFieldDefinition } from '@/page-layout/widgets/field/hooks/useFieldWidgetFieldDefinition';
+import { WidgetCardHeaderActionLink } from '@/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink';
import { useTargetRecord } from '@/ui/layout/contexts/useTargetRecord';
import { useAtomFamilySelectorValue } from '@/ui/utilities/state/jotai/hooks/useAtomFamilySelectorValue';
import { indexViewIdFromObjectMetadataItemFamilySelector } from '@/views/states/selectors/indexViewIdFromObjectMetadataItemFamilySelector';
-import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
-import { Link } from 'react-router-dom';
import { AppPath, ViewFilterOperand } from 'twenty-shared/types';
import { getAppPath, isDefined } from 'twenty-shared/utils';
import { IconArrowUpRight } from 'twenty-ui/icon';
-import { LightIconButton } from 'twenty-ui/input';
-import { AppTooltip, TooltipDelay, TooltipPosition } from 'twenty-ui/surfaces';
-
-const StyledLinkContainer = styled.div`
- display: flex;
-
- > * {
- text-decoration: none;
- }
-`;
type WidgetActionFieldSeeAllProps = {
widget: PageLayoutWidget;
@@ -81,28 +70,15 @@ export const WidgetActionFieldSeeAll = ({
filterQueryParams,
);
- const tooltipId = `widget-see-all-${widget.id}`;
const relationLabelPlural =
relationObjectMetadataItem.labelPlural.toLowerCase();
- const tooltipContent = t`See all ${relationLabelPlural} linked to this record`;
+ const actionLabel = t`See all ${relationLabelPlural} linked to this record`;
return (
- <>
- <div id={tooltipId}>
- <StyledLinkContainer>
- <Link to={filterLinkHref} data-testid="widget-see-all-link">
- <LightIconButton Icon={IconArrowUpRight} accent="secondary" />
- </Link>
- </StyledLinkContainer>
- </div>
- <AppTooltip
- anchorSelect={`#${tooltipId}`}
- content={tooltipContent}
- place={TooltipPosition.Top}
- delay={TooltipDelay.mediumDelay}
- offset={5}
- noArrow
- />
- </>
+ <WidgetCardHeaderActionLink
+ Icon={IconArrowUpRight}
+ label={actionLabel}
+ to={filterLinkHref}
+ />
);
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
index 806f3cc9577..931bcf8b074 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
@@ -1299,7 +1299,9 @@ export const OneToManyRelationFieldWidgetWithSeeAllButton: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
- const seeAllLink = await canvas.findByTestId('widget-see-all-link');
+ const seeAllLink = await canvas.findByRole('link', {
+ name: /See all .* linked to this record/,
+ });
expect(seeAllLink).toBeVisible();
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/constants/WidgetHeaderActionComponentByWidgetType.ts b/packages/twenty-front/src/modules/page-layout/widgets/constants/WidgetHeaderActionComponentByWidgetType.ts
index 3c3c73109be..ce9163ce3f8 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/constants/WidgetHeaderActionComponentByWidgetType.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/constants/WidgetHeaderActionComponentByWidgetType.ts
@@ -1,4 +1,5 @@
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
+import { WidgetActionCallRecordingTranscript } from '@/page-layout/widgets/call-recording-transcript/components/WidgetActionCallRecordingTranscript';
import { WidgetFieldActions } from '@/page-layout/widgets/components/WidgetFieldActions';
import { WidgetActionCalendarEventCreate } from '@/page-layout/widgets/calendar/components/WidgetActionCalendarEventCreate';
import { WidgetActionEmailCompose } from '@/page-layout/widgets/emails/components/WidgetActionEmailCompose';
@@ -23,4 +24,5 @@ export const WIDGET_HEADER_ACTION_COMPONENT_BY_WIDGET_TYPE: Partial<
[WidgetType.NOTES]: WidgetActionNoteCreate,
[WidgetType.FILES]: WidgetActionFileAttach,
[WidgetType.TIMELINE]: WidgetActionTimeline,
+ [WidgetType.CALL_RECORDING_TRANSCRIPT]: WidgetActionCallRecordingTranscript,
};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx
new file mode 100644
index 00000000000..e196b096cdb
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink.tsx
@@ -0,0 +1,52 @@
+import { styled } from '@linaria/react';
+import { Link } from 'react-router-dom';
+import { type IconComponent } from 'twenty-ui/icon';
+import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';
+
+const StyledActionLink = styled(Link)`
+ align-items: center;
+ border-radius: ${themeCssVariables.border.radius.md};
+ color: ${themeCssVariables.font.color.tertiary};
+ display: flex;
+ height: ${themeCssVariables.spacing[6]};
+ justify-content: center;
+ min-width: ${themeCssVariables.spacing[6]};
+ padding: ${themeCssVariables.spacing[1]};
+ text-decoration: none;
+ transition: background calc(${themeCssVariables.animation.duration.fast} * 1s)
+ ease;
+ width: ${themeCssVariables.spacing[6]};
+
+ &:hover {
+ background: ${themeCssVariables.background.transparent.light};
+ }
+
+ &:focus-visible {
+ outline: 2px solid ${themeCssVariables.color.blue};
+ outline-offset: 1px;
+ }
+
+ &:active {
+ background: ${themeCssVariables.background.transparent.medium};
+ }
+`;
+
+type WidgetCardHeaderActionLinkProps = {
+ Icon: IconComponent;
+ label: string;
+ to: string;
+};
+
+export const WidgetCardHeaderActionLink = ({
+ Icon,
+ label,
+ to,
+}: WidgetCardHeaderActionLinkProps) => {
+ const theme = useTheme();
+
+ return (
+ <StyledActionLink to={to} aria-label={label} title={label}>
+ <Icon size={theme.icon.size.sm} aria-hidden />
+ </StyledActionLink>
+ );
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/__stories__/WidgetCardHeaderActionLink.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/__stories__/WidgetCardHeaderActionLink.stories.tsx
new file mode 100644
index 00000000000..3e968002fc5
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/widget-card/components/__stories__/WidgetCardHeaderActionLink.stories.tsx
@@ -0,0 +1,31 @@
+import { WidgetCardHeaderActionLink } from '@/page-layout/widgets/widget-card/components/WidgetCardHeaderActionLink';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, within } from 'storybook/test';
+import { IconArrowUpRight } from 'twenty-ui/icon';
+import { ComponentDecorator } from 'twenty-ui/testing';
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+
+const meta: Meta<typeof WidgetCardHeaderActionLink> = {
+ title: 'Modules/PageLayout/Widgets/WidgetCardHeaderActionLink',
+ component: WidgetCardHeaderActionLink,
+ decorators: [MemoryRouterDecorator, ComponentDecorator],
+};
+
+export default meta;
+type Story = StoryObj<typeof WidgetCardHeaderActionLink>;
+
+export const Default: Story = {
+ args: {
+ Icon: IconArrowUpRight,
+ label: 'See all',
+ to: '/objects/callRecordings',
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ const link = await canvas.findByRole('link', { name: 'See all' });
+
+ expect(link).toHaveAttribute('href', '/objects/callRecordings');
+ expect(canvas.queryByRole('button')).not.toBeInTheDocument();
+ },
+};