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