Skip to content

Commit 6183be7

Browse files
committed
merged with export bug fixes
2 parents 6892c26 + c04fa26 commit 6183be7

16 files changed

+334
-234
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: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,70 @@
11
# ReacType
2-
Prototyping Tool for React/Typescript Applications
2+
3+
**ReacType** is a prototyping tool for developers employing **React** component architecture while utilizing the comprehensive type checking of **TypeScript**.
4+
5+
**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. These visual representations quickly reveal parent-child relationships between components and the embedded instances, with component views that can be toggled between and draggable representations that resized on the canvas itself. This architecture can then be _exported_ as TypeScript application files to be used as a starter template for any repository.
6+
7+
Download for [MacOS](), [Windows](), [Linux]().
8+
9+
### How to use
10+
11+
- 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.
12+
- To add a new component, type its name in the upper right panel, in the field '**Add class component**', and press the plus button.
13+
- 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.
14+
- To add draggable HTML elements, select the image icons on the lower left panel.
15+
- The bottom panel allows the user to toggle between 4 different views: a tree diagram of the application, a preview of the code, a form to enter component props, and a form to add HTML attributes.
16+
- **_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'.
17+
- **_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.
18+
- 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.
19+
- To **_delete_** a _component_, click the 'DELETE' button of the desired component in the left panel.
20+
- To _start over_, select the blue 'CLEAR WORKSPACE' button in the left panel. This will **clear the entire application**.
21+
22+
### To Export Files
23+
24+
- 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:
25+
1. Export the component files into a src folder. This option will allow a developer to add these files to an existing project.
26+
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.
27+
28+
#### Authors
29+
30+
[Christian Padilla](linkedin.com/in/ChristianEdwardPadilla) [@ChristianEdwardPadilla](https://github.com/ChristianEdwardPadilla)
31+
32+
[Tolga Mizrakci](linkedin.com/in/tolga-mizrakci) [@tolgamizrakci](https://github.com/tolgamizrakci)
33+
34+
[Shlomo Porges](linkedin.com/shlomoporges) [@shlomoporges](https://github.com/ShlomoPorges)
35+
36+
[Adam Singer](linkedin.com/in/adsing) [@spincycle01](https://github.com/spincycle01)
37+
38+
## To Run Your Own Version
39+
40+
- **Fork** and **Clone** Repository.
41+
- Open project directory
42+
- Install dependencies
43+
44+
```bash
45+
yarn install
46+
```
47+
48+
- Run application
49+
50+
```bash
51+
yarn start
52+
```
53+
54+
- For development experience, in one terminal...
55+
56+
```bash
57+
yarn run dev
58+
```
59+
60+
- and on another terminal
61+
62+
```bash
63+
yarn run electron
64+
```
65+
66+
### Logo Design
67+
68+
## License
69+
70+
This project is licensed under the MIT License - see the [LICENSE.md]() file for details.

main.js

Lines changed: 89 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
const {
2-
app, BrowserWindow, Menu, shell, dialog, ipcMain,
3-
} = require('electron');
2+
app,
3+
BrowserWindow,
4+
Menu,
5+
shell,
6+
dialog,
7+
ipcMain
8+
} = require("electron");
49

510
// Uncomment below for hot reloading during development
6-
require('electron-reload')(__dirname);
11+
require("electron-reload")(__dirname);
712

813
// const isDev = true;
9-
const isDev = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';
14+
const isDev =
15+
process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
1016

1117
// Keep a global reference of the window object, if you don't, the window will
1218
// be closed automatically when the JavaScript object is garbage collected.
@@ -16,77 +22,81 @@ let mainWindow;
1622
function openFile() {
1723
// Opens file dialog looking for markdown
1824
const files = dialog.showOpenDialog(mainWindow, {
19-
properties: ['openFile'],
25+
properties: ["openFile"],
2026
filters: [
2127
{
22-
name: 'Images',
23-
extensions: ['jpeg', 'jpg', 'png', 'gif', 'pdf'],
24-
},
25-
],
28+
name: "Images",
29+
extensions: ["jpeg", "jpg", "png", "gif", "pdf"]
30+
}
31+
]
2632
});
2733

2834
// if no files
2935
if (!files) return;
3036
const file = files[0];
3137

3238
// Send fileContent to renderer
33-
mainWindow.webContents.send('new-file', file);
39+
mainWindow.webContents.send("new-file", file);
3440
}
3541

3642
// export files
3743
function exportComponents() {
38-
console.log('hi from exportComponents');
44+
console.log("hi from exportComponents");
3945
}
4046

4147
// Choose directory
42-
ipcMain.on('choose_app_dir', (event) => {
48+
ipcMain.on("choose_app_dir", event => {
4349
const directory = dialog.showOpenDialog(mainWindow, {
44-
properties: ['openDirectory'],
45-
buttonLabel: 'Export',
50+
properties: ["openDirectory"],
51+
buttonLabel: "Export"
4652
});
4753

4854
if (!directory) return;
49-
event.sender.send('app_dir_selected', directory[0]);
55+
event.sender.send("app_dir_selected", directory[0]);
5056
});
5157

52-
ipcMain.on('view_app_dir', (event, appDir) => {
58+
ipcMain.on("view_app_dir", (event, appDir) => {
5359
shell.openItem(appDir);
5460
});
5561

5662
// Update file
57-
ipcMain.on('update-file', () => {
63+
ipcMain.on("update-file", () => {
5864
openFile();
5965
});
6066

6167
const createWindow = () => {
6268
// Create the browser window.
6369
// eslint-disable-next-line
64-
const { width, height } = require('electron').screen.getPrimaryDisplay().size;
70+
const { width, height } = require("electron").screen.getPrimaryDisplay().size;
6571
mainWindow = new BrowserWindow({
6672
width,
6773
height,
68-
show: false,
74+
webPreferences: {
75+
zoomFactor: 0.9,
76+
"node-Integration": false
77+
},
78+
show: false
6979
});
7080

7181
// and load the index.html of the app.
7282
mainWindow.loadURL(`file://${__dirname}/build/index.html`);
7383
// load page once window is loaded
74-
mainWindow.once('ready-to-show', () => {
84+
mainWindow.once("ready-to-show", () => {
7585
mainWindow.show();
7686
});
7787

7888
const template = [
7989
{
80-
label: 'File',
90+
label: "File",
8191
submenu: [
8292
{
83-
label: 'Open File',
84-
accelerator: process.platform === 'darwin' ? 'Cmd+O' : 'Ctrl+Shift+O',
93+
label: "Open File",
94+
accelerator: process.platform === "darwin" ? "Cmd+O" : "Ctrl+Shift+O",
8595
click() {
8696
openFile();
87-
},
88-
},
89-
],
97+
}
98+
}
99+
]
90100
},
91101
// {
92102
// label: 'Edit',
@@ -103,89 +113,90 @@ const createWindow = () => {
103113
// ],
104114
// },
105115
{
106-
label: 'View',
116+
label: "View",
107117
submenu: [
108-
{ role: 'reload' },
109-
{ role: 'forcereload' },
110-
{ type: 'separator' },
111-
{ role: 'resetzoom' },
112-
{ role: 'zoomin' },
113-
{ role: 'zoomout' },
114-
{ type: 'separator' },
115-
{ role: 'togglefullscreen' },
116-
],
118+
{ role: "reload" },
119+
{ role: "forcereload" },
120+
{ type: "separator" },
121+
{ role: "resetzoom" },
122+
{ role: "zoomin" },
123+
{ role: "zoomout" },
124+
{ type: "separator" },
125+
{ role: "togglefullscreen" }
126+
]
117127
},
118128
{
119-
role: 'window',
120-
submenu: [{ role: 'minimize' }, { role: 'close' }],
129+
role: "window",
130+
submenu: [{ role: "minimize" }, { role: "close" }]
121131
},
122132
{
123-
role: 'help',
133+
role: "help",
124134
submenu: [
125135
{
126-
label: 'Learn More',
136+
label: "Learn More",
127137
click() {
128-
shell.openExternal('https://electronjs.org');
129-
},
130-
},
131-
],
138+
shell.openExternal("https://electronjs.org");
139+
}
140+
}
141+
]
132142
},
133143
{
134-
label: 'Developer',
144+
label: "Developer",
135145
submenu: [
136146
{
137-
label: 'Toggle Developer Tools',
138-
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
147+
label: "Toggle Developer Tools",
148+
accelerator:
149+
process.platform === "darwin" ? "Alt+Command+I" : "Ctrl+Shift+I",
139150
click() {
140151
mainWindow.webContents.toggleDevTools();
141-
},
142-
},
143-
],
144-
},
152+
}
153+
}
154+
]
155+
}
145156
];
146157

147-
if (process.platform === 'darwin') {
158+
if (process.platform === "darwin") {
148159
template.unshift({
149160
label: app.getName(),
150161
submenu: [
151-
{ role: 'about' },
152-
{ type: 'separator' },
153-
{ role: 'services', submenu: [] },
154-
{ type: 'separator' },
155-
{ role: 'hide' },
156-
{ role: 'hideothers' },
157-
{ role: 'unhide' },
158-
{ type: 'separator' },
159-
{ role: 'quit' },
160-
],
162+
{ role: "about" },
163+
{ type: "separator" },
164+
{ role: "services", submenu: [] },
165+
{ type: "separator" },
166+
{ role: "hide" },
167+
{ role: "hideothers" },
168+
{ role: "unhide" },
169+
{ type: "separator" },
170+
{ role: "quit" }
171+
]
161172
});
162173

163174
// Edit menu
164175
template[2].submenu.push(
165176
{
166-
type: 'separator',
177+
type: "separator"
167178
},
168179
{
169-
label: 'Speech',
170-
submenu: [{ role: 'startspeaking' }, { role: 'stopspeaking' }],
171-
},
180+
label: "Speech",
181+
submenu: [{ role: "startspeaking" }, { role: "stopspeaking" }]
182+
}
172183
);
173184

174185
// Window menu
175186
template[4].submenu = [
176-
{ role: 'close' },
177-
{ role: 'minimize' },
178-
{ role: 'zoom' },
179-
{ type: 'separator' },
180-
{ role: 'front' },
187+
{ role: "close" },
188+
{ role: "minimize" },
189+
{ role: "zoom" },
190+
{ type: "separator" },
191+
{ role: "front" }
181192
];
182193
}
183194

184195
const menu = Menu.buildFromTemplate(template);
185196
Menu.setApplicationMenu(menu);
186197

187198
// Emitted when the window is closed.
188-
mainWindow.on('closed', () => {
199+
mainWindow.on("closed", () => {
189200
// Dereference the window object, usually you would store windows
190201
// in an array if your app supports multi windows, this is the time
191202
// when you should delete the corresponding element.
@@ -196,13 +207,13 @@ const createWindow = () => {
196207
// This method will be called when Electron has finished
197208
// initialization and is ready to create browser windows.
198209
// Some APIs can only be used after this event occurs.
199-
app.on('ready', () => {
210+
app.on("ready", () => {
200211
if (isDev) {
201212
const {
202213
default: installExtension,
203214
REACT_DEVELOPER_TOOLS,
204-
REDUX_DEVTOOLS,
205-
} = require('electron-devtools-installer');
215+
REDUX_DEVTOOLS
216+
} = require("electron-devtools-installer");
206217

207218
installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS])
208219
.then(() => {
@@ -215,15 +226,15 @@ app.on('ready', () => {
215226
});
216227

217228
// Quit when all windows are closed.
218-
app.on('window-all-closed', () => {
229+
app.on("window-all-closed", () => {
219230
// On OS X it is common for applications and their menu bar
220231
// to stay active until the user quits explicitly with Cmd + Q
221-
if (process.platform !== 'darwin') {
232+
if (process.platform !== "darwin") {
222233
app.quit();
223234
}
224235
});
225236

226-
app.on('activate', () => {
237+
app.on("activate", () => {
227238
// On OS X it's common to re-create a window in the app when the
228239
// dock icon is clicked and there are no other windows open.
229240
if (mainWindow === null) {

0 commit comments

Comments
 (0)