diff --git a/i18n/en.pot b/i18n/en.pot index cd92531..529f339 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2021-03-17T12:13:51.869Z\n" -"PO-Revision-Date: 2021-03-17T12:13:51.869Z\n" +"POT-Creation-Date: 2021-03-17T14:45:51.504Z\n" +"PO-Revision-Date: 2021-03-17T14:45:51.504Z\n" msgid "No apps found" msgstr "" diff --git a/src/components/AppList/index.js b/src/components/AppList/index.js index 1d45e17..fa0295c 100644 --- a/src/components/AppList/index.js +++ b/src/components/AppList/index.js @@ -1,11 +1,6 @@ import i18n from '@dhis2/d2-i18n' import { PropTypes } from '@dhis2/prop-types' -import { - NoticeBox, - CenteredContent, - CircularLoader, - InputField, -} from '@dhis2/ui' +import { InputField } from '@dhis2/ui' import React from 'react' import { useHistory } from 'react-router-dom' import { useQueryParam, StringParam, withDefault } from 'use-query-params' @@ -89,11 +84,8 @@ AllApps.propTypes = { } const AppList = ({ - error, - loading, apps, appsWithUpdates, - errorLabel, updatesAvailableLabel, allAppsLabel, searchLabel, @@ -106,22 +98,6 @@ const AppList = ({ setQuery(value, 'replaceIn') } - if (error) { - return ( - - {error.message} - - ) - } - - if (loading) { - return ( - - - - ) - } - const searchFilter = app => !query || app.name.toLocaleLowerCase().includes(query.toLocaleLowerCase()) @@ -147,13 +123,10 @@ const AppList = ({ AppList.propTypes = { allAppsLabel: PropTypes.string.isRequired, - errorLabel: PropTypes.string.isRequired, searchLabel: PropTypes.string.isRequired, updatesAvailableLabel: PropTypes.string.isRequired, apps: PropTypes.array, appsWithUpdates: PropTypes.array, - error: PropTypes.object, - loading: PropTypes.bool, } export default AppList diff --git a/src/components/CoreApps/CoreApps.js b/src/components/CoreApps/CoreApps.js index 15ee6e9..f8ca603 100644 --- a/src/components/CoreApps/CoreApps.js +++ b/src/components/CoreApps/CoreApps.js @@ -1,5 +1,6 @@ import { useDataQuery, useConfig } from '@dhis2/app-runtime' import i18n from '@dhis2/d2-i18n' +import { NoticeBox, CenteredContent, CircularLoader } from '@dhis2/ui' import React from 'react' import getLatestVersion from '../../get-latest-version' import AppList from '../AppList' @@ -63,7 +64,28 @@ export const CoreApps = () => { const { baseUrl } = useConfig() const { loading, error, data } = useDataQuery(query) - const overridenCoreApps = data?.coreApps.filter(app => app.bundled) + if (error) { + return ( + + {error.message} + + ) + } + + if (loading) { + return ( + + + + ) + } + + const overridenCoreApps = data.coreApps.filter(app => app.bundled) const apps = coreApps .map(coreApp => { const overridenApp = overridenCoreApps?.find( @@ -72,13 +94,16 @@ export const CoreApps = () => { if (overridenApp) { return overridenApp } - const iconUrl = data?.modules.modules.find( + const module = data.modules.modules.find( m => m.name === `dhis-web-${coreApp.short_name}` - )?.icon + ) + const iconUrl = module?.icon const icons = iconUrl ? { 48: iconUrl } : {} + const name = module?.displayName || coreApp.name return { ...coreApp, baseUrl: `${baseUrl}/dhis-web-${coreApp.short_name}`, + name, icons, } }) @@ -95,13 +120,8 @@ export const CoreApps = () => { return (