Skip to content

Commit

Permalink
chore: update cli-app-scripts to 5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mediremi committed Feb 22, 2021
1 parent 1d7976d commit ac42639
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 365 deletions.
16 changes: 14 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ 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-02-18T17:30:03.432Z\n"
"PO-Revision-Date: 2021-02-18T17:30:03.432Z\n"
"POT-Creation-Date: 2021-02-22T14:32:42.096Z\n"
"PO-Revision-Date: 2021-02-22T14:32:42.096Z\n"

msgid "No apps found"
msgstr ""

msgid "Something went wrong whilst loading your core apps"
msgstr ""

msgid "Core apps with updates available"
msgstr ""

msgid "All core apps"
msgstr ""

msgid "Search core apps"
msgstr ""

msgid "Channel"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"homepage": "https://github.com/dhis2/app-management-app#readme",
"devDependencies": {
"@dhis2/cli-app-scripts": "^5.5.0",
"@dhis2/cli-app-scripts": "^5.6.0",
"@dhis2/cli-style": "^7.3.0",
"babel-plugin-minify-replace": "^0.5.0"
},
Expand Down
2 changes: 2 additions & 0 deletions src/components/AppList/AppIcon.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.appIcon {
display: flex;
height: 72px;
width: 72px;
}

.appIconFallback {
Expand Down
16 changes: 7 additions & 9 deletions src/components/AppList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const AppList = ({
error,
loading,
apps,
appsWithUpdates,
errorLabel,
updatesAvailableLabel,
allAppsLabel,
Expand Down Expand Up @@ -121,15 +122,11 @@ const AppList = ({
)
}

const filteredApps = apps.filter(
app =>
!query ||
app.name.toLocaleLowerCase().includes(query.toLocaleLowerCase())
)
// XXX
const filteredAppsWithUpdates = filteredApps.filter(
app => app.name.length % 2 == 0
)
const searchFilter = app =>
!query ||
app.name.toLocaleLowerCase().includes(query.toLocaleLowerCase())
const filteredApps = apps.filter(searchFilter)
const filteredAppsWithUpdates = (appsWithUpdates || []).filter(searchFilter)

return (
<>
Expand All @@ -154,6 +151,7 @@ AppList.propTypes = {
searchLabel: PropTypes.string.isRequired,
updatesAvailableLabel: PropTypes.string.isRequired,
apps: PropTypes.array,
appsWithUpdates: PropTypes.array,
error: PropTypes.object,
loading: PropTypes.bool,
}
Expand Down
84 changes: 83 additions & 1 deletion src/components/CoreApps/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,87 @@
import { useDataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import AppList from '../AppList'

const CoreApps = () => <p>Core apps</p>
const coreAppNames = [
'App Management',
'Cache Cleaner',
'Capture',
'Dashboard',
'Data Visualizer',
'Datastore Management',
'Import/Export',
'Interpretations',
'Maintenance',
'Menu Management',
'Messaging',
'Reports',
'SMS Configuration',
'Scheduler',
'Settings',
'Translations',
'User Management',
]

const query = {
coreApps: {
resource: 'apps',
params: {
bundled: true,
},
},
appHub: {
resource: 'appHub/v1/apps',
},
}

const CoreApps = () => {
const { loading, error, data } = useDataQuery(query)

const overridenCoreApps = data?.coreApps.filter(app => app.bundled)
const apps = coreAppNames
.map(coreAppName => {
const overridenApp = overridenCoreApps?.find(
a => a.name === coreAppName
)
if (overridenApp) {
return overridenApp
}
return {
name: coreAppName,
short_name: coreAppName,
developer: {
company: 'DHIS2',
},
icons: {},
}
})
.map(app => {
const appHubId = data?.appHub.find(
({ name, developer }) =>
name === app.name && developer.organisation === 'DHIS2'
)?.id
return {
...app,
appHubId,
}
})
const appsWithUpdates = apps.filter(app => !app.version && app.appHubId)

return (
<AppList
error={error}
loading={loading}
apps={apps}
appsWithUpdates={appsWithUpdates}
errorLabel={i18n.t(
'Something went wrong whilst loading your core apps'
)}
updatesAvailableLabel={i18n.t('Core apps with updates available')}
allAppsLabel={i18n.t('All core apps')}
searchLabel={i18n.t('Search core apps')}
/>
)
}

export default CoreApps
Loading

0 comments on commit ac42639

Please sign in to comment.