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';
|
2025-04-08 10:11:36 +10:00
|
|
|
|
2020-10-15 15:53:21 -04:00
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
2023-10-11 12:06:43 -07:00
|
|
|
import type { Meta } from '@storybook/react';
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { PropsType } from './CallingParticipantsList';
|
|
|
|
import { CallingParticipantsList } from './CallingParticipantsList';
|
2023-08-16 22:54:39 +02:00
|
|
|
import { generateAci } from '../types/ServiceId';
|
2025-04-08 10:11:36 +10:00
|
|
|
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,
|
2024-06-18 09:15:56 -07:00
|
|
|
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 || [],
|
2024-06-18 09:15:56 -07:00
|
|
|
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',
|
2023-10-11 12:06:43 -07:00
|
|
|
} 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: [
|
2025-04-08 10:11:36 +10:00
|
|
|
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: [
|
2025-04-08 10:11:36 +10:00
|
|
|
createCallParticipant({
|
2020-10-15 15:53:21 -04:00
|
|
|
title: 'Son Goku',
|
2020-11-17 10:07:53 -05:00
|
|
|
}),
|
2025-04-08 10:11:36 +10:00
|
|
|
createCallParticipant({
|
2020-11-17 10:07:53 -05:00
|
|
|
hasRemoteAudio: true,
|
2024-01-17 09:47:45 -08:00
|
|
|
hasRemoteVideo: true,
|
2021-05-20 17:54:03 -04:00
|
|
|
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
|
|
|
}),
|
2025-04-08 10:11:36 +10: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
|
|
|
}),
|
2025-04-08 10:11:36 +10: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
|
|
|
}),
|
2025-04-08 10:11:36 +10:00
|
|
|
createCallParticipant({
|
2024-01-17 09:47:45 -08:00
|
|
|
isHandRaised: true,
|
2020-10-15 15:53:21 -04:00
|
|
|
title: 'Supreme Kai Zamasu',
|
2020-11-17 10:07:53 -05:00
|
|
|
}),
|
2025-04-08 10:11:36 +10:00
|
|
|
createCallParticipant({
|
2024-01-17 09:47:45 -08:00
|
|
|
hasRemoteAudio: false,
|
|
|
|
hasRemoteVideo: true,
|
|
|
|
isHandRaised: true,
|
|
|
|
title: 'Chi Chi',
|
|
|
|
}),
|
2025-04-08 10:11:36 +10:00
|
|
|
createCallParticipant({
|
2024-01-17 09:47:45 -08:00
|
|
|
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)
|
2025-04-08 10:11:36 +10:00
|
|
|
.map(() => createCallParticipant({ title: 'Kirby' })),
|
2020-11-20 12:19:53 -05:00
|
|
|
});
|
|
|
|
return <CallingParticipantsList {...props} />;
|
2022-11-17 16:45:19 -08:00
|
|
|
}
|