// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; import { action } from '@storybook/addon-actions'; import type { Meta } from '@storybook/react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; import { CallMode } from '../../types/Calling'; import { generateAci } from '../../types/ServiceId'; import { CallingNotification, type PropsType } from './CallingNotification'; import { getDefaultConversation, getDefaultGroup, } from '../../test-both/helpers/getDefaultConversation'; import type { CallStatus } from '../../types/CallDisposition'; import { CallType, CallDirection, GroupCallStatus, DirectCallStatus, } from '../../types/CallDisposition'; import type { ConversationType } from '../../state/ducks/conversations'; const i18n = setupI18n('en', enMessages); export default { title: 'Components/Conversation/CallingNotification', } satisfies Meta; const getCommonProps = (options: { mode: CallMode; type?: CallType; direction?: CallDirection; status?: CallStatus; callCreator?: ConversationType | null; groupCallEnded: boolean | null; deviceCount: number; maxDevices: number; }): PropsType => { const { mode, type = mode === CallMode.Group ? CallType.Group : CallType.Audio, direction = CallDirection.Outgoing, status = mode === CallMode.Group ? GroupCallStatus.GenericGroupCall : DirectCallStatus.Pending, callCreator = getDefaultConversation({ serviceId: generateAci(), isMe: direction === CallDirection.Outgoing, }), groupCallEnded, deviceCount, maxDevices, } = options; const conversation = mode === CallMode.Group ? getDefaultGroup() : getDefaultConversation(); return { id: 'message-id', conversationId: conversation.id, i18n, isNextItemCallingNotification: false, onOutgoingAudioCallInConversation: action( 'onOutgoingAudioCallInConversation' ), onOutgoingVideoCallInConversation: action( 'onOutgoingVideoCallInConversation' ), toggleDeleteMessagesModal: action('toggleDeleteMessagesModal'), returnToActiveCall: action('returnToActiveCall'), callHistory: { callId: '123', peerId: conversation.id, ringerId: callCreator?.serviceId ?? null, mode, type, direction, timestamp: Date.now(), status, }, callCreator, activeConversationId: null, groupCallEnded, maxDevices, deviceCount, isSelectMode: false, isTargeted: false, }; }; /* */ export function AcceptedIncomingAudioCall(): JSX.Element { return ( ); } export function AcceptedIncomingVideoCall(): JSX.Element { return ( ); } export function DeclinedIncomingAudioCall(): JSX.Element { return ( ); } export function DeclinedIncomingVideoCall(): JSX.Element { return ( ); } export function AcceptedOutgoingAudioCall(): JSX.Element { return ( ); } export function AcceptedOutgoingVideoCall(): JSX.Element { return ( ); } export function DeclinedOutgoingAudioCall(): JSX.Element { return ( ); } export function DeclinedOutgoingVideoCall(): JSX.Element { return ( ); } export function TwoIncomingDirectCallsBackToBack(): JSX.Element { return ( <> ); } export function TwoOutgoingDirectCallsBackToBack(): JSX.Element { return ( <> ); } export function GroupCallByUnknown(): JSX.Element { return ( ); } export function GroupCallByYou(): JSX.Element { return ( ); } export function GroupCallBySomeone(): JSX.Element { return ( ); } export function GroupCallStartedBySomeoneWithALongName(): JSX.Element { return ( ); } export function GroupCallActiveCallFull(): JSX.Element { return ( ); } export function GroupCallEnded(): JSX.Element { return ( ); }