Skip to content

Commit

Permalink
feat: Hide apps by flag
Browse files Browse the repository at this point in the history
The new flag `apps.hidden` replaces `home_hidden_flag` and will be also
used in cozy-store and cozy-bar
  • Loading branch information
paultranvan committed Nov 19, 2024
1 parent 4419c2e commit ac64e0f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/Applications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,27 @@ LoadingAppTiles.displayName = LoadingAppTiles

const isValidData = memoize(data => Array.isArray(data) && data.length > 0)

const getApplicationsList = memoize(data => {
const getApplicationsList = data => {
if (isValidData(data)) {
const hiddenApps = flag('apps.hidden') || []
const apps = data.filter(
app =>
app.state !== 'hidden' &&
!homeConfig.filteredApps.includes(app.slug) &&
!flag(`home_hidden_apps.${app.slug.toLowerCase()}`) // can be set in the context with `home_hidden_apps: - drive - banks`for example
!hiddenApps.includes(app.slug.toLowerCase())
)
const dedupapps = uniqBy(apps, 'slug')
const array = dedupapps
.filter(app => app.name !== 'cozy-data-proxy') // This filter should be temporary (see commit message for more details)
.map(app => <AppTile key={app.id} app={app} />)
const appList = dedupapps.map(app => <AppTile key={app.id} app={app} />)

array.push(
appList.push(
<AppHighlightAlertWrapper key="AppHighlightAlertWrapper" apps={apps} />
)

return array
return appList
} else {
return <LoadingAppTiles num={3} />
}
})
}

export const Applications = ({ onAppsFetched }) => {
const showLogout = !!flag('home.mainlist.show-logout')
Expand Down

0 comments on commit ac64e0f

Please sign in to comment.