mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 17:23:48 -05:00
c997d1dc2b
GitOrigin-RevId: 32a43361cfc883aa1a5ed85f6be5432b6e838b9d
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
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'
|
|
|
|
export const Conversation = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.get(/messages/, generateMessages(35)).post(/messages/, {})
|
|
})
|
|
|
|
return <ChatPane {...args} />
|
|
}
|
|
|
|
export const NoMessages = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.get(/messages/, [])
|
|
})
|
|
|
|
return <ChatPane {...args} />
|
|
}
|
|
|
|
export const Loading = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.get(/messages/, generateMessages(6), {
|
|
delay: 1000 * 10,
|
|
})
|
|
})
|
|
|
|
return <ChatPane {...args} />
|
|
}
|
|
|
|
export const LoadingError = args => {
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.get(/messages/, 500)
|
|
})
|
|
|
|
return <ChatPane {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Editor / Chat',
|
|
component: ChatPane,
|
|
argTypes: {
|
|
resetUnreadMessages: { action: 'resetUnreadMessages' },
|
|
},
|
|
args: {
|
|
resetUnreadMessages: () => {},
|
|
},
|
|
decorators: [ScopeDecorator],
|
|
}
|