@@ -27,22 +27,22 @@ import {
27
27
DELETE_ALL_DATA ,
28
28
CHANGE_IMAGE_PATH ,
29
29
UPDATE_HTML_ATTR ,
30
- UPDATE_CHILDREN_SORT ,
31
- } from ' ../actionTypes/index' ;
30
+ UPDATE_CHILDREN_SORT
31
+ } from " ../actionTypes/index" ;
32
32
33
- import { loadState } from ' ../localStorage' ;
33
+ import { loadState } from " ../localStorage" ;
34
34
35
- import createFiles from ' ../utils/createFiles.util' ;
36
- import createApplicationUtil from ' ../utils/createApplication.util' ;
35
+ import createFiles from " ../utils/createFiles.util.ts" ;
36
+ import createApplicationUtil from " ../utils/createApplication.util.ts" ;
37
37
38
38
export const loadInitData = ( ) => dispatch => {
39
39
loadState ( ) . then ( data =>
40
40
dispatch ( {
41
41
type : LOAD_INIT_DATA ,
42
42
payload : {
43
- data : data ? data . workspace : { } ,
44
- } ,
45
- } ) ,
43
+ data : data ? data . workspace : { }
44
+ }
45
+ } )
46
46
) ;
47
47
} ;
48
48
@@ -77,22 +77,28 @@ export const deleteChild = ({}) => dispatch => {
77
77
dispatch ( { type : DELETE_CHILD , payload : { } } ) ;
78
78
} ;
79
79
80
- export const deleteComponent = ( { componentId, stateComponents } ) => dispatch => {
80
+ export const deleteComponent = ( {
81
+ componentId,
82
+ stateComponents
83
+ } ) => dispatch => {
81
84
// find all places where the "to be delted" is a child and do what u gotta do
82
- stateComponents . forEach ( ( parent ) => {
83
- parent . childrenArray . filter ( child => child . childComponentId === componentId ) . forEach ( ( child ) => {
84
- dispatch ( {
85
- type : DELETE_CHILD ,
86
- payload : {
87
- parentId : parent . id ,
88
- childId : child . childId ,
89
- calledFromDeleteComponent : true ,
90
- } ,
85
+ stateComponents . forEach ( parent => {
86
+ parent . childrenArray
87
+ . filter ( child => child . childComponentId === componentId )
88
+ . forEach ( child => {
89
+ dispatch ( {
90
+ type : DELETE_CHILD ,
91
+ payload : {
92
+ parentId : parent . id ,
93
+ childId : child . childId ,
94
+ calledFromDeleteComponent : true
95
+ }
96
+ } ) ;
91
97
} ) ;
92
98
} ) ;
93
99
94
100
// change focus to APp
95
- dispatch ( { type : CHANGE_FOCUS_COMPONENT , payload : { title : ' App' } } ) ;
101
+ dispatch ( { type : CHANGE_FOCUS_COMPONENT , payload : { title : " App" } } ) ;
96
102
// after taking care of the children delete the component
97
103
dispatch ( { type : DELETE_COMPONENT , payload : { componentId } } ) ;
98
104
} ;
@@ -134,65 +140,108 @@ export const changeFocusComponent = ({ title }) => dispatch => {
134
140
135
141
// make sure childId is being sent in
136
142
< << << << HEAD
143
+ << << << < HEAD
137
144
export const changeFocusChild = ( { title , childId } ) => dispatch = > {
138
145
dispatch ( { type : CHANGE_FOCUS_CHILD , payload : { title, childId } } ) ;
139
146
=== = ===
140
147
export const changeFocusChild = ( { childId } ) => ( dispatch ) => {
148
+ === === =
149
+ export const changeFocusChild = ( { childId } ) => dispatch => {
150
+ >>> >>> > fcd32cb . . . finished ts changes to util files
141
151
dispatch ( { type : CHANGE_FOCUS_CHILD , payload : { childId } } ) ;
142
152
> >>> >>> c532596 . . . reducer cleanup , working version
143
153
} ;
144
154
155
+ < << << << HEAD
145
156
export const changeComponentFocusChild = ( { componentId , childId } ) => dispatch = > {
157
+ = === ===
158
+ export const changeComponentFocusChild = ( {
159
+ componentId,
160
+ childId
161
+ } ) => dispatch => {
162
+ >>> >>> > fcd32cb . . . finished ts changes to util files
146
163
dispatch ( {
147
164
type : CHANGE_COMPONENT_FOCUS_CHILD ,
148
- payload : { componentId, childId } ,
165
+ payload : { componentId, childId }
149
166
} ) ;
150
167
} ;
151
168
169
+ << < << << HEAD
152
170
export const exportFiles = ( { components , path , appName , exportAppBool } ) => dispatch = > {
171
+ = === ===
172
+ export const exportFiles = ( {
173
+ components,
174
+ path,
175
+ appName,
176
+ exportAppBool
177
+ } ) => dispatch => {
178
+ >>> >>> > fcd32cb . . . finished ts changes to util files
153
179
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
154
180
dispatch ( {
155
- type : EXPORT_FILES ,
181
+ type : EXPORT_FILES
156
182
} ) ;
157
183
158
184
createFiles ( components , path , appName , exportAppBool )
159
185
. then ( dir =>
160
186
dispatch ( {
161
187
type : EXPORT_FILES_SUCCESS ,
188
+ << < << << HEAD
162
189
payload : { status : true , dir : dir [ 0 ] } ,
163
190
} ) ,
191
+ === === =
192
+ payload : { status : true , dir : dir [ 0 ] }
193
+ } )
194
+ >>> >>> > fcd32cb... finished ts changes to util files
164
195
)
165
196
.catch(err =>
166
197
dispatch ( {
167
198
type : EXPORT_FILES_ERROR ,
199
+ < << << << HEAD
168
200
payload : { status : true , err } ,
169
201
} ),
202
+ =======
203
+ payload: { status : true , err }
204
+ } )
205
+ >>> >>> > fcd32cb ... finished ts changes to util files
170
206
) ;
171
207
} ;
172
208
173
209
export const handleClose = ( ) => ( {
174
210
type : HANDLE_CLOSE ,
175
- payload : false ,
211
+ payload : false
176
212
} );
177
213
214
+ < << << << HEAD
178
215
export const handleTransform = ( componentId , childId , { x , y , width , height } ) => ( {
216
+ = === ===
217
+ export const handleTransform = (
218
+ componentId ,
219
+ childId ,
220
+ { x, y, width, height }
221
+ ) => ( {
222
+ >>> >>> > fcd32cb ... finished ts changes to util files
179
223
type : HANDLE_TRANSFORM ,
180
224
payload : {
181
225
componentId,
182
226
childId,
183
227
x,
184
228
y,
185
229
width,
186
- height,
187
- } ,
230
+ height
231
+ }
188
232
} ) ;
189
233
190
234
export const createApplication = ( {
191
235
path,
192
236
components = [ ] ,
193
237
genOption,
238
+ < << << << HEAD
194
239
appName = 'reactype_app' ,
195
240
exportAppBool,
241
+ = === ===
242
+ appName = "reactype_app" ,
243
+ exportAppBool
244
+ > >>> >>> fcd32cb ... finished ts changes to util files
196
245
} ) => dispatch => {
197
246
if ( genOption === 0 ) {
198
247
exportAppBool = false ;
@@ -201,48 +250,53 @@ export const createApplication = ({
201
250
appName,
202
251
path,
203
252
components,
204
- exportAppBool,
205
- } ) ,
253
+ exportAppBool
254
+ } )
206
255
) ;
207
256
} else if ( genOption ) {
208
257
dispatch ( {
209
- type : CREATE_APPLICATION ,
258
+ type : CREATE_APPLICATION
210
259
} ) ;
211
260
createApplicationUtil ( {
212
261
path,
213
262
appName,
214
263
genOption,
215
- exportAppBool,
264
+ exportAppBool
216
265
} )
217
266
. then ( ( ) => {
218
267
dispatch ( {
219
- type : CREATE_APPLICATION_SUCCESS ,
268
+ type : CREATE_APPLICATION_SUCCESS
220
269
} ) ;
221
270
dispatch (
222
271
exportFiles ( {
223
272
appName,
224
273
path,
225
274
components,
226
- exportAppBool,
227
- } ) ,
275
+ exportAppBool
276
+ } )
228
277
) ;
229
278
} )
230
279
. catch ( err =>
231
280
dispatch ( {
232
281
type : CREATE_APPLICATION_ERROR ,
282
+ << < << << HEAD
233
283
payload : { status : true , err } ,
234
284
} ) ,
285
+ === === =
286
+ payload : { status : true , err }
287
+ } )
288
+ >>> >>> > fcd32cb... finished ts changes to util files
235
289
);
236
290
}
237
291
} ;
238
292
239
293
export const openExpansionPanel = component => ( {
240
294
type : OPEN_EXPANSION_PANEL ,
241
- payload : { component } ,
295
+ payload : { component }
242
296
} ) ;
243
297
244
298
export const deleteAllData = ( ) = > ( {
245
- type : DELETE_ALL_DATA ,
299
+ type : DELETE_ALL_DATA
246
300
} ) ;
247
301
248
302
export const deleteProp = propId => dispatch => {
@@ -251,19 +305,26 @@ export const deleteProp = propId => dispatch => {
251
305
252
306
export const addProp = prop => ( {
253
307
type : ADD_PROP ,
254
- payload : { ...prop } ,
308
+ payload : { ...prop }
255
309
} ) ;
256
310
257
311
export const updateHtmlAttr = ( { attr, value } ) = > dispatch => {
258
312
dispatch ( {
259
313
type : UPDATE_HTML_ATTR ,
260
- payload : { attr, value } ,
314
+ payload : { attr, value }
261
315
} ) ;
262
316
} ;
263
317
318
+ << < << << HEAD
319
+ export const updateChildrenSort = ( { newChildrenArray } ) => dispatch => {
320
+ dispatch ( {
321
+ type : UPDATE_CHILDREN_SORT ,
322
+ payload : { newChildrenArray }
323
+ === = ===
264
324
export const updateChildrenSort = ( { newSortValues } ) => ( dispatch ) => {
265
325
dispatch ( {
266
326
type : UPDATE_CHILDREN_SORT ,
267
327
payload : { newSortValues } ,
328
+ >>> >>> > 29 b23c438a735dda0a220e39c9795d2ca252eb6d
268
329
} ) ;
269
330
} ;
0 commit comments