2022-06-17 00:48:57 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import type { Meta, StoryFn } from '@storybook/react';
|
2022-06-17 00:48:57 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2023-10-11 19:06:43 +00:00
|
|
|
import { action } from '@storybook/addon-actions';
|
2022-06-17 00:48:57 +00:00
|
|
|
import type { PropsType } from './StoryCreator';
|
|
|
|
import enMessages from '../../_locales/en/messages.json';
|
|
|
|
import { StoryCreator } from './StoryCreator';
|
|
|
|
import { fakeAttachment } from '../test-both/helpers/fakeAttachment';
|
2022-08-10 18:37:19 +00:00
|
|
|
import {
|
|
|
|
getDefaultConversation,
|
|
|
|
getDefaultGroup,
|
|
|
|
} from '../test-both/helpers/getDefaultConversation';
|
2022-08-30 19:13:32 +00:00
|
|
|
import { getFakeDistributionListsWithMembers } from '../test-both/helpers/getFakeDistributionLists';
|
2022-06-17 00:48:57 +00:00
|
|
|
import { setupI18n } from '../util/setupI18n';
|
|
|
|
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/StoryCreator',
|
|
|
|
component: StoryCreator,
|
2023-10-11 19:06:43 +00:00
|
|
|
args: {
|
|
|
|
candidateConversations: Array.from(Array(100), getDefaultConversation),
|
|
|
|
debouncedMaybeGrabLinkPreview: action('debouncedMaybeGrabLinkPreview'),
|
|
|
|
distributionLists: getFakeDistributionListsWithMembers(),
|
|
|
|
getPreferredBadge: () => undefined,
|
|
|
|
groupConversations: Array.from(Array(7), getDefaultGroup),
|
|
|
|
groupStories: Array.from(Array(4), getDefaultGroup),
|
|
|
|
hasFirstStoryPostExperience: false,
|
|
|
|
i18n,
|
2022-11-16 21:41:38 +00:00
|
|
|
imageToBlurHash: async () => 'LDA,FDBnm+I=p{tkIUI;~UkpELV]',
|
2023-10-11 19:06:43 +00:00
|
|
|
installedPacks: [],
|
|
|
|
isSending: false,
|
|
|
|
linkPreview: undefined,
|
|
|
|
me: getDefaultConversation(),
|
|
|
|
onClose: action('onClose'),
|
|
|
|
onDeleteList: action('onDeleteList'),
|
|
|
|
onDistributionListCreated: undefined,
|
|
|
|
onHideMyStoriesFrom: action('onHideMyStoriesFrom'),
|
|
|
|
onSend: action('onSend'),
|
|
|
|
onSetSkinTone: action('onSetSkinTone'),
|
|
|
|
onUseEmoji: action('onUseEmoji'),
|
|
|
|
onViewersUpdated: action('onViewersUpdated'),
|
|
|
|
processAttachment: undefined,
|
|
|
|
recentEmojis: [],
|
|
|
|
recentStickers: [],
|
|
|
|
sendStoryModalOpenStateChanged: action('sendStoryModalOpenStateChanged'),
|
|
|
|
setMyStoriesToAllSignalConnections: action(
|
|
|
|
'setMyStoriesToAllSignalConnections'
|
|
|
|
),
|
|
|
|
signalConnections: Array.from(Array(42), getDefaultConversation),
|
|
|
|
skinTone: 0,
|
|
|
|
toggleSignalConnectionsModal: action('toggleSignalConnectionsModal'),
|
2022-08-02 19:31:55 +00:00
|
|
|
},
|
2023-10-11 19:06:43 +00:00
|
|
|
} satisfies Meta<PropsType>;
|
2022-06-17 00:48:57 +00:00
|
|
|
|
2022-11-18 00:45:19 +00:00
|
|
|
// eslint-disable-next-line react/function-component-definition
|
2023-10-11 19:06:43 +00:00
|
|
|
const Template: StoryFn<PropsType> = args => <StoryCreator {...args} />;
|
2022-06-17 00:48:57 +00:00
|
|
|
|
|
|
|
export const Default = Template.bind({});
|
2022-08-02 19:31:55 +00:00
|
|
|
Default.args = {};
|
2022-06-17 00:48:57 +00:00
|
|
|
|
|
|
|
export const LinkPreview = Template.bind({});
|
|
|
|
LinkPreview.args = {
|
|
|
|
linkPreview: {
|
|
|
|
domain: 'www.catsandkittens.lolcats',
|
|
|
|
image: fakeAttachment({
|
|
|
|
url: '/fixtures/kitten-4-112-112.jpg',
|
|
|
|
}),
|
|
|
|
title: 'Cats & Kittens LOL',
|
|
|
|
url: 'https://www.catsandkittens.lolcats/kittens/page/1',
|
2024-02-22 21:19:50 +00:00
|
|
|
isCallLink: false,
|
2022-06-17 00:48:57 +00:00
|
|
|
},
|
|
|
|
};
|
2022-08-23 17:24:55 +00:00
|
|
|
|
|
|
|
export const FirstTime = Template.bind({});
|
|
|
|
FirstTime.args = {
|
|
|
|
hasFirstStoryPostExperience: true,
|
|
|
|
};
|
2022-11-02 00:36:16 +00:00
|
|
|
|
|
|
|
export const Sending = Template.bind({});
|
|
|
|
Sending.args = {
|
|
|
|
isSending: true,
|
|
|
|
};
|