Skip to content

Commit 9be52ea

Browse files
Merge pull request #101 from team-reactype/development
Development Master Merge
2 parents 0b7dd5e + 627e8a4 commit 9be52ea

36 files changed

+1853
-933
lines changed

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) 2018 ReacType
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,74 @@
11
# ReacType
2-
Prototyping Tool for React/Typescript Applications
2+
3+
4+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/team-reactype/ReacType/pulls)
5+
![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
6+
7+
**ReacType** is a visual prototyping tool for developers employing **React** component architecture alongside the comprehensive type checking of **TypeScript**.
8+
9+
**ReacType** allows the user to _visualize_ their application architecture dynamically, employing a _canvas display_, an _application tree_, and a _component code preview_. The user can create components and load _instances_ of these components, as well as nested HTML elements, onto the canvas. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
10+
11+
Download for [MacOS](), [Windows](), [Linux]().
12+
13+
### How to use
14+
15+
- Open the application to start a new project. It will open in the root App component, with its name listed in the left panel and the component represented by the white box on the canvas.
16+
- To add a new component, type its name in the upper left panel, in the field '**Add class component**', and press enter.
17+
- To render a component **_instance_** to the screen, first select the component, or _parent_, that the instance will be rendered within. This selected component will be represented in a new canvas view, with its own white box. Then press the plus button next to the component name. An instance, or _child_, representation will appear on the canvas.
18+
- To add draggable HTML elements, select the image icons on the lower left panel.
19+
- The bottom panel allows the user to toggle between 4 different views: a tree diagram of the application, a preview of the exportable code, a form to enter component props, and a form to add HTML attributes.
20+
- **_Props_** can be added to each component within its tab on bottom panel. Enter in a _key-value pair_, select its data _type_ and press the bottom 'ADD PROP'.
21+
- **_HTML Element Attributes_** of class name and ID can be added to each HTML element after an HTML element has been rendered to the canvas.
22+
- To **_delete_** a _child_ or instance from the canvas, select the desired instance and either press the _delete_ key or click the 'DELETE CHILD' button.
23+
- To **_delete_** a _component_, click the 'DELETE' button of the desired component in the left panel.
24+
- To _start over_, select the blue 'CLEAR WORKSPACE' button in the left panel. This will **clear the entire application**.
25+
26+
### To Export Files
27+
28+
- Once finished setting up the application template, press the green 'EXPORT PROJECT' button at the bottom of the left panel and choose between two options to export your files:
29+
1. Export the component files into a components folder. This option will allow a developer to add these files to an existing project.
30+
1. Export a new project with TypeScript config files and the component files. This option will allow a developer to immediately begin a new project.
31+
32+
#### Authors
33+
34+
[Christian Padilla](linkedin.com/in/ChristianEdwardPadilla) [@ChristianEdwardPadilla](https://github.com/ChristianEdwardPadilla)
35+
36+
[Tolga Mizrakci](linkedin.com/in/tolga-mizrakci) [@tolgamizrakci](https://github.com/tolgamizrakci)
37+
38+
[Shlomo Porges](linkedin.com/shlomoporges) [@shlomoporges](https://github.com/ShlomoPorges)
39+
40+
[Adam Singer](linkedin.com/in/adsing) [@spincycle01](https://github.com/spincycle01)
41+
42+
## To Run Your Own Version
43+
44+
- **Fork** and **Clone** Repository.
45+
- Open project directory
46+
- Install dependencies
47+
48+
```bash
49+
yarn install
50+
```
51+
52+
- Run application
53+
54+
```bash
55+
yarn start
56+
```
57+
58+
- For development experience, in one terminal...
59+
60+
```bash
61+
yarn run dev
62+
```
63+
64+
- and on another terminal
65+
66+
```bash
67+
yarn run electron
68+
```
69+
70+
### Logo Design
71+
72+
## License
73+
74+
This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/team-reactype/ReacType/blob/development/LICENSE.md) file for details.

main.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ function openFile() {
3333
mainWindow.webContents.send('new-file', file);
3434
}
3535

36-
// export files
37-
function exportComponents() {
38-
console.log('hi from exportComponents');
39-
}
40-
4136
// Choose directory
4237
ipcMain.on('choose_app_dir', (event) => {
4338
const directory = dialog.showOpenDialog(mainWindow, {
@@ -65,6 +60,10 @@ const createWindow = () => {
6560
mainWindow = new BrowserWindow({
6661
width,
6762
height,
63+
webPreferences: {
64+
zoomFactor: 0.9,
65+
'node-Integration': false,
66+
},
6867
show: false,
6968
});
7069

src/actionTypes/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ export const ADD_PROP = 'ADD_PROP';
2626
export const DELETE_ALL_DATA = 'DELETE_ALL_DATA';
2727
export const CHANGE_IMAGE_PATH = 'CHANGE_IMAGE_PATH';
2828
export const UPDATE_HTML_ATTR = 'UPDATE_HTML_ATTR';
29+
export const UPDATE_CHILDREN_SORT = 'UPDATE_CHILDREN_SORT'

src/actions/components.js

Lines changed: 103 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,22 @@ import {
2727
DELETE_ALL_DATA,
2828
CHANGE_IMAGE_PATH,
2929
UPDATE_HTML_ATTR,
30-
} from '../actionTypes/index';
30+
UPDATE_CHILDREN_SORT
31+
} from "../actionTypes/index";
3132

32-
import { loadState } from '../localStorage';
33+
import { loadState } from "../localStorage";
3334

34-
import createFiles from '../utils/createFiles.util';
35-
import createApplicationUtil from '../utils/createApplication.util';
35+
import createFiles from "../utils/createFiles.util.ts";
36+
import createApplicationUtil from "../utils/createApplication.util.ts";
3637

3738
export const loadInitData = () => dispatch => {
3839
loadState().then(data =>
3940
dispatch({
4041
type: LOAD_INIT_DATA,
4142
payload: {
42-
data: data ? data.workspace : {},
43-
},
44-
}),
43+
data: data ? data.workspace : {}
44+
}
45+
})
4546
);
4647
};
4748

@@ -76,22 +77,28 @@ export const deleteChild = ({}) => dispatch => {
7677
dispatch({ type: DELETE_CHILD, payload: {} });
7778
};
7879

79-
export const deleteComponent = ({ componentId, stateComponents }) => dispatch => {
80+
export const deleteComponent = ({
81+
componentId,
82+
stateComponents
83+
}) => dispatch => {
8084
// find all places where the "to be delted" is a child and do what u gotta do
81-
stateComponents.forEach((parent) => {
82-
parent.childrenArray.filter(child => child.childComponentId === componentId).forEach((child) => {
83-
dispatch({
84-
type: DELETE_CHILD,
85-
payload: {
86-
parentId: parent.id,
87-
childId: child.childId,
88-
calledFromDeleteComponent: true,
89-
},
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+
});
9097
});
9198
});
9299

93100
// change focus to APp
94-
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title: 'App' } });
101+
dispatch({ type: CHANGE_FOCUS_COMPONENT, payload: { title: "App" } });
95102
// after taking care of the children delete the component
96103
dispatch({ type: DELETE_COMPONENT, payload: { componentId } });
97104
};
@@ -133,65 +140,108 @@ export const changeFocusComponent = ({ title }) => dispatch => {
133140

134141
// make sure childId is being sent in
135142
<<<<<<< HEAD
143+
<<<<<<< HEAD
136144
export const changeFocusChild = ({ title, childId }) => dispatch => {
137145
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { title, childId } });
138146
=======
139147
export const changeFocusChild = ({ childId }) => (dispatch) => {
148+
=======
149+
export const changeFocusChild = ({ childId }) => dispatch => {
150+
>>>>>>> fcd32cb... finished ts changes to util files
140151
dispatch({ type: CHANGE_FOCUS_CHILD, payload: { childId } });
141152
>>>>>>> c532596... reducer cleanup, working version
142153
};
143154

155+
<<<<<<< HEAD
144156
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
145163
dispatch({
146164
type: CHANGE_COMPONENT_FOCUS_CHILD,
147-
payload: { componentId, childId },
165+
payload: { componentId, childId }
148166
});
149167
};
150168

169+
<<<<<<< HEAD
151170
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
152179
// this dispatch sets the global state property 'loading' to true until the createFiles call resolves below
153180
dispatch({
154-
type: EXPORT_FILES,
181+
type: EXPORT_FILES
155182
});
156183

157184
createFiles(components, path, appName, exportAppBool)
158185
.then(dir =>
159186
dispatch({
160187
type: EXPORT_FILES_SUCCESS,
188+
<<<<<<< HEAD
161189
payload: { status: true, dir: dir[0] },
162190
}),
191+
=======
192+
payload: { status: true, dir: dir[0] }
193+
})
194+
>>>>>>> fcd32cb... finished ts changes to util files
163195
)
164196
.catch(err =>
165197
dispatch({
166198
type: EXPORT_FILES_ERROR,
199+
<<<<<<< HEAD
167200
payload: { status: true, err },
168201
}),
202+
=======
203+
payload: { status: true, err }
204+
})
205+
>>>>>>> fcd32cb... finished ts changes to util files
169206
);
170207
};
171208

172209
export const handleClose = () => ({
173210
type: HANDLE_CLOSE,
174-
payload: false,
211+
payload: false
175212
});
176213

214+
<<<<<<< HEAD
177215
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
178223
type: HANDLE_TRANSFORM,
179224
payload: {
180225
componentId,
181226
childId,
182227
x,
183228
y,
184229
width,
185-
height,
186-
},
230+
height
231+
}
187232
});
188233

189234
export const createApplication = ({
190235
path,
191236
components = [],
192237
genOption,
238+
<<<<<<< HEAD
193239
appName = 'reactype_app',
194240
exportAppBool,
241+
=======
242+
appName = "reactype_app",
243+
exportAppBool
244+
>>>>>>> fcd32cb... finished ts changes to util files
195245
}) => dispatch => {
196246
if (genOption === 0) {
197247
exportAppBool = false;
@@ -200,48 +250,53 @@ export const createApplication = ({
200250
appName,
201251
path,
202252
components,
203-
exportAppBool,
204-
}),
253+
exportAppBool
254+
})
205255
);
206256
} else if (genOption) {
207257
dispatch({
208-
type: CREATE_APPLICATION,
258+
type: CREATE_APPLICATION
209259
});
210260
createApplicationUtil({
211261
path,
212262
appName,
213263
genOption,
214-
exportAppBool,
264+
exportAppBool
215265
})
216266
.then(() => {
217267
dispatch({
218-
type: CREATE_APPLICATION_SUCCESS,
268+
type: CREATE_APPLICATION_SUCCESS
219269
});
220270
dispatch(
221271
exportFiles({
222272
appName,
223273
path,
224274
components,
225-
exportAppBool,
226-
}),
275+
exportAppBool
276+
})
227277
);
228278
})
229279
.catch(err =>
230280
dispatch({
231281
type: CREATE_APPLICATION_ERROR,
282+
<<<<<<< HEAD
232283
payload: { status: true, err },
233284
}),
285+
=======
286+
payload: { status: true, err }
287+
})
288+
>>>>>>> fcd32cb... finished ts changes to util files
234289
);
235290
}
236291
};
237292

238293
export const openExpansionPanel = component => ({
239294
type: OPEN_EXPANSION_PANEL,
240-
payload: { component },
295+
payload: { component }
241296
});
242297

243298
export const deleteAllData = () => ({
244-
type: DELETE_ALL_DATA,
299+
type: DELETE_ALL_DATA
245300
});
246301

247302
export const deleteProp = propId => dispatch => {
@@ -250,12 +305,26 @@ export const deleteProp = propId => dispatch => {
250305

251306
export const addProp = prop => ({
252307
type: ADD_PROP,
253-
payload: { ...prop },
308+
payload: { ...prop }
254309
});
255310

256311
export const updateHtmlAttr = ({ attr, value }) => dispatch => {
257312
dispatch({
258313
type: UPDATE_HTML_ATTR,
259-
payload: { attr, value },
314+
payload: { attr, value }
315+
});
316+
};
317+
318+
<<<<<<< HEAD
319+
export const updateChildrenSort = ({ newChildrenArray }) => dispatch => {
320+
dispatch({
321+
type: UPDATE_CHILDREN_SORT,
322+
payload: { newChildrenArray }
323+
=======
324+
export const updateChildrenSort = ({ newSortValues }) => (dispatch) => {
325+
dispatch({
326+
type: UPDATE_CHILDREN_SORT,
327+
payload: { newSortValues },
328+
>>>>>>> 29b23c438a735dda0a220e39c9795d2ca252eb6d
260329
});
261330
};

0 commit comments

Comments
 (0)