forked from axelor/axelor-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create menu entries with user favorite folders (axelor#817)
* RM#86495
- Loading branch information
1 parent
5393f83
commit 060b464
Showing
11 changed files
with
177 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/apps/dms/src/screens/MyFavoriteDocumentsScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import React from 'react'; | ||
import {Screen, Text} from '@axelor/aos-mobile-ui'; | ||
|
||
const MyFavoriteDocumentsScreen = ({}) => { | ||
return ( | ||
<Screen removeSpaceOnTop={true}> | ||
<Text>MyFavoriteDocumentsScreen</Text> | ||
</Screen> | ||
); | ||
}; | ||
|
||
export default MyFavoriteDocumentsScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
export * from './moduleHelper'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Axelor Business Solutions | ||
* | ||
* Copyright (C) 2024 Axelor (<http://axelor.com>). | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import {Menu, Screen} from '@axelor/aos-mobile-core'; | ||
import {AllDocumentsScreen} from '../screens'; | ||
|
||
const createAllDocumentsScreenComponent = (defaultParent: any) => { | ||
return props => AllDocumentsScreen({...props, defaultParent}); | ||
}; | ||
|
||
type DMSFile = { | ||
id: number; | ||
fileName: string; | ||
}; | ||
|
||
type Menus = { | ||
[menuKey: string]: Menu; | ||
}; | ||
|
||
type Screens = { | ||
[screenKey: string]: Screen; | ||
}; | ||
|
||
export const createMenusScreen = ({ | ||
favouriteFolderSet, | ||
favouriteFileSet, | ||
}: { | ||
favouriteFolderSet: DMSFile[]; | ||
favouriteFileSet: DMSFile[]; | ||
}): {menus: Menus; screens: Screens} => { | ||
let menus: Menus = {}; | ||
let screens: Screens = {}; | ||
|
||
if (Array.isArray(favouriteFileSet) && favouriteFileSet.length > 0) { | ||
menus = { | ||
dms_menu_favoriteDocuments: { | ||
title: 'Dms_MyFavoriteDocuments', | ||
icon: 'folder-check', | ||
parent: 'app-dms', | ||
screen: 'FavoriteDocuments', | ||
}, | ||
}; | ||
} | ||
|
||
if (Array.isArray(favouriteFolderSet) && favouriteFolderSet.length > 0) { | ||
favouriteFolderSet.forEach(folder => { | ||
const screenKey = `DocumentsScreen_${folder.id}`; | ||
screens[screenKey] = { | ||
title: 'Dms_AllDocuments', | ||
component: createAllDocumentsScreenComponent(folder), | ||
options: { | ||
shadedHeader: false, | ||
}, | ||
}; | ||
|
||
const menuKey = `dms_menu_documents${folder.id}`; | ||
menus[menuKey] = { | ||
title: folder.fileName, | ||
icon: 'folder', | ||
parent: 'app-dms', | ||
screen: screenKey, | ||
}; | ||
}); | ||
} | ||
|
||
return {menus, screens}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters