Skip to content

Commit eb7b53d

Browse files
authored
Merge branch 'staging' into staging
2 parents e3aa529 + 98c8ee2 commit eb7b53d

File tree

12 files changed

+291
-295
lines changed

12 files changed

+291
-295
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Created by https://www.gitignore.io/api/node,linux,macos,windows,visualstudio,yarn
2-
2+
yarn.lock
33
### Linux ###
44
*~
55

src/actionTypes/index.js

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

src/actionTypes/index.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export const LOAD_INIT_DATA: string = 'LOAD_INIT_DATA';
2+
export const ADD_COMPONENT: string = 'ADD_COMPONENT';
3+
export const ADD_CHILD: string = 'ADD_CHILD';
4+
export const DELETE_CHILD: string = 'DELETE_CHILD';
5+
export const UPDATE_COMPONENT: string = 'UPDATE_COMPONENT';
6+
export const DELETE_COMPONENT: string = 'DELETE_COMPONENT';
7+
export const CHANGE_FOCUS_COMPONENT: string = 'CHANGE_FOCUS_COMPONENT';
8+
export const CHANGE_COMPONENT_FOCUS_CHILD: string = 'CHANGE_COMPONENT_FOCUS_CHILD';
9+
export const CHANGE_FOCUS_CHILD: string = 'CHANGE_FOCUS_CHILD';
10+
export const UPDATE_CHILDREN: string = 'UPDATE_CHILDREN';
11+
export const REASSIGN_PARENT: string = 'REASSIGN_PARENT';
12+
export const SET_SELECTABLE_PARENTS: string = 'SET_SELECTABLE_PARENTS';
13+
export const EXPORT_FILES: string = 'EXPORT_FILES';
14+
export const EXPORT_FILES_SUCCESS: string = 'EXPORT_FILES_SUCCESS';
15+
export const EXPORT_FILES_ERROR: string = 'EXPORT_FILES_ERROR';
16+
export const HANDLE_CLOSE: string = 'HANDLE_CLOSE';
17+
export const HANDLE_TRANSFORM: string = 'HANDLE_TRANSFORM';
18+
export const CREATE_APPLICATION: string = 'CREATE_APPLICATION';
19+
export const CREATE_APPLICATION_SUCCESS: string = 'CREATE_APPLICATION_SUCCESS';
20+
export const CREATE_APPLICATION_ERROR: string = 'CREATE_APPLICATION_ERROR';
21+
export const MOVE_TO_BOTTOM: string = 'MOVE_TO_BOTTOM';
22+
export const MOVE_TO_TOP: string = 'MOVE_TO_TOP';
23+
export const OPEN_EXPANSION_PANEL: string = 'OPEN_EXPANSION_PANEL';
24+
export const DELETE_PROP: string = 'DELETE_PROP';
25+
export const ADD_PROP: string = 'ADD_PROP';
26+
export const DELETE_ALL_DATA: string = 'DELETE_ALL_DATA';
27+
export const CHANGE_IMAGE_PATH: string = 'CHANGE_IMAGE_PATH';
28+
export const UPDATE_HTML_ATTR: string = 'UPDATE_HTML_ATTR';
29+
export const UPDATE_CHILDREN_SORT: string = 'UPDATE_CHILDREN_SORT';
30+
export const CHANGE_IMAGE_SOURCE: string = 'CHANGE_IMAGE_SOURCE';
31+
export const DELETE_IMAGE: string = 'DELETE_IMAGE';
32+
export const TOGGLE_STATE: string = 'TOGGLE_STATE';

src/actions/components.ts

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { ComponentInt, ComponentsInt, PropInt, ChildInt } from '../utils/Interfaces.ts';
1+
import {
2+
ComponentInt, ComponentsInt, PropInt, ChildInt, Action, ApplicationStateInt
3+
} from '../utils/Interfaces.ts';
24

35
import {
46
LOAD_INIT_DATA,
@@ -26,29 +28,29 @@ import {
2628
UPDATE_CHILDREN_SORT,
2729
CHANGE_IMAGE_SOURCE,
2830
DELETE_IMAGE
29-
} from '../actionTypes/index.js';
31+
} from '../actionTypes/index.ts';
3032

3133
import { loadState } from '../localStorage';
3234
import createFiles from '../utils/createFiles.util.ts';
3335
import createApplicationUtil from '../utils/createApplication.util.ts';
3436

3537
export const changeImagePath = (imageSource: string) => ({
3638
type: CHANGE_IMAGE_SOURCE,
37-
payload: imageSource
38-
});
39+
payload: { imageSource },
40+
})
3941

40-
export const loadInitData = () => (dispatch: any) => {
41-
loadState().then((data: any) =>
42+
export const loadInitData = () => (dispatch: (arg: Action) => void) => {
43+
loadState().then((data: ApplicationStateInt) => {
4244
dispatch({
43-
type: LOAD_INIT_DATA,
44-
payload: {
45-
data: data ? data.workspace : {}
46-
}
47-
})
48-
);
45+
type: LOAD_INIT_DATA,
46+
payload: {
47+
data: data ? data.workspace : {},
48+
},
49+
});
50+
});
4951
};
5052

51-
export const addComponent = ({ title }: { title: string }) => (dispatch: any) => {
53+
export const addComponent = ({ title }: { title: string }) => (dispatch: (arg: Action) => void) => {
5254
dispatch({ type: ADD_COMPONENT, payload: { title } });
5355
};
5456

@@ -57,14 +59,14 @@ export const addChild = ({
5759
childType,
5860
HTMLInfo
5961
}: {
60-
title: string;
61-
childType: string;
62-
HTMLInfo: object;
63-
}) => (dispatch: any) => {
62+
title: string;
63+
childType: string;
64+
HTMLInfo: object;
65+
}) => (dispatch: (arg: Action) => void) => {
6466
dispatch({ type: ADD_CHILD, payload: { title, childType, HTMLInfo } });
6567
};
6668

67-
export const deleteChild = ({}) => (dispatch: any) => {
69+
export const deleteChild = ({}) => (dispatch: (arg: Action) => void) => {
6870
// with no payload, it will delete focusd child
6971
dispatch({ type: DELETE_CHILD, payload: {} });
7072
};
@@ -73,9 +75,9 @@ export const deleteComponent = ({
7375
componentId,
7476
stateComponents
7577
}: {
76-
componentId: number;
77-
stateComponents: ComponentsInt;
78-
}) => (dispatch: any) => {
78+
componentId: number;
79+
stateComponents: ComponentsInt;
80+
}) => (dispatch: (arg: Action) => void) => {
7981
// find all places where the "to be deleted" is a child and do what u gotta do
8082
stateComponents.forEach((parent: ComponentInt) => {
8183
parent.childrenArray
@@ -98,44 +100,43 @@ export const deleteComponent = ({
98100
dispatch({ type: DELETE_COMPONENT, payload: { componentId } });
99101
};
100102

101-
export const changeFocusComponent = ({ title }: { title: string }) => (dispatch: any) => {
103+
export const changeFocusComponent = ({ title }: { title: string }) => (dispatch: (arg: Action) => void) => {
102104
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title } });
103105
};
104106

105107
// make sure childId is being sent in
106-
export const changeFocusChild = ({ childId }: { childId: number }) => (dispatch: any) => {
108+
export const changeFocusChild = ({ childId }: { childId: number }) => (dispatch: (arg: Action) => void) => {
107109
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { childId } });
108110
};
109111

110112
export const changeComponentFocusChild = ({
111113
componentId,
112114
childId
113115
}: {
114-
componentId: number;
115-
childId: number;
116-
}) => (dispatch: any) => {
116+
componentId: number;
117+
childId: number;
118+
}) => (dispatch: (arg: Action) => void) => {
117119
dispatch({
118120
type: CHANGE_COMPONENT_FOCUS_CHILD,
119121
payload: { componentId, childId }
120122
});
121123
};
122124

123125
export const deleteImage = () => ({
124-
type: DELETE_IMAGE,
125-
payload: ''
126-
});
126+
type: DELETE_IMAGE
127+
})
127128

128129
export const exportFiles = ({
129130
components,
130131
path,
131132
appName,
132133
exportAppBool
133134
}: {
134-
components: ComponentsInt;
135-
path: string;
136-
appName: string;
137-
exportAppBool: boolean;
138-
}) => (dispatch: any) => {
135+
components: ComponentsInt;
136+
path: string;
137+
appName: string;
138+
exportAppBool: boolean;
139+
}) => (dispatch: (arg: Action) => void) => {
139140
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
140141
dispatch({
141142
type: EXPORT_FILES
@@ -184,12 +185,12 @@ export const createApplication = ({
184185
appName = 'reactype_app',
185186
exportAppBool
186187
}: {
187-
path: string;
188-
components: ComponentsInt;
189-
genOption: number;
190-
appName: string;
191-
exportAppBool: boolean;
192-
}) => (dispatch: any) => {
188+
path: string;
189+
components: ComponentsInt;
190+
genOption: number;
191+
appName: string;
192+
exportAppBool: boolean;
193+
}) => (dispatch: (arg: Action) => void) => {
193194
if (genOption === 0) {
194195
exportAppBool = false;
195196
dispatch(
@@ -208,8 +209,7 @@ export const createApplication = ({
208209
createApplicationUtil({
209210
path,
210211
appName,
211-
genOption
212-
// exportAppBool
212+
genOption,
213213
})
214214
.then(() => {
215215
dispatch({
@@ -242,7 +242,7 @@ export const deleteAllData = () => ({
242242
type: DELETE_ALL_DATA
243243
});
244244

245-
export const deleteProp = (propId: number) => (dispatch: any) => {
245+
export const deleteProp = (propId: number) => (dispatch: (arg: Action) => void) => {
246246
dispatch({ type: DELETE_PROP, payload: propId });
247247
};
248248

@@ -256,19 +256,20 @@ export const addProp = (prop: PropInt) => ({
256256
});
257257

258258
export const updateHtmlAttr = ({ attr, value }: { attr: string; value: string }) => (
259-
dispatch: any
259+
dispatch: (arg: Action) => void,
260260
) => {
261261
dispatch({
262262
type: UPDATE_HTML_ATTR,
263263
payload: { attr, value }
264264
});
265265
};
266266

267-
export const updateChildrenSort = ({ newSortValues }: { newSortValues: any }) => (
268-
dispatch: any
269-
) => {
270-
dispatch({
271-
type: UPDATE_CHILDREN_SORT,
272-
payload: { newSortValues }
273-
});
274-
};
267+
//Action reserved for SortChildren component not written yet
268+
// export const updateChildrenSort = ({ newSortValues }: { newSortValues: any }) => (
269+
// dispatch: (arg: Action) => void,
270+
// ) => {
271+
// dispatch({
272+
// type: UPDATE_CHILDREN_SORT,
273+
// payload: { newSortValues },
274+
// });
275+
// };

src/components/CodePreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { format } from 'prettier';
33
import componentRender from '../utils/componentRender.util';
44
import { ComponentInt, ComponentsInt } from '../utils/Interfaces';
55
/** ** SortCHildren will be fixed , dont XXX the file *** */
6-
// import SortChildren from './SortChildren.jsx';
6+
// import SortChildren from './SortChildren.tsx';
77
import SyntaxHighlighter from 'react-syntax-highlighter';
88
import { hybrid } from 'react-syntax-highlighter/dist/styles/hljs/';
99

0 commit comments

Comments
 (0)