@@ -9,27 +9,30 @@ import { withStyles } from '@material-ui/core/styles';
9
9
import LeftColExpansionPanel from '../components/LeftColExpansionPanel' ;
10
10
import HTMLComponentPanel from '../components/HTMLComponentPanel' ;
11
11
import * as actions from '../actions/components' ;
12
+ import { ComponentInt , ComponentsInt , ChildInt } from '../utils/interfaces'
12
13
13
- const mapDispatchToProps = dispatch => ( {
14
- addComponent : ( { title } ) => dispatch ( actions . addComponent ( { title } ) ) ,
15
- updateComponent : ( {
16
- id, index, newParentId = null , color = null , stateful = null ,
17
- } ) => dispatch (
18
- actions . updateComponent ( {
19
- id,
20
- index,
21
- newParentId,
22
- color,
23
- stateful,
24
- } ) ,
25
- ) ,
26
- addChild : ( { title, childType, HTMLInfo } ) => dispatch ( actions . addChild ( { title, childType, HTMLInfo } ) ) ,
27
- changeFocusComponent : ( { title } ) => dispatch ( actions . changeFocusComponent ( { title } ) ) ,
28
- changeFocusChild : ( { childId } ) => dispatch ( actions . changeFocusChild ( { childId } ) ) ,
29
- deleteComponent : ( { componentId, stateComponents } ) => dispatch ( actions . deleteComponent ( { componentId, stateComponents } ) ) ,
14
+ type Props = {
15
+ components : ComponentsInt ,
16
+ focusComponent : ComponentInt ,
17
+ selectableChildren : Array < number > ,
18
+ classes :any ,
19
+
20
+ addComponent : any ,
21
+ addChild : any ,
22
+ changeFocusComponent :any ,
23
+ changeFocusChild : any ,
24
+ deleteComponent : any ,
25
+ } ;
26
+
27
+ const mapDispatchToProps = ( dispatch :any ) => ( {
28
+ addComponent : ( { title } :{ title :string } ) => dispatch ( actions . addComponent ( { title } ) ) ,
29
+ addChild : ( { title, childType, HTMLInfo } :{ title :string , childType :string , HTMLInfo :object } ) => dispatch ( actions . addChild ( { title, childType, HTMLInfo } ) ) ,
30
+ changeFocusComponent : ( { title } :{ title :string } ) => dispatch ( actions . changeFocusComponent ( { title } ) ) ,
31
+ changeFocusChild : ( { childId } :{ childId :number } ) => dispatch ( actions . changeFocusChild ( { childId } ) ) ,
32
+ deleteComponent : ( { componentId, stateComponents } :{ componentId :number , stateComponents :ComponentsInt } ) => dispatch ( actions . deleteComponent ( { componentId, stateComponents } ) ) ,
30
33
} ) ;
31
34
32
- class LeftContainer extends Component {
35
+ class LeftContainer extends Component < Props > {
33
36
state = {
34
37
componentName : '' ,
35
38
} ;
@@ -47,7 +50,7 @@ class LeftContainer extends Component {
47
50
} ) ;
48
51
} ;
49
52
50
- render ( ) {
53
+ render ( ) : JSX . Element {
51
54
const {
52
55
components,
53
56
deleteComponent,
@@ -61,7 +64,7 @@ class LeftContainer extends Component {
61
64
const { componentName } = this . state ;
62
65
63
66
const componentsExpansionPanel = components
64
- . sort ( ( b , a ) => parseInt ( b . id ) - parseInt ( a . id ) ) // sort by id value of comp
67
+ . sort ( ( b : ComponentInt , a : ComponentInt ) => b . id - a . id ) // sort by id value of comp
65
68
. map ( ( component , i ) => (
66
69
< LeftColExpansionPanel
67
70
key = { component . id }
@@ -134,10 +137,6 @@ class LeftContainer extends Component {
134
137
135
138
function styles ( ) {
136
139
return {
137
- // htmlCompWrapper: {
138
- // bottom: 0,
139
- // height: "200px"
140
- // },
141
140
cssLabel : {
142
141
color : 'white' ,
143
142
0 commit comments