overleaf/services/web/frontend/js/shared/context/application-context.js
Paulo Jorge Reis 11e58b5844 Add timeout upgrade prompt to the new compile UI (#3528)
* 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
2021-01-15 03:05:48 +00:00

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
}