2020-03-26 21:47:35 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
import { storiesOf } from '@storybook/react';
|
|
|
|
import { action } from '@storybook/addon-actions';
|
|
|
|
|
|
|
|
import { setup as setupI18n } from '../../../js/modules/i18n';
|
2020-09-14 19:51:27 +00:00
|
|
|
import enMessages from '../../../_locales/en/messages.json';
|
2020-03-26 21:47:35 +00:00
|
|
|
import {
|
|
|
|
ConversationHeader,
|
2020-07-24 01:35:32 +00:00
|
|
|
PropsActionsType,
|
|
|
|
PropsHousekeepingType,
|
|
|
|
PropsType,
|
2020-03-26 21:47:35 +00:00
|
|
|
} from './ConversationHeader';
|
2020-04-06 16:48:58 +00:00
|
|
|
import { gifUrl } from '../../storybook/Fixtures';
|
2020-03-26 21:47:35 +00:00
|
|
|
|
|
|
|
const book = storiesOf('Components/Conversation/ConversationHeader', module);
|
|
|
|
const i18n = setupI18n('en', enMessages);
|
|
|
|
|
|
|
|
type ConversationHeaderStory = {
|
|
|
|
title: string;
|
|
|
|
description: string;
|
|
|
|
items: Array<{
|
|
|
|
title: string;
|
2020-07-24 01:35:32 +00:00
|
|
|
props: PropsType;
|
2020-03-26 21:47:35 +00:00
|
|
|
}>;
|
|
|
|
};
|
|
|
|
|
2020-07-24 01:35:32 +00:00
|
|
|
const actionProps: PropsActionsType = {
|
2020-03-26 21:47:35 +00:00
|
|
|
onSetDisappearingMessages: action('onSetDisappearingMessages'),
|
|
|
|
onDeleteMessages: action('onDeleteMessages'),
|
|
|
|
onResetSession: action('onResetSession'),
|
|
|
|
onSearchInConversation: action('onSearchInConversation'),
|
2020-08-27 19:45:08 +00:00
|
|
|
onSetMuteNotifications: action('onSetMuteNotifications'),
|
2020-06-04 18:16:19 +00:00
|
|
|
onOutgoingAudioCallInConversation: action(
|
|
|
|
'onOutgoingAudioCallInConversation'
|
|
|
|
),
|
|
|
|
onOutgoingVideoCallInConversation: action(
|
|
|
|
'onOutgoingVideoCallInConversation'
|
|
|
|
),
|
2020-03-26 21:47:35 +00:00
|
|
|
|
|
|
|
onShowSafetyNumber: action('onShowSafetyNumber'),
|
|
|
|
onShowAllMedia: action('onShowAllMedia'),
|
|
|
|
onShowGroupMembers: action('onShowGroupMembers'),
|
|
|
|
onGoBack: action('onGoBack'),
|
|
|
|
|
|
|
|
onArchive: action('onArchive'),
|
|
|
|
onMoveToInbox: action('onMoveToInbox'),
|
2020-10-02 18:30:43 +00:00
|
|
|
onSetPin: action('onSetPin'),
|
2020-03-26 21:47:35 +00:00
|
|
|
};
|
|
|
|
|
2020-07-24 01:35:32 +00:00
|
|
|
const housekeepingProps: PropsHousekeepingType = {
|
2020-03-26 21:47:35 +00:00
|
|
|
i18n,
|
|
|
|
};
|
|
|
|
|
|
|
|
const stories: Array<ConversationHeaderStory> = [
|
|
|
|
{
|
|
|
|
title: '1:1 conversation',
|
|
|
|
description:
|
|
|
|
"Note the five items in menu, and the second-level menu with disappearing messages options. Disappearing message set to 'off'.",
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
title: 'With name and profile, verified',
|
|
|
|
props: {
|
|
|
|
color: 'red',
|
|
|
|
isVerified: true,
|
2020-04-06 16:48:58 +00:00
|
|
|
avatarPath: gifUrl,
|
2020-07-24 01:35:32 +00:00
|
|
|
title: 'Someone 🔥 Somewhere',
|
2020-03-26 21:47:35 +00:00
|
|
|
name: 'Someone 🔥 Somewhere',
|
|
|
|
phoneNumber: '(202) 555-0001',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '1',
|
|
|
|
profileName: '🔥Flames🔥',
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'With name, not verified, no avatar',
|
|
|
|
props: {
|
|
|
|
color: 'blue',
|
|
|
|
isVerified: false,
|
2020-07-24 01:35:32 +00:00
|
|
|
title: 'Someone 🔥 Somewhere',
|
2020-03-26 21:47:35 +00:00
|
|
|
name: 'Someone 🔥 Somewhere',
|
|
|
|
phoneNumber: '(202) 555-0002',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
|
|
|
id: '2',
|
|
|
|
isAccepted: true,
|
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'With name, not verified, descenders',
|
|
|
|
props: {
|
|
|
|
color: 'blue',
|
|
|
|
isVerified: false,
|
|
|
|
title: 'Joyrey 🔥 Leppey',
|
|
|
|
name: 'Joyrey 🔥 Leppey',
|
|
|
|
phoneNumber: '(202) 555-0002',
|
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '2',
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Profile, no name',
|
|
|
|
props: {
|
|
|
|
color: 'teal',
|
|
|
|
isVerified: false,
|
|
|
|
phoneNumber: '(202) 555-0003',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '3',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '🔥Flames🔥',
|
2020-03-26 21:47:35 +00:00
|
|
|
profileName: '🔥Flames🔥',
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'No name, no profile, no color',
|
|
|
|
props: {
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '(202) 555-0011',
|
2020-03-26 21:47:35 +00:00
|
|
|
phoneNumber: '(202) 555-0011',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '11',
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'With back button',
|
|
|
|
props: {
|
|
|
|
showBackButton: true,
|
|
|
|
color: 'deep_orange',
|
|
|
|
phoneNumber: '(202) 555-0004',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '(202) 555-0004',
|
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '4',
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Disappearing messages set',
|
|
|
|
props: {
|
|
|
|
color: 'indigo',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '(202) 555-0005',
|
2020-03-26 21:47:35 +00:00
|
|
|
phoneNumber: '(202) 555-0005',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
id: '5',
|
|
|
|
expirationSettingName: '10 seconds',
|
|
|
|
timerOptions: [
|
|
|
|
{
|
|
|
|
name: 'off',
|
|
|
|
value: 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '10 seconds',
|
|
|
|
value: 10,
|
|
|
|
},
|
|
|
|
],
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
2020-08-27 19:45:08 +00:00
|
|
|
{
|
|
|
|
title: 'Muting Conversation',
|
|
|
|
props: {
|
|
|
|
color: 'ultramarine',
|
|
|
|
title: '(202) 555-0006',
|
|
|
|
phoneNumber: '(202) 555-0006',
|
|
|
|
type: 'direct',
|
|
|
|
id: '6',
|
|
|
|
muteExpirationLabel: '10/18/3000, 11:11 AM',
|
|
|
|
isAccepted: true,
|
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
2020-03-26 21:47:35 +00:00
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'In a group',
|
|
|
|
description:
|
|
|
|
"Note that the menu should includes 'Show Members' instead of 'Show Safety Number'",
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
title: 'Basic',
|
|
|
|
props: {
|
|
|
|
color: 'signal-blue',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: 'Typescript support group',
|
2020-03-26 21:47:35 +00:00
|
|
|
name: 'Typescript support group',
|
|
|
|
phoneNumber: '',
|
|
|
|
id: '1',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'group',
|
2020-03-26 21:47:35 +00:00
|
|
|
expirationSettingName: '10 seconds',
|
|
|
|
timerOptions: [
|
|
|
|
{
|
|
|
|
name: 'off',
|
|
|
|
value: 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '10 seconds',
|
|
|
|
value: 10,
|
|
|
|
},
|
|
|
|
],
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'In a group you left - no disappearing messages',
|
|
|
|
props: {
|
|
|
|
color: 'signal-blue',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: 'Typescript support group',
|
2020-03-26 21:47:35 +00:00
|
|
|
name: 'Typescript support group',
|
|
|
|
phoneNumber: '',
|
|
|
|
id: '2',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'group',
|
2020-09-09 02:25:05 +00:00
|
|
|
disableTimerChanges: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
expirationSettingName: '10 seconds',
|
|
|
|
timerOptions: [
|
|
|
|
{
|
|
|
|
name: 'off',
|
|
|
|
value: 0,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: '10 seconds',
|
|
|
|
value: 10,
|
|
|
|
},
|
|
|
|
],
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Note to Self',
|
|
|
|
description: 'No safety number entry.',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
title: 'In chat with yourself',
|
|
|
|
props: {
|
|
|
|
color: 'blue',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '(202) 555-0007',
|
2020-03-26 21:47:35 +00:00
|
|
|
phoneNumber: '(202) 555-0007',
|
|
|
|
id: '7',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-03-26 21:47:35 +00:00
|
|
|
isMe: true,
|
2020-05-27 21:37:06 +00:00
|
|
|
isAccepted: true,
|
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Unaccepted',
|
|
|
|
description: 'No safety number entry.',
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
title: '1:1 conversation',
|
|
|
|
props: {
|
|
|
|
color: 'blue',
|
2020-07-24 01:35:32 +00:00
|
|
|
title: '(202) 555-0007',
|
2020-05-27 21:37:06 +00:00
|
|
|
phoneNumber: '(202) 555-0007',
|
|
|
|
id: '7',
|
2020-07-24 01:35:32 +00:00
|
|
|
type: 'direct',
|
2020-05-27 21:37:06 +00:00
|
|
|
isMe: false,
|
|
|
|
isAccepted: false,
|
2020-03-26 21:47:35 +00:00
|
|
|
...actionProps,
|
|
|
|
...housekeepingProps,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
stories.forEach(({ title, description, items }) =>
|
|
|
|
book.add(
|
|
|
|
title,
|
|
|
|
() =>
|
|
|
|
items.map(({ title: subtitle, props }, i) => {
|
|
|
|
return (
|
|
|
|
<div key={i}>
|
|
|
|
{subtitle ? <h3>{subtitle}</h3> : null}
|
|
|
|
<ConversationHeader {...props} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
{
|
|
|
|
docs: description,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|