2021-01-14 08:58:12 -05:00
|
|
|
import ChatPane from '../js/features/chat/components/chat-pane'
|
2021-05-11 10:25:22 -04:00
|
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
2022-05-16 05:38:20 -04:00
|
|
|
import { generateMessages } from './fixtures/chat-messages'
|
|
|
|
import { ScopeDecorator } from './decorators/scope'
|
2021-01-14 08:58:12 -05:00
|
|
|
|
2021-05-11 10:25:22 -04:00
|
|
|
export const Conversation = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
fetchMock.get(/messages/, generateMessages(35)).post(/messages/, {})
|
|
|
|
})
|
|
|
|
|
|
|
|
return <ChatPane {...args} />
|
2021-01-14 08:58:12 -05:00
|
|
|
}
|
|
|
|
|
2021-05-11 10:25:22 -04:00
|
|
|
export const NoMessages = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
2021-01-14 08:58:12 -05:00
|
|
|
fetchMock.get(/messages/, [])
|
2021-05-11 10:25:22 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
return <ChatPane {...args} />
|
2021-01-14 08:58:12 -05:00
|
|
|
}
|
|
|
|
|
2021-05-11 10:25:22 -04:00
|
|
|
export const Loading = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
2021-01-14 08:58:12 -05:00
|
|
|
fetchMock.get(/messages/, generateMessages(6), {
|
2021-04-27 03:52:58 -04:00
|
|
|
delay: 1000 * 10,
|
2021-01-14 08:58:12 -05:00
|
|
|
})
|
2021-05-11 10:25:22 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
return <ChatPane {...args} />
|
2021-01-14 08:58:12 -05:00
|
|
|
}
|
|
|
|
|
2022-05-16 05:38:20 -04:00
|
|
|
export const LoadingError = args => {
|
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
fetchMock.get(/messages/, 500)
|
|
|
|
})
|
|
|
|
|
|
|
|
return <ChatPane {...args} />
|
|
|
|
}
|
|
|
|
|
2021-01-14 08:58:12 -05:00
|
|
|
export default {
|
2022-03-28 06:23:21 -04:00
|
|
|
title: 'Editor / Chat',
|
2021-01-14 08:58:12 -05:00
|
|
|
component: ChatPane,
|
|
|
|
argTypes: {
|
2021-04-27 03:52:58 -04:00
|
|
|
resetUnreadMessages: { action: 'resetUnreadMessages' },
|
2021-01-14 08:58:12 -05:00
|
|
|
},
|
|
|
|
args: {
|
2021-04-27 03:52:58 -04:00
|
|
|
resetUnreadMessages: () => {},
|
2021-01-14 08:58:12 -05:00
|
|
|
},
|
2024-02-08 04:34:07 -05:00
|
|
|
decorators: [ScopeDecorator],
|
2021-01-14 08:58:12 -05:00
|
|
|
}
|