mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
11e58b5844
* Uncouple account-upgrade and exposted-settings from Angular * Mock socket shim with the correct methods * Extract timeout upgrade prompt to a component GitOrigin-RevId: ee8058b38bf5e20924a21f40d32c5bb0ee06c555
26 lines
685 B
JavaScript
26 lines
685 B
JavaScript
import React, { createContext, useContext } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import ExposedSettings from '../../main/exposed-settings'
|
|
|
|
export const ApplicationContext = createContext()
|
|
|
|
export function ApplicationProvider({ children }) {
|
|
const applicationContextValue = {
|
|
user: window.user,
|
|
exposedSettings: ExposedSettings
|
|
}
|
|
return (
|
|
<ApplicationContext.Provider value={applicationContextValue}>
|
|
{children}
|
|
</ApplicationContext.Provider>
|
|
)
|
|
}
|
|
|
|
ApplicationProvider.propTypes = {
|
|
children: PropTypes.any
|
|
}
|
|
|
|
export function useApplicationContext() {
|
|
const applicationContext = useContext(ApplicationContext)
|
|
return applicationContext
|
|
}
|