Skip to content

Commit 1342072

Browse files
authored
Merge pull request #71 from oslabs-beta/stretch
Preliminary Pull to Fork Master for Update to Version 2.0
2 parents 7762d3d + b18f123 commit 1342072

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2057
-1196
lines changed

.babelrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77
}
88
],
99
"react",
10-
"stage-0"
10+
"stage-0",
1111
],
12-
"plugins": ["transform-es2015-modules-commonjs"]
12+
"plugins": ["transform-es2015-modules-commonjs"],
13+
"env": {
14+
"test": {
15+
"plugins": ["transform-es2015-modules-commonjs"]
16+
}
17+
}
1318
}

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 80,
3+
"singleQuote": true,
4+
"trailingComma": "none"
5+
}

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
language: node_js
22
node_js:
3-
- "8"
4-
- "10"
3+
- 10

README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,42 @@ In other words, **you can draw prototypes and export React / Typescript code!**
1212

1313
**ReacType** allows the user to _visualize_ their application architecture dynamically, employing a _canvas display_, an _application tree_, and a _real-time 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.
1414

15-
Download for [MacOS](https://github.com/team-reactype/ReacType/releases/tag/Mac.Version.1.0), [Windows](https://github.com/team-reactype/ReacType/releases/tag/Win.Version.1.0), [Linux](https://github.com/team-reactype/ReacType/releases/tag/Linux.Version.1.0).
15+
**New with version 2.0:**
16+
- React Native mode for iOS/Andoird app design
17+
- Hooks integration with functional components
18+
- History navigation
19+
- Tutorial mode
20+
- New keyboard shortcuts
21+
- Editable code preview
22+
- Prop value designation for component children
23+
24+
Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windows](https://github.com/team-reactype/ReacType/releases/), [Linux](https://github.com/team-reactype/ReacType/releases/).
1625

1726
* **Mac users**: for now you might need to go to your security settings to allow the app run on your system as we do not have an Apple license yet.
1827

19-
![Image of ReacType Application](https://i.imgur.com/0wV7R1P.jpg)
28+
* **Linux users**: run the application as a super user in order to read and write files.
2029

21-
### How to use
30+
![Image of ReacType Application](https://i.imgur.com/OgcP9II.png)
2231

23-
- To enter **_Tutorial Mode_** navigate to 'Help' -> 'Tutotial'
32+
### How to use
2433

2534
- 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.
26-
- **_Upload an image to use as template_** by clicking the button on the bottom left corner or through the windows menu under 'File -> Open Image'
27-
- To add a new component, type its name in the upper left panel, in the field '**Add component**', and press enter.
35+
- Switch to React Native mode to change the interface to a mobile app development environment
36+
- To add a new component, type its name in the upper left panel, in the field '**Add class component**', and press enter.
2837
- 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.
29-
- To **_toggle the component to be class or functional_** click the 'Class?' switch and it will repopulate the code preview to reflect the change.
30-
- To **_toggle the component to be stateful_** click the 'State?' switch and it will repopulate the code preview to reflect the change. The application exported will use the 'useState' hook to allow for functional components to be stateful as well.
3138
- To add draggable **HTML elements**, select the image icons on the lower left panel.
3239

33-
![Gif of adding](https://imgur.com/sZloD8o.gif)
40+
![Gif of adding](https://i.imgur.com/hdVTFcP.gif)
3441

3542
- The bottom panel allows the user to toggle between 4 different views: a **tree diagram of the application**, a **real-time preview of the exportable code**, a form to enter component props, and a form to add HTML attributes.
3643

37-
![Gif of code preview & tree](https://imgur.com/KZb2UTO.gif)
38-
39-
- **_Props_** can be added to each component within its tab on bottom panel. Enter in a _name for the prop_, select its data _type_ and press the bottom 'ADD PROP'.
44+
- **_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'.
4045
- **_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.
41-
- To **_edit code while in code preview_** press 'ENTER EDIT MODE'.
4246

43-
![Gif of attr & props](https://imgur.com/JgCiBE9.gif)
47+
![Gif of attr & props](https://i.imgur.com/cmgOLLN.gif)
4448

4549
- To **_delete_** a _child_ or instance from the canvas, select the desired instance and either press the _delete_ key.
4650
- To **_delete_** a _component_, click the 'DELETE' button of the desired component in the left panel.
47-
- To **_edit_** a _component's name_, double click on the component's name, and press escape to cancel.
4851
- To _start over_, select the blue 'CLEAR WORKSPACE' button in the left panel. This will **clear the entire application**.
4952

5053
### To Export Files
@@ -63,9 +66,9 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases/tag/Mac.
6366

6467
[Christian Padilla](https://linkedin.com/in/ChristianEdwardPadilla) [@ChristianEdwardPadilla](https://github.com/ChristianEdwardPadilla)
6568

66-
[Eliot Nguyen](https://www.linkedin.com/in/ibeeliot/) [@ibeeliot](https://github.com/ibeeliot)
69+
[Eliot Nguyen](https://linkedin.com/in/ibeeliot) [@ibeeliot](https://github.com/ibeeliot)
6770

68-
[Jesse Zuniga](https://www.linkedin.com/in/jesse-zuniga/) [@jzuniga206](https://github.com/jzuniga206)
71+
[Jesse Zuniga](https://linkedin.com/in/jesse-zuniga) [@jzuniga206](https://github.com/jzuniga206)
6972

7073
[Mitchel Severe](https://www.linkedin.com/in/misevere/) [@mitchelsevere](https://github.com/mitchelsevere)
7174

@@ -81,7 +84,7 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases/tag/Mac.
8184

8285
[Tolga Mizrakci](https://linkedin.com/in/tolga-mizrakci) [@tolgamizrakci](https://github.com/tolgamizrakci)
8386

84-
[Tony Ito-Cole](www.linkedin.com/in/tony-ito-cole) [@tonyito](https://github.com/tonyito)
87+
[Tony Ito-Cole](https://linkedin.com/in/tony-ito-cole) [@tonyito](https://github.com/tonyito)
8588

8689
## To Run Your Own Version
8790

__mocks__/electron.js renamed to __mocks__/electron.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ const ipcRenderer = {
33
on: jest.fn(),
44
};
55

6-
export default ipcRenderer;
6+
module.exports = ipcRenderer;

main.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ function redo() {
5555
mainWindow.webContents.send('redo');
5656
}
5757

58-
5958
function toggleTutorial() {
6059
mainWindow.webContents.send('tutorial_clicked');
6160
}
@@ -85,8 +84,8 @@ const createWindow = () => {
8584
// eslint-disable-next-line
8685
const { width, height } = require('electron').screen.getPrimaryDisplay().size;
8786
mainWindow = new BrowserWindow({
88-
width,
89-
height,
87+
width: 1920,
88+
height: 1080,
9089
webPreferences: {
9190
zoomFactor: 0.7,
9291
'node-Integration': false
@@ -122,16 +121,17 @@ const createWindow = () => {
122121
{
123122
label: 'Edit',
124123
submenu: [
125-
{
124+
{
126125
label: 'Undo',
127-
accelerator: process.platform === 'darwin' ? 'Cmd+Z' : 'Ctrl+Z', //these hotkeys are a tad bit glitchy
126+
accelerator: process.platform === 'darwin' ? 'Cmd+Z' : 'Ctrl+Z', //these hotkeys are a tad bit glitchy
128127
click() {
129128
undo();
130129
}
131130
},
132-
{
131+
{
133132
label: 'Redo',
134-
accelerator: process.platform === 'darwin' ? 'Cmd+Shift+Z' : 'Ctrl+Shift+Z',
133+
accelerator:
134+
process.platform === 'darwin' ? 'Cmd+Shift+Z' : 'Ctrl+Shift+Z',
135135
click() {
136136
redo();
137137
}
@@ -142,8 +142,8 @@ const createWindow = () => {
142142
{ role: 'paste' },
143143
{ role: 'pasteandmatchstyle' },
144144
{ role: 'delete' },
145-
{ role: 'selectall' },
146-
],
145+
{ role: 'selectall' }
146+
]
147147
},
148148
{
149149
label: 'View',
@@ -172,9 +172,9 @@ const createWindow = () => {
172172
}
173173
},
174174
{
175-
label: 'Tutorial',
176-
click() {
177-
toggleTutorial();
175+
label: 'Tutorial',
176+
click() {
177+
toggleTutorial();
178178
}
179179
}
180180
]
@@ -242,10 +242,11 @@ const createWindow = () => {
242242
mainWindow = null;
243243
});
244244

245+
// UNCOMMENT THIS DURING DEVELOPMENT TO ENABLE CONSOLE TO OPEN UPON LAUNCH
245246
// dev tools opened on every browser creation
246-
mainWindow.webContents.once('dom-ready', () => {
247-
mainWindow.webContents.openDevTools();
248-
});
247+
// mainWindow.webContents.once('dom-ready', () => {
248+
// mainWindow.webContents.openDevTools();
249+
// });
249250
};
250251

251252
// This method will be called when Electron has finished
@@ -269,7 +270,7 @@ app.on('ready', () => {
269270
}
270271
globalShortcut.register('Escape', () => {
271272
escape();
272-
})
273+
});
273274
});
274275

275276
// Quit when all windows are closed.

package.json

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@
7171
"electron": "cross-env NODE_ENV=development electron .",
7272
"build": "cross-env NODE_ENV=production webpack --config webpack.config.production.js",
7373
"build-bin": "electron-builder -mwl",
74-
"test": "cross-env NODE_ENV=test jest",
74+
"test": "cross-env NODE_ENV=test jest --verbose",
75+
"test:update-snap": "cross-env NODE_ENV=test jest --updateSnapshot",
76+
"test:clear": "cross-env NODE_ENV=test jest --clearCache",
7577
"linter": "eslint src",
7678
"develop": "concurrently \"npm run dev\" \"npm run electron\""
7779
},
@@ -83,16 +85,32 @@
8385
"jest": {
8486
"moduleNameMapper": {
8587
"^.+\\.(css|scss|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "identity-obj-proxy",
86-
"electron": "<rootDir>/__mocks__/electron.js"
88+
"electron": "<rootDir>/__mocks__/electron.ts"
89+
},
90+
"moduleFileExtensions": [
91+
"ts",
92+
"tsx",
93+
"js"
94+
],
95+
"transform": {
96+
"\\.(ts|tsx)$": "<rootDir>/node_modules/ts-jest"
97+
},
98+
"testRegex": "/__tests__/.*\\.(ts|tsx|js)$",
99+
"globals": {
100+
"ts-jest": {
101+
"diagnostics": false
102+
}
87103
},
88104
"setupFiles": [
89-
"./src/setupTests.js"
105+
"<rootDir>/src/setupTests.ts"
90106
]
91107
},
92108
"dependencies": {
93109
"@material-ui/core": "^4.2.1",
94110
"@material-ui/icons": "^4.0.1",
95111
"@material-ui/styles": "^4.9.6",
112+
"@types/enzyme": "^3.10.5",
113+
"@types/enzyme-adapter-react-16": "^1.0.6",
96114
"@types/prettier": "^1.19.0",
97115
"@types/prismjs": "^1.16.0",
98116
"@types/react": "^16.8.14",
@@ -106,14 +124,16 @@
106124
"cli-spinner": "^0.2.8",
107125
"commander": "^2.17.1",
108126
"concurrently": "^5.1.0",
127+
"core-js": "^3.6.4",
109128
"csstype": "^2.6.9",
110129
"d3": "^5.9.2",
111130
"electron-reload": "^1.4.0",
112131
"enzyme": "^3.4.1",
113-
"konva": "^4.1.6",
132+
"enzyme-adapter-react-16": "^1.2.0",
133+
"konva": "^4.2.0",
114134
"localforage": "^1.7.2",
115135
"lodash.throttle": "^4.1.1",
116-
"material-table": "^1.25.2",
136+
"material-table": "^1.57.2",
117137
"prettier": "^1.19.1",
118138
"prismjs": "^1.19.0",
119139
"prop-types": "^15.6.2",
@@ -134,11 +154,15 @@
134154
"redux-undo": "^1.0.1"
135155
},
136156
"devDependencies": {
157+
"@babel/core": "^7.9.0",
137158
"@babel/preset-typescript": "^7.3.3",
159+
"@types/jest": "^25.1.5",
138160
"awesome-typescript-loader": "^5.2.1",
139161
"babel-core": "^6.26.3",
140162
"babel-eslint": "^8.2.6",
163+
"babel-jest": "^25.2.4",
141164
"babel-loader": "^7.1.4",
165+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
142166
"babel-preset-env": "^1.6.1",
143167
"babel-preset-react": "^6.24.1",
144168
"babel-preset-stage-0": "^6.24.1",
@@ -151,7 +175,6 @@
151175
"electron-builder": "^20.44.4",
152176
"electron-devtools-installer": "^2.2.4",
153177
"electron-installer-dmg": "^2.0.0",
154-
"enzyme-adapter-react-16": "^1.2.0",
155178
"eslint": "^4.19.1",
156179
"eslint-config-airbnb-base": "^13.0.0",
157180
"eslint-plugin-babel": "^5.1.0",
@@ -162,12 +185,14 @@
162185
"extract-text-webpack-plugin": "^4.0.0-beta.0",
163186
"html-webpack-plugin": "^3.1.0",
164187
"identity-obj-proxy": "^3.0.0",
165-
"jest": "^23.5.0",
188+
"jest": "^25.2.6",
166189
"node-sass": "^4.13.1",
167190
"postcss-loader": "^2.1.6",
191+
"redux-mock-store": "^1.5.4",
168192
"sass-loader": "^7.0.3",
169193
"style-loader": "^0.20.3",
170-
"typescript": "^3.4.4",
194+
"ts-jest": "^25.3.0",
195+
"typescript": "^3.8.3",
171196
"webpack": "^4.42.0",
172197
"webpack-cli": "^3.3.11"
173198
},

prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 80,
3+
"singleQuote": true,
4+
"trailingComma": "none"
5+
}

src/actionTypes/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const REASSIGN_PARENT: string = 'REASSIGN_PARENT';
3232
export const REDO: string = 'REDO';
3333
export const SET_SELECTABLE_PARENTS: string = 'SET_SELECTABLE_PARENTS';
3434
export const TOGGLE_CLASS: string = 'TOGGLE_CLASS';
35+
export const TOGGLE_NATIVE: string = 'TOGGLE_NATIVE';
3536
export const TOGGLE_STATE: string = 'TOGGLE_STATE';
3637
export const UNDO: string = 'UNDO';
3738
export const UPDATE_COMPONENT: string = 'UPDATE_COMPONENT';

0 commit comments

Comments
 (0)