2022-07-21 00:07:09 +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 './StoriesSettingsModal';
|
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
import { StoriesSettingsModal } from './StoriesSettingsModal';
|
2022-10-26 23:17:39 +00:00
|
|
|
import {
|
|
|
|
getDefaultConversation,
|
|
|
|
getDefaultGroup,
|
|
|
|
} from '../test-both/helpers/getDefaultConversation';
|
2022-07-21 00:07:09 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
2022-08-02 19:31:55 +00:00
|
|
|
import {
|
|
|
|
getMyStories,
|
|
|
|
getFakeDistributionList,
|
|
|
|
} from '../test-both/helpers/getFakeDistributionLists';
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/StoriesSettingsModal',
|
|
|
|
component: StoriesSettingsModal,
|
|
|
|
argTypes: {
|
|
|
|
candidateConversations: {
|
|
|
|
defaultValue: Array.from(Array(100), () => getDefaultConversation()),
|
|
|
|
},
|
2022-10-26 23:17:39 +00:00
|
|
|
signalConnections: {
|
|
|
|
defaultValue: Array.from(Array(42), getDefaultConversation),
|
|
|
|
},
|
2022-07-21 00:07:09 +00:00
|
|
|
distributionLists: {
|
|
|
|
defaultValue: [],
|
|
|
|
},
|
2022-10-26 23:17:39 +00:00
|
|
|
groupStories: {
|
|
|
|
defaultValue: Array.from(Array(2), getDefaultGroup),
|
|
|
|
},
|
2022-07-21 00:07:09 +00:00
|
|
|
getPreferredBadge: { action: true },
|
|
|
|
hideStoriesSettings: { action: true },
|
|
|
|
i18n: {
|
|
|
|
defaultValue: i18n,
|
|
|
|
},
|
|
|
|
me: {
|
|
|
|
defaultValue: getDefaultConversation(),
|
|
|
|
},
|
2022-10-25 22:18:42 +00:00
|
|
|
storyViewReceiptsEnabled: { control: 'boolean' },
|
2022-07-21 00:07:09 +00:00
|
|
|
onDeleteList: { action: true },
|
2022-11-01 17:34:23 +00:00
|
|
|
toggleGroupsForStorySend: { action: true },
|
2022-07-21 00:07:09 +00:00
|
|
|
onDistributionListCreated: { action: true },
|
|
|
|
onHideMyStoriesFrom: { action: true },
|
2022-11-11 04:10:30 +00:00
|
|
|
onRemoveMembers: { action: true },
|
2022-07-21 00:07:09 +00:00
|
|
|
onRepliesNReactionsChanged: { action: true },
|
|
|
|
onViewersUpdated: { action: true },
|
|
|
|
setMyStoriesToAllSignalConnections: { action: true },
|
|
|
|
toggleSignalConnectionsModal: { action: true },
|
2022-10-26 23:17:39 +00:00
|
|
|
setStoriesDisabled: { action: true },
|
2022-11-01 17:34:23 +00:00
|
|
|
getConversationByUuid: {
|
|
|
|
defaultValue: () => getDefaultGroup(),
|
|
|
|
},
|
2022-07-21 00:07:09 +00:00
|
|
|
},
|
|
|
|
} as Meta;
|
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
// eslint-disable-next-line react/function-component-definition
|
2022-07-21 00:07:09 +00:00
|
|
|
const Template: Story<PropsType> = args => <StoriesSettingsModal {...args} />;
|
|
|
|
|
|
|
|
export const MyStories = Template.bind({});
|
2022-08-02 19:31:55 +00:00
|
|
|
{
|
|
|
|
const myStories = getMyStories();
|
|
|
|
MyStories.args = {
|
|
|
|
distributionLists: [
|
|
|
|
{
|
|
|
|
...myStories,
|
|
|
|
members: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
export const MyStoriesBlockList = Template.bind({});
|
2022-08-02 19:31:55 +00:00
|
|
|
{
|
|
|
|
const myStories = getMyStories();
|
|
|
|
MyStoriesBlockList.args = {
|
|
|
|
distributionLists: [
|
|
|
|
{
|
|
|
|
...myStories,
|
|
|
|
members: Array.from(Array(2), () => getDefaultConversation()),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
export const MyStoriesExclusive = Template.bind({});
|
2022-08-02 19:31:55 +00:00
|
|
|
{
|
|
|
|
const myStories = getMyStories();
|
|
|
|
MyStoriesExclusive.args = {
|
|
|
|
distributionLists: [
|
|
|
|
{
|
|
|
|
...myStories,
|
|
|
|
isBlockList: false,
|
|
|
|
members: Array.from(Array(11), () => getDefaultConversation()),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|
2022-07-21 00:07:09 +00:00
|
|
|
|
|
|
|
export const SingleList = Template.bind({});
|
2022-08-02 19:31:55 +00:00
|
|
|
{
|
|
|
|
const myStories = getMyStories();
|
|
|
|
const fakeDistroList = getFakeDistributionList();
|
|
|
|
SingleList.args = {
|
|
|
|
distributionLists: [
|
|
|
|
{
|
|
|
|
...myStories,
|
|
|
|
members: [],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
...fakeDistroList,
|
|
|
|
members: fakeDistroList.memberUuids.map(() => getDefaultConversation()),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
}
|