Skip to content

Commit 0e48a32

Browse files
Merge pull request #83 from ShlomoPorges/development
Development
2 parents a31ec75 + 2b984c4 commit 0e48a32

File tree

4 files changed

+31
-102
lines changed

4 files changed

+31
-102
lines changed

src/components/BottomPanel.jsx

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,23 @@ const mapDispatchToProps = dispatch => ({
1212
});
1313

1414
const mapStateToProps = store => ({
15-
// successOpen: store.workspace.successOpen,
16-
// errorOpen: store.workspace.errorOpen,
17-
// appDir: store.workspace.appDir,
1815
focusChild: store.workspace.focusChild,
1916
components: store.workspace.components,
2017
});
2118

2219
class BottomPanel extends Component {
23-
// state = {
24-
// successOpen: false,
25-
// errorOpen: false,
26-
// };
2720

28-
viewAppDir = () => {
29-
IPC.send('view_app_dir', this.props.appDir);
30-
};
21+
// viewAppDir = () => {
22+
// IPC.send('view_app_dir', this.props.appDir);
23+
// };
3124

3225
render() {
3326
const {
3427
components,
35-
successOpen,
36-
errorOpen,
37-
handleNotificationClose,
38-
appDir,
3928
focusComponent,
4029
deleteProp,
4130
addProp,
4231
focusChild,
43-
// rightColumnOpen
4432
} = this.props;
4533

4634
return (
@@ -51,15 +39,7 @@ class BottomPanel extends Component {
5139
deleteProp={deleteProp}
5240
addProp={addProp}
5341
focusChild={focusChild}
54-
// rightColumnOpen={rightColumnOpen}
5542
/>
56-
{/* <Snackbars
57-
successOpen={successOpen}
58-
errorOpen={errorOpen}
59-
handleNotificationClose={handleNotificationClose}
60-
msg={appDir}
61-
viewAppDir={this.viewAppDir}
62-
/> */}
6343
</div>
6444
);
6545
}

src/components/CodePreview.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@ import React, { Component, Fragment } from 'react';
22
import { withStyles } from '@material-ui/core/styles';
33
import { format } from 'prettier';
44
import componentRender from '../utils/componentRender.util';
5+
import {ComponentInt,ComponentsInt} from '../utils/interfaces'
6+
import SortChildren from './SortChildren.jsx'
57

6-
class CodePreview extends Component {
8+
type Props = {
9+
focusComponent: ComponentInt;
10+
components: ComponentsInt;
11+
};
12+
13+
class CodePreview extends Component<Props> {
714
render(): JSX.Element {
8-
const { focusComponent, components } = this.props;
9-
return (
15+
//const {focusComponent, components } : {focusComponent:ComponentInt, components:ComponentsInt } = this.props;
16+
const focusComponent : ComponentInt = this.props.focusComponent;
17+
const components : ComponentsInt = this.props.components;
18+
19+
return (
1020
<div
1121
style={{
1222
width: '500px',

src/components/TableGrid.jsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/reducers/componentReducer.ts

Lines changed: 15 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,20 @@ import {
88
CHANGE_FOCUS_COMPONENT,
99
CHANGE_FOCUS_CHILD,
1010
CHANGE_COMPONENT_FOCUS_CHILD,
11-
UPDATE_CHILDREN,
12-
REASSIGN_PARENT,
13-
SET_SELECTABLE_PARENTS,
1411
EXPORT_FILES,
1512
CREATE_APPLICATION,
1613
EXPORT_FILES_SUCCESS,
1714
EXPORT_FILES_ERROR,
1815
CREATE_APPLICATION_ERROR,
1916
HANDLE_CLOSE,
2017
HANDLE_TRANSFORM,
21-
MOVE_TO_BOTTOM,
22-
MOVE_TO_TOP,
2318
OPEN_EXPANSION_PANEL,
2419
DELETE_ALL_DATA,
2520
CHANGE_IMAGE_PATH,
2621
ADD_PROP,
2722
DELETE_PROP,
28-
UPDATE_HTML_ATTR
29-
} from "../actionTypes";
23+
UPDATE_HTML_ATTR,
24+
} from '../actionTypes';
3025

3126
import {
3227
addComponent,
@@ -37,45 +32,24 @@ import {
3732
changeFocusComponent,
3833
changeComponentFocusChild,
3934
changeFocusChild,
40-
updateChildren,
41-
reassignParent,
42-
setSelectableP,
4335
exportFilesSuccess,
4436
exportFilesError,
4537
handleClose,
4638
handleTransform,
47-
moveToBottom,
48-
moveToTop,
4939
openExpansionPanel,
5040
changeImagePath,
5141
addProp,
5242
deleteProp,
53-
updateHtmlAttr
54-
} from "../utils/componentReducer.util.ts";
55-
import cloneDeep from "../utils/cloneDeep.ts";
56-
57-
// import { updateHtmlAttr } from "../actions/components";
58-
59-
interface Child {
60-
childId: number;
61-
componentRef: number; // references the component this child instance belongs to
62-
position: object;
63-
}
64-
65-
interface Component {
66-
componentId: number;
67-
title: string;
68-
childrenArray: Child[];
69-
nextChildId: number;
70-
focusChild: Component;
71-
}
43+
updateHtmlAttr,
44+
} from '../utils/componentReducer.util.ts';
45+
import cloneDeep from '../utils/cloneDeep.ts';
7246

7347
const appComponent = {
7448
id: 1,
7549
stateful: false,
76-
title: "App",
50+
title: 'App',
7751
parentIds: [],
78-
color: "#FF6D00",
52+
color: '#FF6D00',
7953
draggable: true,
8054
childrenIds: [],
8155
selectableParents: [],
@@ -85,12 +59,12 @@ const appComponent = {
8559
x: 25,
8660
y: 25,
8761
width: 600,
88-
height: 400
62+
height: 400,
8963
},
9064

9165
childrenArray: [],
9266
nextChildId: 1,
93-
focusChildId: 0
67+
focusChildId: 0,
9468
};
9569

9670
const initialApplicationFocusChild = {
@@ -100,10 +74,10 @@ const initialApplicationFocusChild = {
10074
x: 25,
10175
y: 25,
10276
width: 600,
103-
height: 400
77+
height: 400,
10478
},
10579
draggable: true,
106-
childType: null
80+
childType: null,
10781
};
10882

10983
const initialApplicationState = {
@@ -117,9 +91,9 @@ const initialApplicationState = {
11791
initialApplicationFocusChild,
11892
focusChild: cloneDeep(initialApplicationFocusChild),
11993
components: [appComponent],
120-
appDir: "",
94+
appDir: '',
12195
loading: false,
122-
componentTree: { name: "App", attributes: {}, children: {} }
96+
componentTree: { name: 'App', attributes: {}, children: {} },
12397
};
12498

12599
const componentReducer = (state = initialApplicationState, action) => {
@@ -129,9 +103,9 @@ const componentReducer = (state = initialApplicationState, action) => {
129103
...state,
130104
...action.payload.data,
131105
loading: false,
132-
appDir: "",
106+
appDir: '',
133107
successOpen: false,
134-
errorOpen: false
108+
errorOpen: false,
135109
};
136110
case ADD_COMPONENT:
137111
return addComponent(state, action.payload);
@@ -149,12 +123,6 @@ const componentReducer = (state = initialApplicationState, action) => {
149123
return changeFocusChild(state, action.payload);
150124
case CHANGE_COMPONENT_FOCUS_CHILD:
151125
return changeComponentFocusChild(state, action.payload);
152-
// case UPDATE_CHILDREN:
153-
// return updateChildren(state, action.payload);
154-
// case REASSIGN_PARENT:
155-
// return reassignParent(state, action.payload);
156-
// case SET_SELECTABLE_PARENTS:
157-
// return setSelectableP(state);
158126
case CREATE_APPLICATION:
159127
case EXPORT_FILES:
160128
return { ...state, loading: true };
@@ -167,11 +135,6 @@ const componentReducer = (state = initialApplicationState, action) => {
167135
return handleClose(state, action.payload);
168136
case HANDLE_TRANSFORM:
169137
return handleTransform(state, action.payload);
170-
171-
// case MOVE_TO_BOTTOM:
172-
// return moveToBottom(state, action.payload);
173-
// case MOVE_TO_TOP:
174-
// return moveToTop(state, action.payload);
175138
case OPEN_EXPANSION_PANEL:
176139
return openExpansionPanel(state, action.payload);
177140
case DELETE_ALL_DATA:

0 commit comments

Comments
 (0)