mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 01:55:34 -05:00
9daa8f5d98
[web] rename all the JSX files to .jsx/.tsx GitOrigin-RevId: 82056ae47e017523722cf258dcc83c8a925a28f7
69 lines
1.4 KiB
JavaScript
69 lines
1.4 KiB
JavaScript
import { useEffect } from 'react'
|
|
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,
|
|
Story => {
|
|
useEffect(() => {
|
|
window.MathJax = {
|
|
Hub: {
|
|
Queue: () => {},
|
|
config: { tex2jax: { inlineMath: [['$', '$']] } },
|
|
},
|
|
}
|
|
|
|
return () => {
|
|
delete window.MathJax
|
|
}
|
|
}, [])
|
|
|
|
return <Story />
|
|
},
|
|
],
|
|
}
|