signal-desktop/ts/components/CallingParticipantsList.stories.tsx

94 lines
2.5 KiB
TypeScript
Raw Normal View History

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-10-15 15:53:21 -04:00
import * as React from 'react';
2020-10-15 15:53:21 -04:00
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './CallingParticipantsList';
import { CallingParticipantsList } from './CallingParticipantsList';
2023-08-16 22:54:39 +02:00
import { generateAci } from '../types/ServiceId';
import { createCallParticipant } from '../test-both/helpers/createCallParticipant';
2020-10-15 15:53:21 -04:00
2025-03-13 12:52:08 -07:00
const { i18n } = window.SignalContext;
2020-10-15 15:53:21 -04:00
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
i18n,
conversationId: 'fake-conversation-id',
2020-10-15 15:53:21 -04:00
onClose: action('on-close'),
2023-08-16 22:54:39 +02:00
ourServiceId: generateAci(),
2020-11-17 10:07:53 -05:00
participants: overrideProps.participants || [],
showContactModal: action('show-contact-modal'),
2020-10-15 15:53:21 -04:00
});
2022-06-06 20:48:02 -04:00
export default {
title: 'Components/CallingParticipantsList',
} satisfies Meta<PropsType>;
2020-10-15 15:53:21 -04:00
2022-11-17 16:45:19 -08:00
export function NoOne(): JSX.Element {
2020-10-15 15:53:21 -04:00
const props = createProps();
return <CallingParticipantsList {...props} />;
2022-11-17 16:45:19 -08:00
}
2022-06-06 20:48:02 -04:00
2022-11-17 16:45:19 -08:00
export function SoloCall(): JSX.Element {
2020-11-17 10:07:53 -05:00
const props = createProps({
participants: [
createCallParticipant({
2020-11-17 10:07:53 -05:00
title: 'Bardock',
}),
],
});
return <CallingParticipantsList {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-11-17 10:07:53 -05:00
2022-11-17 16:45:19 -08:00
export function ManyParticipants(): JSX.Element {
2020-10-15 15:53:21 -04:00
const props = createProps({
participants: [
createCallParticipant({
2020-10-15 15:53:21 -04:00
title: 'Son Goku',
2020-11-17 10:07:53 -05:00
}),
createCallParticipant({
2020-11-17 10:07:53 -05:00
hasRemoteAudio: true,
hasRemoteVideo: true,
presenting: true,
2020-11-20 14:39:50 -05:00
name: 'Rage Trunks',
2020-10-15 15:53:21 -04:00
title: 'Rage Trunks',
2020-11-17 10:07:53 -05:00
}),
createCallParticipant({
2020-11-17 10:07:53 -05:00
hasRemoteAudio: true,
2020-10-15 15:53:21 -04:00
title: 'Prince Vegeta',
2020-11-17 10:07:53 -05:00
}),
createCallParticipant({
2020-11-17 10:07:53 -05:00
hasRemoteAudio: true,
hasRemoteVideo: true,
2020-11-20 14:39:50 -05:00
name: 'Goku Black',
2020-10-15 15:53:21 -04:00
title: 'Goku Black',
2020-11-17 10:07:53 -05:00
}),
createCallParticipant({
isHandRaised: true,
2020-10-15 15:53:21 -04:00
title: 'Supreme Kai Zamasu',
2020-11-17 10:07:53 -05:00
}),
createCallParticipant({
hasRemoteAudio: false,
hasRemoteVideo: true,
isHandRaised: true,
title: 'Chi Chi',
}),
createCallParticipant({
title: 'Someone With A Really Long Name',
}),
2020-10-15 15:53:21 -04:00
],
});
return <CallingParticipantsList {...props} />;
2022-11-17 16:45:19 -08:00
}
2020-11-20 12:19:53 -05:00
2022-11-17 16:45:19 -08:00
export function Overflow(): JSX.Element {
2020-11-20 12:19:53 -05:00
const props = createProps({
participants: Array(50)
.fill(null)
.map(() => createCallParticipant({ title: 'Kirby' })),
2020-11-20 12:19:53 -05:00
});
return <CallingParticipantsList {...props} />;
2022-11-17 16:45:19 -08:00
}