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