11import { HIDDEN_DIRECTORIES } from '@codesandbox/common/lib/templates/constants/files' ;
2- import { inject , observer } from 'app/componentConnectors' ;
2+ import { Module , Directory } from '@codesandbox/common/lib/types' ;
3+ import { useOvermind } from 'app/overmind' ;
34import { sortBy } from 'lodash-es' ;
45import * as React from 'react' ;
5-
6- import ModuleEntry from './ModuleEntry' ;
76import DirectoryEntry from '..' ;
7+ import ModuleEntry from './ModuleEntry' ;
88
9- const DirectoryChildren = ( {
9+ interface IDirectoryChildrenProps {
10+ depth : number ;
11+ renameModule : ( title : string , moduleShortid : string ) => void ;
12+ setCurrentModule : ( id : string ) => void ;
13+ parentShortid : string ;
14+ deleteEntry : ( shortid : string , title : string ) => void ;
15+ isInProjectView : boolean ;
16+ markTabsNotDirty : ( ) => void ;
17+ discardModuleChanges : ( shortid : string ) => void ;
18+ getModulePath : (
19+ modules : Module [ ] ,
20+ directories : Directory [ ] ,
21+ id : string
22+ ) => string ;
23+ renameValidator : ( id : string , title : string ) => boolean ;
24+ }
25+
26+ const DirectoryChildren : React . FC < IDirectoryChildrenProps > = ( {
1027 depth = 0 ,
1128 renameModule,
1229 setCurrentModule,
1330 parentShortid,
1431 deleteEntry,
1532 isInProjectView,
1633 markTabsNotDirty,
17- store,
1834 discardModuleChanges,
1935 getModulePath,
20- signals,
2136 renameValidator,
2237} ) => {
38+ const {
39+ state : {
40+ editor : { currentSandbox, mainModule, currentModuleShortid } ,
41+ } ,
42+ actions : { files, editor } ,
43+ } = useOvermind ( ) ;
44+
2345 const {
2446 id : sandboxId ,
2547 modules,
2648 directories,
2749 template : sandboxTemplate ,
28- } = store . editor . currentSandbox ;
29- const { mainModule, currentModuleShortid } = store . editor ;
30- const mainModuleId = mainModule . id ;
50+ } = currentSandbox ;
3151
3252 return (
3353 < div >
@@ -44,15 +64,13 @@ const DirectoryChildren = ({
4464 key = { dir . id }
4565 siblings = { [ ...directories , ...modules ] }
4666 depth = { depth + 1 }
47- signals = {
48- signals /* TODO: Just pass what is needed by the DragDrop */
49- }
67+ signals = { { files, editor } }
5068 id = { dir . id }
5169 shortid = { dir . shortid }
5270 title = { dir . title }
5371 sandboxId = { sandboxId }
5472 sandboxTemplate = { sandboxTemplate }
55- mainModuleId = { mainModuleId }
73+ mainModuleId = { mainModule . id }
5674 modules = { modules }
5775 directories = { directories }
5876 currentModuleShortid = { currentModuleShortid }
@@ -82,4 +100,4 @@ const DirectoryChildren = ({
82100 ) ;
83101} ;
84102
85- export default inject ( 'store' , 'signals' ) ( observer ( DirectoryChildren ) ) ;
103+ export default DirectoryChildren ;
0 commit comments