Skip to content

Commit 6eb6467

Browse files
committed
testing github notification
1 parent a690d1f commit 6eb6467

File tree

2 files changed

+102
-75
lines changed

2 files changed

+102
-75
lines changed

main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const path = require('path');
22
// adding a comment to test github notifications
3+
// adding new comment
34

45
const {
56
app,

src/actions/components.ts

Lines changed: 101 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import {
2-
ComponentInt, ComponentsInt, PropInt, ChildInt,
3-
} from '../utils/Interfaces.ts';
2+
ComponentInt,
3+
ComponentsInt,
4+
PropInt,
5+
ChildInt
6+
} from '../utils/Interfaces';
47

58
import {
69
LOAD_INIT_DATA,
@@ -24,49 +27,53 @@ import {
2427
ADD_PROP,
2528
DELETE_ALL_DATA,
2629
UPDATE_HTML_ATTR,
27-
UPDATE_CHILDREN_SORT,
30+
UPDATE_CHILDREN_SORT
2831
} from '../actionTypes/index.js';
2932

3033
import { loadState } from '../localStorage';
31-
import createFiles from '../utils/createFiles.util.ts';
32-
import createApplicationUtil from '../utils/createApplication.util.ts';
34+
import createFiles from '../utils/createFiles.util';
35+
import createApplicationUtil from '../utils/createApplication.util';
3336

3437
export const loadInitData = () => (dispatch: any) => {
35-
loadState().then((data: any) => dispatch({
36-
type: LOAD_INIT_DATA,
37-
payload: {
38-
data: data ? data.workspace : {},
39-
},
40-
}));
38+
loadState().then((data: any) =>
39+
dispatch({
40+
type: LOAD_INIT_DATA,
41+
payload: {
42+
data: data ? data.workspace : {}
43+
}
44+
})
45+
);
4146
};
4247

43-
export const addComponent = ({ title }: { title: string }) => (dispatch: any) => {
48+
export const addComponent = ({ title }: { title: string }) => (
49+
dispatch: any
50+
) => {
4451
dispatch({ type: ADD_COMPONENT, payload: { title } });
4552
};
4653

4754
export const addChild = ({
4855
title,
4956
childType,
50-
HTMLInfo,
57+
HTMLInfo
5158
}: {
52-
title: string;
53-
childType: string;
54-
HTMLInfo: object;
59+
title: string;
60+
childType: string;
61+
HTMLInfo: object;
5562
}) => (dispatch: any) => {
5663
dispatch({ type: ADD_CHILD, payload: { title, childType, HTMLInfo } });
5764
};
5865

5966
export const deleteChild = ({}) => (dispatch: any) => {
60-
// with no payload, it will delete focusd child
67+
// with no payload, it will delete focused child
6168
dispatch({ type: DELETE_CHILD, payload: {} });
6269
};
6370

6471
export const deleteComponent = ({
6572
componentId,
66-
stateComponents,
73+
stateComponents
6774
}: {
68-
componentId: number;
69-
stateComponents: ComponentsInt;
75+
componentId: number;
76+
stateComponents: ComponentsInt;
7077
}) => (dispatch: any) => {
7178
// find all places where the "to be deleted" is a child and do what u gotta do
7279
stateComponents.forEach((parent: ComponentInt) => {
@@ -78,8 +85,8 @@ stateComponents: ComponentsInt;
7885
payload: {
7986
parentId: parent.id,
8087
childId: child.childId,
81-
calledFromDeleteComponent: true,
82-
},
88+
calledFromDeleteComponent: true
89+
}
8390
});
8491
});
8592
});
@@ -90,66 +97,77 @@ stateComponents: ComponentsInt;
9097
dispatch({ type: DELETE_COMPONENT, payload: { componentId } });
9198
};
9299

93-
export const changeFocusComponent = ({ title }: { title: string }) => (dispatch: any) => {
100+
export const changeFocusComponent = ({ title }: { title: string }) => (
101+
dispatch: any
102+
) => {
94103
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title } });
95104
};
96105

97106
// make sure childId is being sent in
98-
export const changeFocusChild = ({ childId }: { childId: number }) => (dispatch: any) => {
107+
export const changeFocusChild = ({ childId }: { childId: number }) => (
108+
dispatch: any
109+
) => {
99110
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { childId } });
100111
};
101112

102113
export const changeComponentFocusChild = ({
103114
componentId,
104-
childId,
115+
childId
105116
}: {
106-
componentId: number;
107-
childId: number;
117+
componentId: number;
118+
childId: number;
108119
}) => (dispatch: any) => {
109120
dispatch({
110121
type: CHANGE_COMPONENT_FOCUS_CHILD,
111-
payload: { componentId, childId },
122+
payload: { componentId, childId }
112123
});
113124
};
114125

115126
export const exportFiles = ({
116127
components,
117128
path,
118129
appName,
119-
exportAppBool,
130+
exportAppBool
120131
}: {
121-
components: ComponentsInt;
122-
path: string;
123-
appName: string;
124-
exportAppBool: boolean;
132+
components: ComponentsInt;
133+
path: string;
134+
appName: string;
135+
exportAppBool: boolean;
125136
}) => (dispatch: any) => {
126137
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
127138
dispatch({
128-
type: EXPORT_FILES,
139+
type: EXPORT_FILES
129140
});
130141

131142
createFiles(components, path, appName, exportAppBool)
132-
.then(dir => dispatch({
133-
type: EXPORT_FILES_SUCCESS,
134-
payload: { status: true, dir: dir[0] },
135-
}))
136-
.catch(err => dispatch({
137-
type: EXPORT_FILES_ERROR,
138-
payload: { status: true, err },
139-
}));
143+
.then((dir) =>
144+
dispatch({
145+
type: EXPORT_FILES_SUCCESS,
146+
payload: { status: true, dir: dir[0] }
147+
})
148+
)
149+
.catch((err) =>
150+
dispatch({
151+
type: EXPORT_FILES_ERROR,
152+
payload: { status: true, err }
153+
})
154+
);
140155
};
141156

142157
export const handleClose = () => ({
143158
type: HANDLE_CLOSE,
144-
payload: false,
159+
payload: false
145160
});
146161

147162
export const handleTransform = (
148163
componentId: number,
149164
childId: number,
150165
{
151-
x, y, width, height,
152-
}: { x: number; y: number; width: number; height: number },
166+
x,
167+
y,
168+
width,
169+
height
170+
}: { x: number; y: number; width: number; height: number }
153171
) => ({
154172
type: HANDLE_TRANSFORM,
155173
payload: {
@@ -158,22 +176,22 @@ export const handleTransform = (
158176
x,
159177
y,
160178
width,
161-
height,
162-
},
179+
height
180+
}
163181
});
164182

165183
export const createApplication = ({
166184
path,
167185
components = [],
168186
genOption,
169187
appName = 'reactype_app',
170-
exportAppBool,
188+
exportAppBool
171189
}: {
172-
path: string;
173-
components: ComponentsInt;
174-
genOption: number;
175-
appName: string;
176-
exportAppBool: boolean;
190+
path: string;
191+
components: ComponentsInt;
192+
genOption: number;
193+
appName: string;
194+
exportAppBool: boolean;
177195
}) => (dispatch: any) => {
178196
if (genOption === 0) {
179197
exportAppBool = false;
@@ -182,47 +200,49 @@ exportAppBool: boolean;
182200
appName,
183201
path,
184202
components,
185-
exportAppBool,
186-
}),
203+
exportAppBool
204+
})
187205
);
188206
} else if (genOption) {
189207
exportAppBool = true;
190208
dispatch({
191-
type: CREATE_APPLICATION,
209+
type: CREATE_APPLICATION
192210
});
193211
createApplicationUtil({
194212
path,
195213
appName,
196-
genOption,
214+
genOption
197215
// exportAppBool
198216
})
199217
.then(() => {
200218
dispatch({
201-
type: CREATE_APPLICATION_SUCCESS,
219+
type: CREATE_APPLICATION_SUCCESS
202220
});
203221
dispatch(
204222
exportFiles({
205223
appName,
206224
path,
207225
components,
208-
exportAppBool,
209-
}),
226+
exportAppBool
227+
})
210228
);
211229
})
212-
.catch(err => dispatch({
213-
type: CREATE_APPLICATION_ERROR,
214-
payload: { status: true, err },
215-
}));
230+
.catch((err) =>
231+
dispatch({
232+
type: CREATE_APPLICATION_ERROR,
233+
payload: { status: true, err }
234+
})
235+
);
216236
}
217237
};
218238

219239
export const openExpansionPanel = (component: ComponentInt) => ({
220240
type: OPEN_EXPANSION_PANEL,
221-
payload: { component },
241+
payload: { component }
222242
});
223243

224244
export const deleteAllData = () => ({
225-
type: DELETE_ALL_DATA,
245+
type: DELETE_ALL_DATA
226246
});
227247

228248
export const deleteProp = (propId: number) => (dispatch: any) => {
@@ -231,23 +251,29 @@ export const deleteProp = (propId: number) => (dispatch: any) => {
231251

232252
export const addProp = (prop: PropInt) => ({
233253
type: ADD_PROP,
234-
payload: { ...prop },
254+
payload: { ...prop }
235255
});
236256

237-
export const updateHtmlAttr = ({ attr, value }: { attr: string; value: string }) => (
238-
dispatch: any,
239-
) => {
257+
export const updateHtmlAttr = ({
258+
attr,
259+
value
260+
}: {
261+
attr: string;
262+
value: string;
263+
}) => (dispatch: any) => {
240264
dispatch({
241265
type: UPDATE_HTML_ATTR,
242-
payload: { attr, value },
266+
payload: { attr, value }
243267
});
244268
};
245269

246-
export const updateChildrenSort = ({ newSortValues }: { newSortValues: any }) => (
247-
dispatch: any,
248-
) => {
270+
export const updateChildrenSort = ({
271+
newSortValues
272+
}: {
273+
newSortValues: any;
274+
}) => (dispatch: any) => {
249275
dispatch({
250276
type: UPDATE_CHILDREN_SORT,
251-
payload: { newSortValues },
277+
payload: { newSortValues }
252278
});
253279
};

0 commit comments

Comments
 (0)