File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import AppItemPlaceholder from 'components/AppsMenu/components/AppItemPlaceholde
1313import useI18n from 'components/useI18n'
1414import { getApps , getHomeApp , isFetchingApps } from 'lib/reducers'
1515import styles from 'styles/apps-menu.styl'
16- import { buildEntrypoints } from 'components/AppsMenu/helper'
16+ import { getEntrypoints } from 'components/AppsMenu/helper'
1717
1818const AppsMenuContent = ( {
1919 isFetchingApps,
@@ -50,7 +50,7 @@ const AppsMenuContent = ({
5050 ? sortApplicationsList ( displayedApps , flag ( 'apps.sort' ) )
5151 : displayedApps
5252
53- const entrypoints = buildEntrypoints ( apps )
53+ const entrypoints = getEntrypoints ( apps )
5454
5555 return (
5656 < div className = { styles [ 'apps-menu-grid' ] } >
Original file line number Diff line number Diff line change 1- export const buildEntrypoints = apps => {
2- return apps . flatMap ( app => {
3- if ( ! app . entrypoints ) return [ ]
4-
5- return app . entrypoints . map ( entrypoint => ( {
6- ...entrypoint ,
7- slug : app . slug
8- } ) )
9- } )
1+ import { models } from 'cozy-client'
2+
3+ const {
4+ applications : { selectEntrypoints, filterEntrypoints }
5+ } = models
6+
7+ // We get only the entrypoints we want:
8+ // - Drive onlyoffice
9+ export const getEntrypoints = apps => {
10+ const driveApp = apps . find ( app => app . slug === 'drive' ) || { }
11+
12+ const driveEntrypoints = driveApp . entrypoints || [ ]
13+
14+ const selectedEntrypoints = selectEntrypoints ( driveEntrypoints , [
15+ 'new-file-type-text' ,
16+ 'new-file-type-sheet' ,
17+ 'new-file-type-slide'
18+ ] )
19+ const filteredEntrypoints = filterEntrypoints ( selectedEntrypoints )
20+
21+ return filteredEntrypoints . map ( entrypoint => ( {
22+ ...entrypoint ,
23+ slug : driveApp . slug
24+ } ) )
1025}
You can’t perform that action at this time.
0 commit comments