@@ -23,6 +23,7 @@ import * as React from 'react';
2323import { RcFile , UploadRequestOption } from 'rc-upload/lib/interface' ;
2424import * as commonStorage from '../storage/common_storage' ;
2525import * as storageNames from '../storage/names' ;
26+ import * as storageProject from '../storage/project' ;
2627import * as createPythonFiles from '../storage/create_python_files' ;
2728import * as I18Next from 'react-i18next' ;
2829import { TabType } from '../types/TabType' ;
@@ -56,9 +57,9 @@ export interface MenuProps {
5657 setAlertErrorMessage : ( message : string ) => void ;
5758 storage : commonStorage . Storage | null ;
5859 gotoTab : ( tabKey : string ) => void ;
59- project : commonStorage . Project | null ;
60+ project : storageProject . Project | null ;
6061 openWPIToolboxSettings : ( ) => void ;
61- setProject : ( project : commonStorage . Project | null ) => void ;
62+ setProject : ( project : storageProject . Project | null ) => void ;
6263 theme : string ;
6364 setTheme : ( theme : string ) => void ;
6465}
@@ -100,7 +101,7 @@ function getDivider(): MenuItem {
100101/**
101102 * Generates menu items for a given project.
102103 */
103- function getMenuItems ( t : ( key : string ) => string , project : commonStorage . Project , currentLanguage : string ) : MenuItem [ ] {
104+ function getMenuItems ( t : ( key : string ) => string , project : storageProject . Project , currentLanguage : string ) : MenuItem [ ] {
104105 const mechanisms : MenuItem [ ] = [ ] ;
105106 const opmodes : MenuItem [ ] = [ ] ;
106107
@@ -176,7 +177,7 @@ function getMenuItems(t: (key: string) => string, project: commonStorage.Project
176177export function Component ( props : MenuProps ) : React . JSX . Element {
177178 const { t, i18n} = I18Next . useTranslation ( ) ;
178179
179- const [ projects , setProjects ] = React . useState < commonStorage . Project [ ] > ( [ ] ) ;
180+ const [ projects , setProjects ] = React . useState < storageProject . Project [ ] > ( [ ] ) ;
180181 const [ menuItems , setMenuItems ] = React . useState < MenuItem [ ] > ( [ ] ) ;
181182 const [ fileModalOpen , setFileModalOpen ] = React . useState < boolean > ( false ) ;
182183 const [ projectModalOpen , setProjectModalOpen ] = React . useState < boolean > ( false ) ;
@@ -191,7 +192,7 @@ export function Component(props: MenuProps): React.JSX.Element {
191192 } ;
192193
193194 /** Fetches the list of projects from storage. */
194- const fetchListOfProjects = async ( ) : Promise < commonStorage . Project [ ] > => {
195+ const fetchListOfProjects = async ( ) : Promise < storageProject . Project [ ] > => {
195196 return new Promise ( async ( resolve , reject ) => {
196197 if ( ! props . storage ) {
197198 reject ( new Error ( 'Storage not available' ) ) ;
@@ -252,7 +253,7 @@ export function Component(props: MenuProps): React.JSX.Element {
252253 /** Handles menu item clicks. */
253254 const handleClick : Antd . MenuProps [ 'onClick' ] = ( { key} ) : void => {
254255 const newModule = props . project ?
255- commonStorage . findModuleByModulePath ( props . project , key ) :
256+ storageProject . findModuleByModulePath ( props . project , key ) :
256257 null ;
257258
258259 if ( newModule ) {
@@ -386,7 +387,7 @@ export function Component(props: MenuProps): React.JSX.Element {
386387 existingProjectNames . push ( project . projectName ) ;
387388 } ) ;
388389 const file = options . file as RcFile ;
389- const uploadProjectName = commonStorage . makeUploadProjectName ( file . name , existingProjectNames ) ;
390+ const uploadProjectName = storageProject . makeUploadProjectName ( file . name , existingProjectNames ) ;
390391 if ( props . storage ) {
391392 props . storage . uploadProject ( uploadProjectName , dataUrl ) ;
392393 }
0 commit comments