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

94 lines
2.5 KiB
TypeScript
Raw Normal View History

2022-08-02 19:31:55 +00:00
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Meta, Story } from '@storybook/react';
import React from 'react';
import type { PropsType } from './SendStoryModal';
import enMessages from '../../_locales/en/messages.json';
import { SendStoryModal } from './SendStoryModal';
2022-08-10 18:37:19 +00:00
import {
getDefaultConversation,
getDefaultGroup,
} from '../test-both/helpers/getDefaultConversation';
2022-08-02 19:31:55 +00:00
import { setupI18n } from '../util/setupI18n';
import {
getMyStories,
2022-08-30 19:13:32 +00:00
getFakeDistributionListsWithMembers,
2022-08-02 19:31:55 +00:00
} from '../test-both/helpers/getFakeDistributionLists';
const i18n = setupI18n('en', enMessages);
2022-08-30 19:13:32 +00:00
const myStories = {
...getMyStories(),
members: [],
};
2022-08-02 19:31:55 +00:00
export default {
title: 'Components/SendStoryModal',
component: SendStoryModal,
argTypes: {
2022-08-10 18:37:19 +00:00
candidateConversations: {
defaultValue: Array.from(Array(100), () => getDefaultConversation()),
},
2022-08-02 19:31:55 +00:00
distributionLists: {
2022-08-30 19:13:32 +00:00
defaultValue: [myStories],
2022-08-02 19:31:55 +00:00
},
2022-08-10 18:37:19 +00:00
getPreferredBadge: { action: true },
groupConversations: {
defaultValue: Array.from(Array(7), getDefaultGroup),
},
groupStories: {
defaultValue: Array.from(Array(2), getDefaultGroup),
},
2022-08-23 17:24:55 +00:00
hasFirstStoryPostExperience: {
defaultValue: false,
},
2022-08-02 19:31:55 +00:00
i18n: {
defaultValue: i18n,
},
me: {
defaultValue: getDefaultConversation(),
},
onClose: { action: true },
2022-08-30 19:13:32 +00:00
onDeleteList: { action: true },
2022-08-10 18:37:19 +00:00
onDistributionListCreated: { action: true },
2022-08-23 17:24:55 +00:00
onHideMyStoriesFrom: { action: true },
2022-08-02 19:31:55 +00:00
onSend: { action: true },
2022-08-23 17:24:55 +00:00
onViewersUpdated: { action: true },
setMyStoriesToAllSignalConnections: { action: true },
2022-08-02 19:31:55 +00:00
signalConnections: {
defaultValue: Array.from(Array(42), getDefaultConversation),
},
2022-08-30 19:13:32 +00:00
toggleGroupsForStorySend: { action: true },
2022-08-23 17:24:55 +00:00
toggleSignalConnectionsModal: { action: true },
2022-08-02 19:31:55 +00:00
},
} as Meta;
const Template: Story<PropsType> = args => <SendStoryModal {...args} />;
export const Modal = Template.bind({});
Modal.args = {
2022-08-30 19:13:32 +00:00
distributionLists: getFakeDistributionListsWithMembers(),
2022-08-02 19:31:55 +00:00
};
2022-08-23 17:24:55 +00:00
export const FirstTime = Template.bind({});
FirstTime.args = {
2022-08-30 19:13:32 +00:00
distributionLists: [myStories],
groupStories: [],
hasFirstStoryPostExperience: true,
};
export const FirstTimeAlreadyConfiguredOnMobile = Template.bind({});
FirstTime.args = {
distributionLists: [
{
...myStories,
isBlockList: false,
members: Array.from(Array(3), getDefaultConversation),
},
],
2022-08-23 17:24:55 +00:00
groupStories: [],
hasFirstStoryPostExperience: true,
};