Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use new headerbar with online status indicator #626

Merged
merged 2 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: add pwaEnabled to app config for headerbar
  • Loading branch information
KaiVandivier committed Aug 30, 2021
commit 2a0d5d4e9fb5e74e781e8e90f5cd1db012ad7565
3 changes: 3 additions & 0 deletions adapter/src/components/ServerVersionProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const ServerVersionProvider = ({
url,
apiVersion,
offlineInterface,
pwaEnabled,
children,
}) => {
const [{ loading, error, systemInfo }, setState] = useState({
Expand Down Expand Up @@ -55,6 +56,7 @@ export const ServerVersionProvider = ({
apiVersion: apiVersion || realApiVersion,
serverVersion,
systemInfo,
pwaEnabled,
}}
offlineInterface={offlineInterface}
>
Expand All @@ -67,5 +69,6 @@ ServerVersionProvider.propTypes = {
apiVersion: PropTypes.number,
children: PropTypes.element,
offlineInterface: PropTypes.shape({}),
pwaEnabled: PropTypes.bool,
url: PropTypes.string,
}
4 changes: 3 additions & 1 deletion adapter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { ServerVersionProvider } from './components/ServerVersionProvider'

const offlineInterface = new OfflineInterface()

const AppAdapter = ({ url, apiVersion, appName, children }) => (
const AppAdapter = ({ url, apiVersion, appName, pwaEnabled, children }) => (
<ErrorBoundary fullscreen onRetry={checkForSWUpdateAndReload}>
<ServerVersionProvider
url={url}
apiVersion={apiVersion}
pwaEnabled={pwaEnabled}
offlineInterface={offlineInterface}
>
<AppWrapper appName={appName}>{children}</AppWrapper>
Expand All @@ -23,6 +24,7 @@ AppAdapter.propTypes = {
appName: PropTypes.string.isRequired,
apiVersion: PropTypes.number,
children: PropTypes.element,
pwaEnabled: PropTypes.bool,
url: PropTypes.string,
}

Expand Down
1 change: 1 addition & 0 deletions shell/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const appConfig = {
window.localStorage.DHIS2_BASE_URL,
appName: process.env.REACT_APP_DHIS2_APP_NAME || '',
apiVersion: parseInt(process.env.REACT_APP_DHIS2_API_VERSION),
pwaEnabled: process.env.REACT_APP_DHIS2_APP_PWA_ENABLED === 'true',
}

const App = () => (
Expand Down