2023-01-03 11:55:46 -08:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
2020-10-30 15:34:04 -05:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-06-04 11:16:19 -07:00
|
|
|
import * as React from 'react';
|
2020-09-11 17:46:52 -07:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2023-10-11 12:06:43 -07:00
|
|
|
import type { Meta } from '@storybook/react';
|
|
|
|
import type { PropsType } from './IncomingCallBar';
|
2020-06-04 11:16:19 -07:00
|
|
|
import { IncomingCallBar } from './IncomingCallBar';
|
2024-08-06 12:29:13 -07:00
|
|
|
import { CallMode } from '../types/CallDisposition';
|
2021-09-17 20:30:08 -04:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2020-06-04 11:16:19 -07:00
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
2021-05-07 17:21:10 -05:00
|
|
|
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
|
2020-06-04 11:16:19 -07:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
2021-08-20 11:06:15 -05:00
|
|
|
const commonProps = {
|
2020-06-04 11:16:19 -07:00
|
|
|
acceptCall: action('accept-call'),
|
2021-08-20 11:06:15 -05:00
|
|
|
bounceAppIconStart: action('bounceAppIconStart'),
|
|
|
|
bounceAppIconStop: action('bounceAppIconStop'),
|
2020-11-06 11:36:37 -06:00
|
|
|
call: {
|
|
|
|
conversationId: 'fake-conversation-id',
|
2020-06-04 11:16:19 -07:00
|
|
|
callId: 0,
|
|
|
|
isIncoming: true,
|
|
|
|
isVideoCall: true,
|
2020-11-06 11:36:37 -06:00
|
|
|
},
|
2021-05-07 17:21:10 -05:00
|
|
|
conversation: getDefaultConversation({
|
2020-10-07 21:25:33 -04:00
|
|
|
id: '3051234567',
|
2024-07-11 12:44:09 -07:00
|
|
|
avatarUrl: undefined,
|
2020-06-04 11:16:19 -07:00
|
|
|
name: 'Rick Sanchez',
|
|
|
|
phoneNumber: '3051234567',
|
|
|
|
profileName: 'Rick Sanchez',
|
2020-07-23 18:35:32 -07:00
|
|
|
title: 'Rick Sanchez',
|
2021-05-07 17:21:10 -05:00
|
|
|
}),
|
2020-06-04 11:16:19 -07:00
|
|
|
declineCall: action('decline-call'),
|
|
|
|
i18n,
|
2021-08-20 11:06:15 -05:00
|
|
|
notifyForCall: action('notify-for-call'),
|
2020-06-04 11:16:19 -07:00
|
|
|
};
|
|
|
|
|
2021-08-20 11:06:15 -05:00
|
|
|
const directConversation = getDefaultConversation({
|
|
|
|
id: '3051234567',
|
2024-07-11 12:44:09 -07:00
|
|
|
avatarUrl: undefined,
|
2021-08-20 11:06:15 -05:00
|
|
|
name: 'Rick Sanchez',
|
|
|
|
phoneNumber: '3051234567',
|
|
|
|
profileName: 'Rick Sanchez',
|
|
|
|
title: 'Rick Sanchez',
|
|
|
|
});
|
|
|
|
|
|
|
|
const groupConversation = getDefaultConversation({
|
2024-07-11 12:44:09 -07:00
|
|
|
avatarUrl: undefined,
|
2021-08-20 11:06:15 -05:00
|
|
|
name: 'Tahoe Trip',
|
|
|
|
title: 'Tahoe Trip',
|
|
|
|
type: 'group',
|
|
|
|
});
|
2020-06-04 11:16:19 -07:00
|
|
|
|
2022-06-06 20:48:02 -04:00
|
|
|
export default {
|
|
|
|
title: 'Components/IncomingCallBar',
|
2023-10-11 12:06:43 -07:00
|
|
|
} satisfies Meta<PropsType>;
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingDirectCallVideo(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={directConversation}
|
|
|
|
callMode={CallMode.Direct}
|
|
|
|
isVideoCall
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingDirectCallAudio(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={directConversation}
|
|
|
|
callMode={CallMode.Direct}
|
|
|
|
isVideoCall={false}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingGroupCallOnlyCallingYou(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={groupConversation}
|
|
|
|
callMode={CallMode.Group}
|
|
|
|
otherMembersRung={[]}
|
|
|
|
ringer={{ firstName: 'Rick', title: 'Rick Sanchez' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingGroupCallCallingYouAnd1Other(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={groupConversation}
|
|
|
|
callMode={CallMode.Group}
|
|
|
|
otherMembersRung={[{ firstName: 'Morty', title: 'Morty Smith' }]}
|
|
|
|
ringer={{ firstName: 'Rick', title: 'Rick Sanchez' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingGroupCallCallingYouAnd2Others(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={groupConversation}
|
|
|
|
callMode={CallMode.Group}
|
|
|
|
otherMembersRung={[
|
|
|
|
{ firstName: 'Morty', title: 'Morty Smith' },
|
|
|
|
{ firstName: 'Summer', title: 'Summer Smith' },
|
|
|
|
]}
|
|
|
|
ringer={{ firstName: 'Rick', title: 'Rick Sanchez' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingGroupCallCallingYouAnd3Others(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={groupConversation}
|
|
|
|
callMode={CallMode.Group}
|
|
|
|
otherMembersRung={[
|
|
|
|
{ firstName: 'Morty', title: 'Morty Smith' },
|
|
|
|
{ firstName: 'Summer', title: 'Summer Smith' },
|
|
|
|
{ firstName: 'Beth', title: 'Beth Smith' },
|
|
|
|
]}
|
|
|
|
ringer={{ firstName: 'Rick', title: 'Rick Sanchez' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-06-06 20:48:02 -04:00
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function IncomingGroupCallCallingYouAnd4Others(): JSX.Element {
|
|
|
|
return (
|
|
|
|
<IncomingCallBar
|
|
|
|
{...commonProps}
|
|
|
|
conversation={groupConversation}
|
|
|
|
callMode={CallMode.Group}
|
|
|
|
otherMembersRung={[
|
|
|
|
{ firstName: 'Morty', title: 'Morty Smith' },
|
|
|
|
{ firstName: 'Summer', title: 'Summer Smith' },
|
|
|
|
{ firstName: 'Beth', title: 'Beth Sanchez' },
|
|
|
|
{ firstName: 'Jerry', title: 'Beth Smith' },
|
|
|
|
]}
|
|
|
|
ringer={{ firstName: 'Rick', title: 'Rick Sanchez' }}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|