1
1
import {
2
2
LOAD_INIT_DATA ,
3
3
ADD_COMPONENT ,
4
+ ADD_CHILD ,
4
5
UPDATE_COMPONENT ,
5
6
DELETE_COMPONENT ,
6
7
UPDATE_CHILDREN ,
@@ -62,6 +63,11 @@ export const addComponent = ({ title }) => (dispatch) => {
62
63
dispatch ( { type : SET_SELECTABLE_PARENTS } ) ;
63
64
} ;
64
65
66
+ export const addChild = ( { title } ) => ( dispatch ) => {
67
+ dispatch ( { type : ADD_CHILD , payload : { title } } ) ;
68
+ // dispatch({ type: SET_SELECTABLE_PARENTS });
69
+ } ;
70
+
65
71
export const deleteComponent = ( { index, id, parentIds = [ ] } ) => ( dispatch ) => {
66
72
if ( parentIds . length ) {
67
73
// Delete Component from its parent if it has a parent.
@@ -91,21 +97,21 @@ export const updateComponent = ({
91
97
dispatch ( { type : SET_SELECTABLE_PARENTS } ) ;
92
98
} ;
93
99
94
- export const exportFiles = ( { components, path } ) => ( dispatch ) => {
95
- dispatch ( {
96
- type : EXPORT_FILES ,
97
- } ) ;
98
-
99
- createFiles ( components , path )
100
- . then ( dir => dispatch ( {
101
- type : EXPORT_FILES_SUCCESS ,
102
- payload : { status : true , dir : dir [ 0 ] } ,
103
- } ) )
104
- . catch ( err => dispatch ( {
105
- type : EXPORT_FILES_ERROR ,
106
- payload : { status : true , err } ,
107
- } ) ) ;
108
- } ;
100
+ // export const exportFiles = ({ components, path }) => (dispatch) => {
101
+ // dispatch({
102
+ // type: EXPORT_FILES,
103
+ // });
104
+
105
+ // createFiles(components, path)
106
+ // .then(dir => dispatch({
107
+ // type: EXPORT_FILES_SUCCESS,
108
+ // payload: { status: true, dir: dir[0] },
109
+ // }))
110
+ // .catch(err => dispatch({
111
+ // type: EXPORT_FILES_ERROR,
112
+ // payload: { status: true, err },
113
+ // }));
114
+ // };
109
115
110
116
export const handleClose = ( ) => ( {
111
117
type : HANDLE_CLOSE ,
@@ -121,71 +127,66 @@ export const handleTransform = (id, {
121
127
} ,
122
128
} ) ;
123
129
124
- // Application generation options
125
- // cosnt genOptions = [
126
- // 'Export into existing project.', 'Export with starter repo.', 'Export with create-react-app.'
127
- // ];
128
-
129
- export const createApplication = ( {
130
- path, components = [ ] , genOption, appName = 'proto_app' , repoUrl,
131
- } ) => ( dispatch ) => {
132
- if ( genOption === 0 ) {
133
- dispatch ( exportFiles ( { path, components } ) ) ;
134
- } else if ( genOption ) {
135
- dispatch ( {
136
- type : CREATE_APPLICATION ,
137
- } ) ;
138
- createApplicationUtil ( {
139
- path, appName, genOption, repoUrl,
140
- } )
141
- . then ( ( ) => {
142
- dispatch ( {
143
- type : CREATE_APPLICATION_SUCCESS ,
144
- } ) ;
145
- dispatch ( exportFiles ( { path : `${ path } /${ appName } ` , components } ) ) ;
146
- } )
147
- . catch ( err => dispatch ( {
148
- type : CREATE_APPLICATION_ERROR ,
149
- payload : { status : true , err } ,
150
- } ) ) ;
151
- }
152
- } ;
130
+ // export const createApplication = ({
131
+ // path, components = [], genOption, appName = 'proto_app', repoUrl,
132
+ // }) => (dispatch) => {
133
+ // if (genOption === 0) {
134
+ // dispatch(exportFiles({ path, components }));
135
+ // } else if (genOption) {
136
+ // dispatch({
137
+ // type: CREATE_APPLICATION,
138
+ // });
139
+ // createApplicationUtil({
140
+ // path, appName, genOption, repoUrl,
141
+ // })
142
+ // .then(() => {
143
+ // dispatch({
144
+ // type: CREATE_APPLICATION_SUCCESS,
145
+ // });
146
+ // dispatch(exportFiles({ path: `${path}/${appName}`, components }));
147
+ // })
148
+ // .catch(err => dispatch({
149
+ // type: CREATE_APPLICATION_ERROR,
150
+ // payload: { status: true, err },
151
+ // }));
152
+ // }
153
+ // };
153
154
154
155
export const toggleDragging = status => ( {
155
156
type : TOGGLE_DRAGGING ,
156
157
payload : status ,
157
158
} ) ;
158
159
159
- export const moveToBottom = componentId => ( {
160
- type : MOVE_TO_BOTTOM ,
161
- payload : componentId ,
162
- } ) ;
163
-
164
- export const moveToTop = componentId => ( {
165
- type : MOVE_TO_TOP ,
166
- payload : componentId ,
167
- } ) ;
168
-
169
- export const openExpansionPanel = component => ( {
170
- type : OPEN_EXPANSION_PANEL ,
171
- payload : { component } ,
172
- } ) ;
173
-
174
- export const deleteAllData = ( ) => ( {
175
- type : DELETE_ALL_DATA ,
176
- } ) ;
177
-
178
- export const changeImagePath = path => ( {
179
- type : CHANGE_IMAGE_PATH ,
180
- payload : path ,
181
- } ) ;
182
-
183
- export const deleteCompProp = ( { id, index } ) => ( {
184
- type : DELETE_PROP ,
185
- payload : { id, index } ,
186
- } ) ;
187
-
188
- export const addCompProp = prop => ( {
189
- type : ADD_PROP ,
190
- payload : { ...prop } ,
191
- } ) ;
160
+ // export const moveToBottom = componentId => ({
161
+ // type: MOVE_TO_BOTTOM,
162
+ // payload: componentId,
163
+ // });
164
+
165
+ // export const moveToTop = componentId => ({
166
+ // type: MOVE_TO_TOP,
167
+ // payload: componentId,
168
+ // });
169
+
170
+ // export const openExpansionPanel = component => ({
171
+ // type: OPEN_EXPANSION_PANEL,
172
+ // payload: { component },
173
+ // });
174
+
175
+ // export const deleteAllData = () => ({
176
+ // type: DELETE_ALL_DATA,
177
+ // });
178
+
179
+ // export const changeImagePath = path => ({
180
+ // type: CHANGE_IMAGE_PATH,
181
+ // payload: path,
182
+ // });
183
+
184
+ // export const deleteCompProp = ({ id, index }) => ({
185
+ // type: DELETE_PROP,
186
+ // payload: { id, index },
187
+ // });
188
+
189
+ // export const addCompProp = prop => ({
190
+ // type: ADD_PROP,
191
+ // payload: { ...prop },
192
+ // });
0 commit comments