overleaf/services/web/frontend/js/shared/context/root-context.js
Miguel Serrano 9b59c0813c Replaced application-context with user-context (#4246)
* Replaced `application-context` with `user-context`
* deleted `user` initialization with `window.user`
* fixed tests and storybook

GitOrigin-RevId: 0ed4b9070d7c6d370fee2112f310c4bcfea519e7
2021-06-26 02:05:53 +00:00

36 lines
1.1 KiB
JavaScript

import PropTypes from 'prop-types'
import createSharedContext from 'react2angular-shared-context'
import { UserProvider } from './user-context'
import { IdeProvider } from './ide-context'
import { EditorProvider } from './editor-context'
import { CompileProvider } from './compile-context'
import { LayoutProvider } from './layout-context'
import { ChatProvider } from '../../features/chat/context/chat-context'
import { ProjectProvider } from './project-context'
export function ContextRoot({ children, ide, settings }) {
return (
<IdeProvider ide={ide}>
<UserProvider>
<ProjectProvider>
<EditorProvider settings={settings}>
<CompileProvider>
<LayoutProvider>
<ChatProvider>{children}</ChatProvider>
</LayoutProvider>
</CompileProvider>
</EditorProvider>
</ProjectProvider>
</UserProvider>
</IdeProvider>
)
}
ContextRoot.propTypes = {
children: PropTypes.any,
ide: PropTypes.any.isRequired,
settings: PropTypes.any.isRequired,
}
export const rootContext = createSharedContext(ContextRoot)