@@ -27,8 +27,6 @@ import * as NewProjectNameModal from './NewProjectNameModal';
2727import * as NewModuleNameModal from './NewModuleNameModal' ;
2828import * as editor from '../editor/editor' ;
2929import type { MessageInstance } from 'antd/es/message/interface' ;
30- import { BlocklyComponentType } from './BlocklyComponent' ;
31-
3230
3331import {
3432 AppstoreOutlined as MechanismOutlined ,
@@ -38,14 +36,12 @@ import {
3836
3937interface ModuleOutlineProps {
4038 setAlertErrorMessage : ( message : string ) => void ;
41- setGeneratedCode : ( newCode : string ) => void ;
4239 initializeShownPythonToolboxCategories : ( ) => void ;
4340 storage : commonStorage . Storage | null ;
4441 messageApi : MessageInstance ;
45- blocklyComponent : BlocklyComponentType | null ;
4642 blocksEditor : editor . Editor | null ;
4743 currentModule : commonStorage . Module | null ;
48- setCurrentModule : ( module : commonStorage . Module | null ) => void ;
44+ setCurrentModule : ( module : commonStorage . Module | null ) => void ;
4945}
5046
5147export default function ModuleOutline ( props : ModuleOutlineProps ) {
@@ -112,36 +108,8 @@ export default function ModuleOutline(props: ModuleOutlineProps) {
112108 }
113109 } , [ treeSelectedKey ] ) ;
114110
115-
116- const initializeModules = async ( ) => {
117- const array = await fetchListOfModules ( ) ;
118- if ( array . length === 0 ) {
119- setNewProjectNameModalPurpose ( PURPOSE_NEW_PROJECT ) ;
120- setNewProjectNameModalInitialValue ( '' ) ;
121- setNewProjectNameModalTitle ( NewProjectNameModal . TITLE_WELCOME ) ;
122- setNewProjectNameModalMessage ( NewProjectNameModal . MESSAGE_WELCOME ) ;
123- setNewProjectNameModalIsOpen ( true ) ;
124- }
125- } ;
126-
127- const fetchMostRecentModulePath = async ( ) => {
128- if ( ! props . storage ) {
129- return ;
130- }
131- try {
132- const value = await props . storage . fetchEntry ( 'mostRecentModulePath' , '' ) ;
133- setMostRecentModulePath ( value ) ;
134- } catch ( e ) {
135- console . log ( 'Failed to fetch mostRecentModulePath. Caught the following error...' ) ;
136- console . log ( e ) ;
137- }
138- } ;
139-
140-
141-
142111 // When the list of modules is set, update the treeData and treeExpandedKeys.
143112 React . useEffect ( ( ) => {
144-
145113 if ( modules . length === 0 && treeData . length === 0 ) {
146114 return ;
147115 }
@@ -253,6 +221,8 @@ export default function ModuleOutline(props: ModuleOutlineProps) {
253221 }
254222 }
255223 } , [ currentModulePath ] ) ;
224+
225+
256226 // Provide a callback so the NewModuleNameModal will know what the current
257227 // project name is.
258228 const getCurrentProjectName = ( ) : string => {
@@ -706,6 +676,30 @@ export default function ModuleOutline(props: ModuleOutlineProps) {
706676 } ) ;
707677 } ;
708678
679+ const initializeModules = async ( ) => {
680+ const array = await fetchListOfModules ( ) ;
681+ if ( array . length === 0 ) {
682+ setNewProjectNameModalPurpose ( PURPOSE_NEW_PROJECT ) ;
683+ setNewProjectNameModalInitialValue ( '' ) ;
684+ setNewProjectNameModalTitle ( NewProjectNameModal . TITLE_WELCOME ) ;
685+ setNewProjectNameModalMessage ( NewProjectNameModal . MESSAGE_WELCOME ) ;
686+ setNewProjectNameModalIsOpen ( true ) ;
687+ }
688+ } ;
689+
690+ const fetchMostRecentModulePath = async ( ) => {
691+ if ( ! props . storage ) {
692+ return ;
693+ }
694+ try {
695+ const value = await props . storage . fetchEntry ( 'mostRecentModulePath' , '' ) ;
696+ setMostRecentModulePath ( value ) ;
697+ } catch ( e ) {
698+ console . log ( 'Failed to fetch mostRecentModulePath. Caught the following error...' ) ;
699+ console . log ( e ) ;
700+ }
701+ } ;
702+
709703 return (
710704 < Antd . Flex vertical gap = "small"
711705 style = { {
0 commit comments