@@ -43,6 +43,7 @@ import {
43
43
CheckOutlined ,
44
44
DownloadOutlined ,
45
45
UploadOutlined ,
46
+ ControlOutlined
46
47
} from '@ant-design/icons' ;
47
48
import FileManageModal from './FileManageModal' ;
48
49
import ProjectManageModal from './ProjectManageModal' ;
@@ -102,19 +103,42 @@ function getDivider(): MenuItem {
102
103
* Generates menu items for a given project.
103
104
*/
104
105
function getMenuItems ( t : ( key : string ) => string , project : storageProject . Project , currentLanguage : string ) : MenuItem [ ] {
105
-
106
+ const mechanisms : MenuItem [ ] = [ ] ;
107
+ const opmodes : MenuItem [ ] = [ ] ;
108
+
109
+ // Build mechanisms menu items
110
+ project . mechanisms . forEach ( ( mechanism ) => {
111
+ mechanisms . push ( getItem (
112
+ mechanism . className ,
113
+ mechanism . modulePath ,
114
+ < BlockOutlined />
115
+ ) ) ;
116
+ } ) ;
117
+
118
+ // Build opmodes menu items
119
+ project . opModes . forEach ( ( opmode ) => {
120
+ opmodes . push ( getItem (
121
+ opmode . className ,
122
+ opmode . modulePath ,
123
+ < CodeOutlined />
124
+ ) ) ;
125
+ } ) ;
126
+
106
127
return [
107
128
getItem ( t ( 'PROJECT' ) , 'project' , < FolderOutlined /> , [
108
129
getItem ( t ( 'SAVE' ) , 'save' , < SaveOutlined /> ) ,
109
130
getItem ( t ( 'DEPLOY' ) , 'deploy' ) ,
110
- getDivider ( ) ,
111
- getItem ( t ( 'MANAGE' ) + '...' , 'manageProjects' ) ,
112
131
] ) ,
113
- getItem ( t ( 'EXPLORER ' ) , 'explorer ' , < FileOutlined /> , [
114
- getItem ( t ( 'ROBOT' ) , project . robot . modulePath , < RobotOutlined /> ) ,
132
+ getItem ( t ( 'MANAGE ' ) , 'manage ' , < ControlOutlined /> , [
133
+ getItem ( t ( 'PROJECTS' ) + '...' , 'manageProjects' , < FolderOutlined /> ) ,
115
134
getItem ( t ( 'MECHANISMS' ) + '...' , 'manageMechanisms' , < BlockOutlined /> ) ,
116
135
getItem ( t ( 'OPMODES' ) + '...' , 'manageOpmodes' , < CodeOutlined /> ) ,
117
136
] ) ,
137
+ getItem ( t ( 'EXPLORER' ) , 'explorer' , < FileOutlined /> , [
138
+ getItem ( t ( 'ROBOT' ) , project . robot . modulePath , < RobotOutlined /> ) ,
139
+ getItem ( t ( 'MECHANISMS' ) , 'mechanisms' , < BlockOutlined /> , mechanisms ) ,
140
+ getItem ( t ( 'OPMODES' ) , 'opmodes' , < CodeOutlined /> , opmodes ) ,
141
+ ] ) ,
118
142
getItem ( t ( 'SETTINGS' ) , 'settings' , < SettingOutlined /> , [
119
143
getItem ( t ( 'WPI_TOOLBOX' ) , 'wpi_toolbox' ) ,
120
144
getItem ( t ( 'THEME' ) + '...' , 'theme' , < BgColorsOutlined /> ) ,
0 commit comments