Skip to content

The open alternative to Salesforce, designed for AI.

Match the call recorder widget skeletons to Twenty's loader (#28442)

nitin60c977c45e6e
diff --git a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallParticipantsWidget.tsx b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallParticipantsWidget.tsx
index 8d50fb1da1d..37f8b76ae67 100644
--- a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallParticipantsWidget.tsx
+++ b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallParticipantsWidget.tsx
@@ -5,12 +5,14 @@ import { isUndefined } from '@sniptt/guards';
import {
useSelectedObjectMetadata,
useSelectedRecordIds,
+ useTranslate,
} from 'twenty-sdk/front-component';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { CallParticipantChip } from 'src/front-components/components/CallParticipantChip';
import { FrontComponentThemeProvider } from 'src/front-components/components/FrontComponentThemeProvider';
import { StyledWidgetContainer } from 'src/front-components/components/StyledWidgetContainer';
+import { StyledChipSkeleton } from 'src/front-components/components/StyledChipSkeleton';
import { useCallParticipants } from 'src/front-components/hooks/use-call-participants';
import { buildCallParticipantDisplayItems } from 'src/front-components/utils/build-call-participant-display-items.util';
@@ -25,9 +27,20 @@ type CallParticipantListProps = {
};
const CallParticipantList = ({ callRecordingId }: CallParticipantListProps) => {
+ const { t } = useTranslate();
const callParticipantsState = useCallParticipants(callRecordingId);
- if (callParticipantsState.status !== 'loaded') {
+ if (callParticipantsState.status === 'loading') {
+ return (
+ <StyledChipSkeleton
+ aria-busy
+ aria-label={t('Loading call participants')}
+ $width={themeCssVariables.spacing[24]}
+ />
+ );
+ }
+
+ if (callParticipantsState.status === 'error') {
return null;
}
diff --git a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingRowSkeleton.tsx b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingRowSkeleton.tsx
index 2da10728220..119752cf0c3 100644
--- a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingRowSkeleton.tsx
+++ b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingRowSkeleton.tsx
@@ -1,31 +1,28 @@
-import { keyframes } from '@emotion/react';
import styled from '@emotion/styled';
+import { useTranslate } from 'twenty-sdk/front-component';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { StyledCallRecordingRowLayout } from 'src/front-components/components/StyledCallRecordingRowLayout';
+import { StyledChipSkeleton } from 'src/front-components/components/StyledChipSkeleton';
-const pulse = keyframes`
- 0%, 100% { opacity: 1; }
- 50% { opacity: 0.4; }
+const StyledRightContent = styled.span`
+ display: flex;
+ gap: ${() => themeCssVariables.spacing[2]};
`;
-const StyledSkeletonBlock = styled.span<{ $width: string }>`
- animation: ${pulse} 1.5s ease-in-out infinite;
- background: ${() => themeCssVariables.background.transparent.light};
- border-radius: ${() => themeCssVariables.border.radius.sm};
- flex-shrink: 0;
- height: ${() => themeCssVariables.spacing[4]};
- width: ${({ $width }) => $width};
-`;
-
-const StyledSkeletonSpacer = styled.span`
- flex: 1;
-`;
+export const CallRecordingRowSkeleton = () => {
+ const { t } = useTranslate();
-export const CallRecordingRowSkeleton = () => (
- <StyledCallRecordingRowLayout aria-hidden>
- <StyledSkeletonBlock $width="40%" />
- <StyledSkeletonSpacer />
- <StyledSkeletonBlock $width={themeCssVariables.spacing[20]} />
- </StyledCallRecordingRowLayout>
-);
+ return (
+ <StyledCallRecordingRowLayout
+ aria-busy
+ aria-label={t('Loading call recordings')}
+ >
+ <StyledChipSkeleton $width={themeCssVariables.spacing[32]} />
+ <StyledRightContent>
+ <StyledChipSkeleton $width={themeCssVariables.spacing[11]} />
+ <StyledChipSkeleton $width={themeCssVariables.spacing[14]} />
+ </StyledRightContent>
+ </StyledCallRecordingRowLayout>
+ );
+};
diff --git a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingsWidget.tsx b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingsWidget.tsx
index 10315529311..5cbf840a6b4 100644
--- a/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingsWidget.tsx
+++ b/packages/twenty-apps/public/call-recorder/src/front-components/components/CallRecordingsWidget.tsx
@@ -20,8 +20,6 @@ import { getCallRecordingStatusTag } from 'src/front-components/utils/get-call-r
import { getCalendarEventTargetFieldName } from 'src/front-components/utils/get-calendar-event-target-field-name.util';
import { resolveCallRecordingDisplayTitle } from 'src/front-components/utils/resolve-call-recording-display-title.util';
-const CALL_RECORDING_SKELETON_ROW_COUNT = 3;
-
type CallRecordingListProps = {
calendarEventTargetFieldName: CalendarEventTargetFieldName;
recordId: string;
@@ -37,51 +35,42 @@ const CallRecordingList = ({
recordId,
});
- switch (callRecordingsState.status) {
- case 'loading':
- return (
- <StyledCallRecordingCard aria-busy aria-label="Loading call recordings">
- {Array.from(
- { length: CALL_RECORDING_SKELETON_ROW_COUNT },
- (_, skeletonRowIndex) => (
- <CallRecordingRowSkeleton key={skeletonRowIndex} />
- ),
- )}
- </StyledCallRecordingCard>
- );
- case 'error':
- return null;
- case 'loaded':
- if (callRecordingsState.callRecordings.length === 0) {
- return null;
- }
+ if (callRecordingsState.status === 'loading') {
+ return <CallRecordingRowSkeleton />;
+ }
- return (
- <StyledCallRecordingCard>
- {callRecordingsState.callRecordings.map((callRecording) => (
- <CallRecordingRow
- key={callRecording.id}
- callRecordingId={callRecording.id}
- calendarEventId={
- callRecording.calendarEvent?.isShared
- ? callRecording.calendarEvent.id
- : undefined
- }
- title={resolveCallRecordingDisplayTitle(callRecording)}
- formattedDate={formatCallRecordingDate({
- dateTime: getCallRecordingDisplayDate(callRecording),
- locale,
- })}
- formattedDuration={formatCallRecordingDuration({
- startedAt: callRecording.startedAt,
- endedAt: callRecording.endedAt,
- })}
- statusTag={getCallRecordingStatusTag(callRecording.status)}
- />
- ))}
- </StyledCallRecordingCard>
- );
+ if (
+ callRecordingsState.status === 'error' ||
+ callRecordingsState.callRecordings.length === 0
+ ) {
+ return null;
}
+
+ return (
+ <StyledCallRecordingCard>
+ {callRecordingsState.callRecordings.map((callRecording) => (
+ <CallRecordingRow
+ key={callRecording.id}
+ callRecordingId={callRecording.id}
+ calendarEventId={
+ callRecording.calendarEvent?.isShared
+ ? callRecording.calendarEvent.id
+ : undefined
+ }
+ title={resolveCallRecordingDisplayTitle(callRecording)}
+ formattedDate={formatCallRecordingDate({
+ dateTime: getCallRecordingDisplayDate(callRecording),
+ locale,
+ })}
+ formattedDuration={formatCallRecordingDuration({
+ startedAt: callRecording.startedAt,
+ endedAt: callRecording.endedAt,
+ })}
+ statusTag={getCallRecordingStatusTag(callRecording.status)}
+ />
+ ))}
+ </StyledCallRecordingCard>
+ );
};
export const CallRecordingsWidget = () => {
diff --git a/packages/twenty-apps/public/call-recorder/src/front-components/components/StyledChipSkeleton.tsx b/packages/twenty-apps/public/call-recorder/src/front-components/components/StyledChipSkeleton.tsx
new file mode 100644
index 00000000000..719bc7bdaae
--- /dev/null
+++ b/packages/twenty-apps/public/call-recorder/src/front-components/components/StyledChipSkeleton.tsx
@@ -0,0 +1,39 @@
+import { keyframes } from '@emotion/react';
+import styled from '@emotion/styled';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+const shimmer = keyframes`
+ from { transform: translateX(-100%); }
+ to { transform: translateX(100%); }
+`;
+
+export const StyledChipSkeleton = styled.span<{ $width: string }>`
+ background-color: ${() => themeCssVariables.background.tertiary};
+ border-radius: ${() => themeCssVariables.border.radius.md};
+ display: block;
+ flex-shrink: 0;
+ height: ${() => themeCssVariables.spacing[5]};
+ overflow: hidden;
+ position: relative;
+ width: ${({ $width }) => $width};
+
+ &::after {
+ animation: ${shimmer} 1.5s ease-in-out infinite;
+ background-image: linear-gradient(
+ 90deg,
+ ${() => themeCssVariables.background.tertiary} 0%,
+ ${() => themeCssVariables.background.transparent.lighter} 50%,
+ ${() => themeCssVariables.background.tertiary} 100%
+ );
+ content: '';
+ inset: 0;
+ position: absolute;
+ transform: translateX(-100%);
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ &::after {
+ display: none;
+ }
+ }
+`;