diff --git a/adapter/src/components/AppWrapper.js b/adapter/src/components/AppWrapper.js index 0c94ffe9..bbc9c799 100644 --- a/adapter/src/components/AppWrapper.js +++ b/adapter/src/components/AppWrapper.js @@ -1,9 +1,6 @@ import PropTypes from 'prop-types' import React from 'react' -import { - useCurrentUserLocale, - useSystemDefaultLocale, -} from '../utils/useLocale.js' +import { useCurrentUserLocale } from '../utils/useLocale.js' import { useVerifyLatestUser } from '../utils/useVerifyLatestUser.js' import { Alerts } from './Alerts.js' import { ConnectedHeaderBar } from './ConnectedHeaderBar.js' @@ -37,28 +34,3 @@ AppWrapper.propTypes = { children: PropTypes.node, plugin: PropTypes.bool, } - -export const LoginAppWrapper = ({ children }) => { - const { loading: localeLoading } = useSystemDefaultLocale() - // cannot check current user for a loginApp (no api/me) - - if (localeLoading) { - return - } - - return ( -
- -
- window.location.reload()}> - {children} - -
- -
- ) -} - -LoginAppWrapper.propTypes = { - children: PropTypes.node, -} diff --git a/adapter/src/components/LoginAppWrapper.js b/adapter/src/components/LoginAppWrapper.js new file mode 100644 index 00000000..7ad42d5a --- /dev/null +++ b/adapter/src/components/LoginAppWrapper.js @@ -0,0 +1,32 @@ +import PropTypes from 'prop-types' +import React from 'react' +import { useSystemDefaultLocale } from '../utils/useLocale.js' +import { Alerts } from './Alerts.js' +import { ErrorBoundary } from './ErrorBoundary.js' +import { LoadingMask } from './LoadingMask.js' +import { styles } from './styles/AppWrapper.style.js' + +export const LoginAppWrapper = ({ children }) => { + const { loading: localeLoading } = useSystemDefaultLocale() + // cannot check current user for a loginApp (no api/me) + + if (localeLoading) { + return + } + + return ( +
+ +
+ window.location.reload()}> + {children} + +
+ +
+ ) +} + +LoginAppWrapper.propTypes = { + children: PropTypes.node, +} diff --git a/adapter/src/index.js b/adapter/src/index.js index e1b05b5e..d31250d2 100644 --- a/adapter/src/index.js +++ b/adapter/src/index.js @@ -1,8 +1,9 @@ import { checkForSWUpdateAndReload } from '@dhis2/pwa' import PropTypes from 'prop-types' import React from 'react' -import { LoginAppWrapper, AppWrapper } from './components/AppWrapper.js' +import { AppWrapper } from './components/AppWrapper.js' import { ErrorBoundary } from './components/ErrorBoundary.js' +import { LoginAppWrapper } from './components/LoginAppWrapper.js' import { OfflineInterfaceProvider } from './components/OfflineInterfaceContext.js' import { PWALoadingBoundary } from './components/PWALoadingBoundary.js' import { ServerVersionProvider } from './components/ServerVersionProvider.js'