2020-11-19 23:31:04 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
import { noop } from 'lodash';
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
|
|
|
|
import {
|
|
|
|
GroupCallRemoteParticipant,
|
|
|
|
PropsType,
|
|
|
|
} from './GroupCallRemoteParticipant';
|
2020-12-18 19:16:44 +00:00
|
|
|
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
|
2020-11-19 23:31:04 +00:00
|
|
|
import { setup as setupI18n } from '../../js/modules/i18n';
|
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
2020-12-04 17:30:46 +00:00
|
|
|
type OverridePropsType =
|
|
|
|
| {
|
|
|
|
isInPip: true;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
isInPip: false;
|
|
|
|
height: number;
|
|
|
|
left: number;
|
|
|
|
top: number;
|
|
|
|
width: number;
|
|
|
|
};
|
|
|
|
|
2020-12-02 01:30:25 +00:00
|
|
|
const createProps = (
|
2020-12-04 17:30:46 +00:00
|
|
|
overrideProps: OverridePropsType,
|
2020-12-02 01:30:25 +00:00
|
|
|
isBlocked?: boolean
|
2020-12-04 17:30:46 +00:00
|
|
|
): PropsType => ({
|
2020-11-19 23:31:04 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
getGroupCallVideoFrameSource: noop as any,
|
|
|
|
i18n,
|
|
|
|
remoteParticipant: {
|
|
|
|
demuxId: 123,
|
|
|
|
hasRemoteAudio: false,
|
|
|
|
hasRemoteVideo: true,
|
|
|
|
videoAspectRatio: 1.3,
|
2020-12-08 19:37:04 +00:00
|
|
|
...getDefaultConversation({
|
|
|
|
isBlocked: Boolean(isBlocked),
|
|
|
|
title:
|
|
|
|
'Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso',
|
|
|
|
uuid: '992ed3b9-fc9b-47a9-bdb4-e0c7cbb0fda5',
|
|
|
|
}),
|
2020-11-19 23:31:04 +00:00
|
|
|
},
|
|
|
|
...overrideProps,
|
|
|
|
});
|
|
|
|
|
|
|
|
const story = storiesOf('Components/GroupCallRemoteParticipant', module);
|
|
|
|
|
|
|
|
story.add('Default', () => (
|
|
|
|
<GroupCallRemoteParticipant
|
|
|
|
{...createProps({
|
|
|
|
isInPip: false,
|
|
|
|
height: 120,
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
width: 120,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
|
|
|
story.add('isInPip', () => (
|
|
|
|
<GroupCallRemoteParticipant
|
|
|
|
{...createProps({
|
|
|
|
isInPip: true,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
));
|
2020-12-02 01:30:25 +00:00
|
|
|
|
|
|
|
story.add('Blocked', () => (
|
|
|
|
<GroupCallRemoteParticipant
|
|
|
|
{...createProps(
|
|
|
|
{
|
|
|
|
isInPip: false,
|
|
|
|
height: 120,
|
|
|
|
left: 0,
|
|
|
|
top: 0,
|
|
|
|
width: 120,
|
|
|
|
},
|
|
|
|
true
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
));
|