// Copyright 2022 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import type { Meta } from '@storybook/react'; import React from 'react'; import { action } from '@storybook/addon-actions'; import type { PropsType } from './StoryViewer'; import enMessages from '../../_locales/en/messages.json'; import { SendStatus } from '../messages/MessageSendState'; import { StoryViewModeType } from '../types/Stories'; import { generateStoryDistributionId } from '../types/StoryDistributionId'; import { StoryViewer } from './StoryViewer'; import { VIDEO_MP4 } from '../types/MIME'; import { fakeAttachment } from '../test-both/helpers/fakeAttachment'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { getFakeStoryView } from '../test-both/helpers/getFakeStory'; import { setupI18n } from '../util/setupI18n'; import { DEFAULT_PREFERRED_REACTION_EMOJI } from '../reactions/constants'; const i18n = setupI18n('en', enMessages); export default { title: 'Components/StoryViewer', component: StoryViewer, argTypes: { hasAllStoriesUnmuted: { control: 'boolean', }, hasViewReceiptSetting: { control: 'boolean', }, }, args: { currentIndex: 0, getPreferredBadge: () => undefined, group: undefined, hasAllStoriesUnmuted: true, hasViewReceiptSetting: true, i18n, platform: 'darwin', loadStoryReplies: action('loadStoryReplies'), markStoryRead: action('markStoryRead'), numStories: 1, onGoToConversation: action('onGoToConversation'), onHideStory: action('onHideStory'), onReactToStory: action('onReactToStory'), onReplyToStory: action('onReplyToStory'), onSetSkinTone: action('onSetSkinTone'), onTextTooLong: action('onTextTooLong'), onUseEmoji: action('onUseEmoji'), onMediaPlaybackStart: action('onMediaPlaybackStart'), preferredReactionEmoji: DEFAULT_PREFERRED_REACTION_EMOJI, queueStoryDownload: action('queueStoryDownload'), renderEmojiPicker: () => <>EmojiPicker, retryMessageSend: action('retryMessageSend'), showToast: action('showToast'), skinTone: 0, story: getFakeStoryView(), storyViewMode: StoryViewModeType.All, viewStory: action('viewStory'), isWindowActive: true, }, } satisfies Meta; export function SomeonesStory(args: PropsType): JSX.Element { return ; } export function WideStory(args: PropsType): JSX.Element { return ( ); } export function InAGroup(args: PropsType): JSX.Element { return ( ); } export function MultiStory(args: PropsType): JSX.Element { return ( ); } export function Caption(args: PropsType): JSX.Element { return ( ); } export function EmojiCaption(args: PropsType): JSX.Element { return ( ); } export function LongCaption(args: PropsType): JSX.Element { return ( ); } export function YourStory(args: PropsType): JSX.Element { const storyView = getFakeStoryView( '/fixtures/nathan-anderson-316188-unsplash.jpg' ); return ( ); } export function YourStoryFailed(args: PropsType): JSX.Element { const storyView = getFakeStoryView( '/fixtures/nathan-anderson-316188-unsplash.jpg' ); return ( ); } export function ReadReceiptsOff(args: PropsType): JSX.Element { const storyView = getFakeStoryView( '/fixtures/nathan-anderson-316188-unsplash.jpg' ); return ( ); }