Centralize calling toasts and add imperative API

This commit is contained in:
trevor-signal 2023-10-19 14:59:21 -04:00 committed by GitHub
parent dd45b08b0f
commit 0c896ca1f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 568 additions and 158 deletions

View file

@ -10,7 +10,7 @@ import type { Meta } from '@storybook/react';
import { AvatarColors } from '../types/Colors';
import type { ConversationType } from '../state/ducks/conversations';
import type { PropsType } from './CallingLobby';
import { CallingLobby } from './CallingLobby';
import { CallingLobby as UnwrappedCallingLobby } from './CallingLobby';
import { setupI18n } from '../util/setupI18n';
import { generateAci } from '../types/ServiceId';
import enMessages from '../../_locales/en/messages.json';
@ -18,6 +18,7 @@ import {
getDefaultConversation,
getDefaultConversationWithServiceId,
} from '../test-both/helpers/getDefaultConversation';
import { CallingToastProvider } from './CallingToast';
const i18n = setupI18n('en', enMessages);
@ -74,6 +75,14 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => {
};
};
function CallingLobby(props: ReturnType<typeof createProps>) {
return (
<CallingToastProvider i18n={i18n}>
<UnwrappedCallingLobby {...props} />
</CallingToastProvider>
);
}
const fakePeekedParticipant = (conversationProps: Partial<ConversationType>) =>
getDefaultConversationWithServiceId({
...conversationProps,