2017-08-17 19:31:27 +00:00
|
|
|
/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */
|
2017-12-08 19:36:03 +00:00
|
|
|
import React from 'react';
|
2020-07-31 17:06:22 +00:00
|
|
|
import { Provider } from 'react-redux';
|
|
|
|
import { createStore, combineReducers } from 'redux';
|
2017-08-17 19:31:27 +00:00
|
|
|
import { storiesOf } from '@storybook/react-native';
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
import RoomItem from './RoomItem';
|
2020-10-30 13:59:44 +00:00
|
|
|
import './List';
|
2021-01-20 20:43:59 +00:00
|
|
|
import './ServerItem';
|
2018-09-11 16:32:52 +00:00
|
|
|
import Message from './Message';
|
2020-02-11 14:01:35 +00:00
|
|
|
import UiKitMessage from './UiKitMessage';
|
|
|
|
import UiKitModal from './UiKitModal';
|
2020-03-04 13:57:07 +00:00
|
|
|
import Markdown from './Markdown';
|
2020-10-30 16:15:58 +00:00
|
|
|
import './HeaderButtons';
|
|
|
|
import './UnreadBadge';
|
2020-10-30 17:35:07 +00:00
|
|
|
import '../../app/views/ThreadMessagesView/Item.stories.js';
|
2020-10-30 13:12:02 +00:00
|
|
|
import Avatar from './Avatar';
|
2019-04-08 12:35:28 +00:00
|
|
|
// import RoomViewHeader from './RoomViewHeader';
|
2017-08-17 19:31:27 +00:00
|
|
|
|
2020-05-18 16:25:13 +00:00
|
|
|
import MessageContext from '../../app/containers/message/Context';
|
2020-10-30 17:35:07 +00:00
|
|
|
import { themes } from '../../app/constants/colors';
|
2020-05-18 16:25:13 +00:00
|
|
|
|
|
|
|
// MessageProvider
|
|
|
|
const baseUrl = 'https://open.rocket.chat';
|
|
|
|
const user = {
|
|
|
|
id: '',
|
|
|
|
username: 'diego.mello',
|
|
|
|
token: ''
|
|
|
|
};
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
// Change here to see themed storybook
|
|
|
|
const theme = 'light';
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
const reducers = combineReducers({
|
|
|
|
settings: () => ({}),
|
|
|
|
login: () => ({
|
|
|
|
user: {
|
|
|
|
username: 'diego.mello'
|
|
|
|
}
|
|
|
|
}),
|
2020-11-04 16:53:44 +00:00
|
|
|
server: () => ({
|
|
|
|
server: 'https://open.rocket.chat',
|
|
|
|
version: '3.7.0'
|
|
|
|
}),
|
|
|
|
share: () => ({
|
|
|
|
server: 'https://open.rocket.chat',
|
|
|
|
version: '3.7.0',
|
|
|
|
settings: {}
|
|
|
|
}),
|
2020-07-31 17:06:22 +00:00
|
|
|
meteor: () => ({ connected: true }),
|
|
|
|
activeUsers: () => ({ abc: { status: 'online', statusText: 'dog' } })
|
|
|
|
});
|
|
|
|
const store = createStore(reducers);
|
2017-12-08 19:36:03 +00:00
|
|
|
|
2020-05-18 16:25:13 +00:00
|
|
|
const messageDecorator = story => (
|
|
|
|
<MessageContext.Provider
|
|
|
|
value={{
|
|
|
|
user,
|
|
|
|
baseUrl,
|
|
|
|
onPress: () => {},
|
|
|
|
onLongPress: () => {},
|
|
|
|
reactionInit: () => {},
|
|
|
|
onErrorPress: () => {},
|
|
|
|
replyBroadcast: () => {},
|
|
|
|
onReactionPress: () => {},
|
|
|
|
onDiscussionPress: () => {},
|
2020-10-30 17:35:07 +00:00
|
|
|
onReactionLongPress: () => {},
|
2020-12-17 17:39:45 +00:00
|
|
|
threadBadgeColor: themes.light.tunreadColor
|
2020-05-18 16:25:13 +00:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{story()}
|
|
|
|
</MessageContext.Provider>
|
|
|
|
);
|
|
|
|
|
2020-07-31 17:06:22 +00:00
|
|
|
storiesOf('RoomItem', module)
|
|
|
|
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
|
|
|
|
.add('list roomitem', () => <RoomItem theme={theme} />);
|
2018-09-11 16:32:52 +00:00
|
|
|
storiesOf('Message', module)
|
2020-10-30 15:54:02 +00:00
|
|
|
.addDecorator(story => <Provider store={store}>{story()}</Provider>)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list message', () => <Message theme={theme} />);
|
|
|
|
|
|
|
|
storiesOf('UiKitMessage', module)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list uikitmessage', () => <UiKitMessage theme={theme} />);
|
|
|
|
storiesOf('UiKitModal', module)
|
2020-05-18 16:25:13 +00:00
|
|
|
.addDecorator(messageDecorator)
|
2020-02-11 14:01:35 +00:00
|
|
|
.add('list UiKitModal', () => <UiKitModal theme={theme} />);
|
2020-03-04 13:57:07 +00:00
|
|
|
storiesOf('Markdown', module)
|
|
|
|
.add('list Markdown', () => <Markdown theme={theme} />);
|
2020-10-30 13:12:02 +00:00
|
|
|
storiesOf('Avatar', module)
|
|
|
|
.add('list Avatar', () => <Avatar theme={theme} />);
|
2020-02-11 14:01:35 +00:00
|
|
|
|
2019-04-08 12:35:28 +00:00
|
|
|
// FIXME: I couldn't make these pass on jest :(
|
|
|
|
// storiesOf('RoomViewHeader', module)
|
2019-12-04 16:39:53 +00:00
|
|
|
// .add('list', () => <RoomViewHeader theme='black' />);
|