@@ -43,6 +43,7 @@ import {
4343 CheckOutlined ,
4444 DownloadOutlined ,
4545 UploadOutlined ,
46+ ControlOutlined
4647} from '@ant-design/icons' ;
4748import FileManageModal from './FileManageModal' ;
4849import ProjectManageModal from './ProjectManageModal' ;
@@ -102,19 +103,42 @@ function getDivider(): MenuItem {
102103 * Generates menu items for a given project.
103104 */
104105function 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+
106127 return [
107128 getItem ( t ( 'PROJECT' ) , 'project' , < FolderOutlined /> , [
108129 getItem ( t ( 'SAVE' ) , 'save' , < SaveOutlined /> ) ,
109130 getItem ( t ( 'DEPLOY' ) , 'deploy' ) ,
110- getDivider ( ) ,
111- getItem ( t ( 'MANAGE' ) + '...' , 'manageProjects' ) ,
112131 ] ) ,
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 /> ) ,
115134 getItem ( t ( 'MECHANISMS' ) + '...' , 'manageMechanisms' , < BlockOutlined /> ) ,
116135 getItem ( t ( 'OPMODES' ) + '...' , 'manageOpmodes' , < CodeOutlined /> ) ,
117136 ] ) ,
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+ ] ) ,
118142 getItem ( t ( 'SETTINGS' ) , 'settings' , < SettingOutlined /> , [
119143 getItem ( t ( 'WPI_TOOLBOX' ) , 'wpi_toolbox' ) ,
120144 getItem ( t ( 'THEME' ) + '...' , 'theme' , < BgColorsOutlined /> ) ,
0 commit comments