2020-12-14 06:44:10 -05:00
|
|
|
import React from 'react'
|
2021-01-27 05:30:55 -05:00
|
|
|
import PropTypes from 'prop-types'
|
2020-12-14 06:44:10 -05:00
|
|
|
import { ApplicationProvider } from './application-context'
|
|
|
|
import { EditorProvider } from './editor-context'
|
|
|
|
import createSharedContext from 'react2angular-shared-context'
|
2021-02-09 10:37:48 -05:00
|
|
|
import { ChatProvider } from '../../features/chat/context/chat-context'
|
2020-12-14 06:44:10 -05:00
|
|
|
|
2021-02-09 10:37:48 -05:00
|
|
|
export function ContextRoot({
|
|
|
|
children,
|
|
|
|
editorLoading,
|
|
|
|
chatIsOpenAngular,
|
|
|
|
setChatIsOpenAngular
|
|
|
|
}) {
|
2020-12-14 06:44:10 -05:00
|
|
|
return (
|
|
|
|
<ApplicationProvider>
|
2021-02-09 10:37:48 -05:00
|
|
|
<EditorProvider
|
|
|
|
loading={editorLoading}
|
|
|
|
chatIsOpenAngular={chatIsOpenAngular}
|
|
|
|
setChatIsOpenAngular={setChatIsOpenAngular}
|
|
|
|
>
|
|
|
|
<ChatProvider>{children}</ChatProvider>
|
|
|
|
</EditorProvider>
|
2020-12-14 06:44:10 -05:00
|
|
|
</ApplicationProvider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2021-01-27 05:30:55 -05:00
|
|
|
ContextRoot.propTypes = {
|
|
|
|
children: PropTypes.any,
|
2021-02-09 10:37:48 -05:00
|
|
|
editorLoading: PropTypes.bool,
|
|
|
|
chatIsOpenAngular: PropTypes.bool,
|
|
|
|
setChatIsOpenAngular: PropTypes.func.isRequired
|
2021-01-27 05:30:55 -05:00
|
|
|
}
|
|
|
|
|
2020-12-14 06:44:10 -05:00
|
|
|
export const rootContext = createSharedContext(ContextRoot)
|