From ac64e0f00ad5a2eb7a00dedb97928b7749e08051 Mon Sep 17 00:00:00 2001 From: Paul Tran-Van Date: Mon, 18 Nov 2024 15:09:02 +0100 Subject: [PATCH] feat: Hide apps by flag The new flag `apps.hidden` replaces `home_hidden_flag` and will be also used in cozy-store and cozy-bar --- src/components/Applications.jsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/Applications.jsx b/src/components/Applications.jsx index 3dffefac74..797d9ae83a 100644 --- a/src/components/Applications.jsx +++ b/src/components/Applications.jsx @@ -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 => ) + const appList = dedupapps.map(app => ) - array.push( + appList.push( ) - return array + return appList } else { return } -}) +} export const Applications = ({ onAppsFetched }) => { const showLogout = !!flag('home.mainlist.show-logout')