overleaf/services/web/frontend/js/shared/context/root-context.js
Miguel Serrano d78644e02c Merge pull request #3632 from overleaf/msm-navbar-collaborator-widget
[ReactNavToolbar] Collaborators widget

GitOrigin-RevId: 65f2484962591103f02eb7624a974d0806b1abf0
2021-02-11 03:04:36 +00:00

40 lines
1.1 KiB
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { ApplicationProvider } from './application-context'
import { EditorProvider } from './editor-context'
import createSharedContext from 'react2angular-shared-context'
import { ChatProvider } from '../../features/chat/context/chat-context'
export function ContextRoot({
children,
editorLoading,
chatIsOpenAngular,
setChatIsOpenAngular,
openDoc,
onlineUsersArray
}) {
return (
<ApplicationProvider>
<EditorProvider
loading={editorLoading}
chatIsOpenAngular={chatIsOpenAngular}
setChatIsOpenAngular={setChatIsOpenAngular}
openDoc={openDoc}
onlineUsersArray={onlineUsersArray}
>
<ChatProvider>{children}</ChatProvider>
</EditorProvider>
</ApplicationProvider>
)
}
ContextRoot.propTypes = {
children: PropTypes.any,
editorLoading: PropTypes.bool,
chatIsOpenAngular: PropTypes.bool,
setChatIsOpenAngular: PropTypes.func.isRequired,
openDoc: PropTypes.func.isRequired,
onlineUsersArray: PropTypes.array.isRequired
}
export const rootContext = createSharedContext(ContextRoot)