import ChatPane from '../js/features/chat/components/chat-pane'
import useFetchMock from './hooks/use-fetch-mock'
import { generateMessages } from './fixtures/chat-messages'
import { ScopeDecorator } from './decorators/scope'
import { bsVersionDecorator } from '../../.storybook/utils/with-bootstrap-switcher'
export const Conversation = args => {
useFetchMock(fetchMock => {
fetchMock.get(/messages/, generateMessages(35)).post(/messages/, {})
})
return
}
export const NoMessages = args => {
useFetchMock(fetchMock => {
fetchMock.get(/messages/, [])
})
return
}
export const Loading = args => {
useFetchMock(fetchMock => {
fetchMock.get(/messages/, generateMessages(6), {
delay: 1000 * 10,
})
})
return
}
export const LoadingError = args => {
useFetchMock(fetchMock => {
fetchMock.get(/messages/, 500)
})
return
}
export default {
title: 'Editor / Chat',
component: ChatPane,
argTypes: {
resetUnreadMessages: { action: 'resetUnreadMessages' },
...bsVersionDecorator.argTypes,
},
args: {
resetUnreadMessages: () => {},
},
decorators: [ScopeDecorator],
}