Group calling enhancements

This commit is contained in:
Josh Perez 2020-11-17 10:07:53 -05:00 committed by Josh Perez
parent 72e4ec95ce
commit 1f0c091e13
27 changed files with 1038 additions and 451 deletions

View file

@ -6,61 +6,76 @@ import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { CallingParticipantsList, PropsType } from './CallingParticipantsList';
import { Colors } from '../types/Colors';
import { GroupCallRemoteParticipantType } from '../types/Calling';
import { setup as setupI18n } from '../../js/modules/i18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
const participant = {
title: 'Bardock',
};
function createParticipant(
participantProps: Partial<GroupCallRemoteParticipantType>
): GroupCallRemoteParticipantType {
const randomColor = Math.floor(Math.random() * Colors.length - 1);
return {
avatarPath: participantProps.avatarPath,
color: Colors[randomColor],
hasRemoteAudio: Boolean(participantProps.hasRemoteAudio),
hasRemoteVideo: Boolean(participantProps.hasRemoteVideo),
isSelf: Boolean(participantProps.isSelf),
profileName: participantProps.title,
title: String(participantProps.title),
};
}
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
i18n,
onClose: action('on-close'),
participants: overrideProps.participants || [participant],
participants: overrideProps.participants || [],
});
const story = storiesOf('Components/CallingParticipantsList', module);
story.add('Default', () => {
story.add('No one', () => {
const props = createProps();
return <CallingParticipantsList {...props} />;
});
story.add('Solo Call', () => {
const props = createProps({
participants: [
createParticipant({
title: 'Bardock',
}),
],
});
return <CallingParticipantsList {...props} />;
});
story.add('Many Participants', () => {
const props = createProps({
participants: [
{
color: 'blue',
profileName: 'Son Goku',
createParticipant({
isSelf: true,
title: 'Son Goku',
audioMuted: true,
videoMuted: true,
},
{
color: 'deep_orange',
profileName: 'Rage Trunks',
}),
createParticipant({
hasRemoteAudio: true,
hasRemoteVideo: true,
title: 'Rage Trunks',
},
{
color: 'indigo',
profileName: 'Prince Vegeta',
}),
createParticipant({
hasRemoteAudio: true,
title: 'Prince Vegeta',
videoMuted: true,
},
{
color: 'pink',
profileName: 'Goku Black',
}),
createParticipant({
hasRemoteAudio: true,
hasRemoteVideo: true,
title: 'Goku Black',
},
{
color: 'green',
profileName: 'Supreme Kai Zamasu',
}),
createParticipant({
title: 'Supreme Kai Zamasu',
audioMuted: true,
videoMuted: true,
},
}),
],
});
return <CallingParticipantsList {...props} />;