Skip to content

Commit 8d0f024

Browse files
authored
Merge pull request #18 from sean1292/staging
Merging changes from two branches
2 parents 879a79a + 632dbcf commit 8d0f024

File tree

6 files changed

+39
-82
lines changed

6 files changed

+39
-82
lines changed

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const createWindow = () => {
7373
'node-Integration': false
7474
},
7575
show: false,
76-
icon: path.join(__dirname, '/src/public/icons/mac/icon.icns'),
76+
icon: path.join(__dirname, '/src/public/icons/png/256x256.png'),
7777
win: {
7878
icon: path.join(__dirname, '/src/public/icons/win/icon.ico'),
7979
target: ['portable']

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@
8888
"dependencies": {
8989
"@material-ui/core": "^3.9.3",
9090
"@material-ui/icons": "^2.0.0",
91+
"@types/prettier": "^1.19.0",
9192
"@types/react": "^16.8.14",
9293
"@types/react-dom": "^16.8.4",
9394
"@types/react-redux": "^7.0.8",
95+
"@types/react-syntax-highlighter": "^11.0.4",
9496
"autoprefixer": "^9.0.1",
9597
"babel-polyfill": "^6.26.0",
9698
"classnames": "^2.2.6",

src/components/BottomPanel.tsx

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
import React, { Component } from "react";
2-
import { connect } from "react-redux";
3-
import {
4-
handleClose,
5-
deleteCompProp,
6-
addCompProp
7-
} from "../actions/components.ts";
8-
import BottomTabs from "./BottomTabs.tsx";
9-
import { ComponentInt, ComponentsInt, ChildInt } from "../utils/Interfaces.ts";
1+
import React, { Component } from 'react';
2+
import { connect } from 'react-redux';
3+
import { handleClose, deleteProp, addProp } from '../actions/components';
4+
import BottomTabs from './BottomTabs';
5+
import { ComponentInt, ComponentsInt, ChildInt } from '../utils/Interfaces';
106

11-
const IPC = require("electron").ipcRenderer;
7+
const IPC = require('electron').ipcRenderer;
128

139
const mapDispatchToProps = (dispatch: any) => ({
1410
handleNotificationClose: () => dispatch(handleClose()),
15-
deleteProp: ({ id, index }: { id: number; index: number }) =>
16-
dispatch(deleteCompProp({ id, index })),
17-
addProp: (prop: any) => dispatch(addCompProp(prop))
11+
deleteProp: (id: number) => dispatch(deleteProp(id)),
12+
addProp: (prop: any) => dispatch(addProp(prop))
1813
});
1914

2015
const mapStateToProps = (store: any) => ({
@@ -32,16 +27,10 @@ interface PropsInt {
3227

3328
class BottomPanel extends Component<PropsInt> {
3429
render() {
35-
const {
36-
components,
37-
focusComponent,
38-
deleteProp,
39-
addProp,
40-
focusChild
41-
} = this.props;
30+
const { components, focusComponent, deleteProp, addProp, focusChild } = this.props;
4231

4332
return (
44-
<div className="bottom-panel" style={{ width: "100%" }}>
33+
<div className="bottom-panel" style={{ width: '100%' }}>
4534
<BottomTabs
4635
components={components}
4736
focusComponent={focusComponent}
@@ -54,7 +43,4 @@ class BottomPanel extends Component<PropsInt> {
5443
}
5544
}
5645

57-
export default connect(
58-
mapStateToProps,
59-
mapDispatchToProps
60-
)(BottomPanel);
46+
export default connect(mapStateToProps, mapDispatchToProps)(BottomPanel);

src/components/Props.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import Button from '@material-ui/core/Button';
88
import Select from '@material-ui/core/Select';
99
import Switch from '@material-ui/core/Switch';
1010
import InputLabel from '@material-ui/core/InputLabel';
11-
import { addProp, deleteProp } from '../actions/components.ts';
12-
import DataTable from './DataTable.tsx';
13-
import { ComponentInt } from '../utils/Interfaces.ts';
11+
import { addProp, deleteProp } from '../actions/components';
12+
import DataTable from './DataTable';
13+
import { ComponentInt } from '../utils/Interfaces';
1414

1515
const styles = theme => ({
1616
root: {
@@ -94,8 +94,8 @@ const availablePropTypes = {
9494
boolean: 'BOOL',
9595
function: 'FUNC',
9696
// symbol: 'SYM',
97-
node: 'NODE',
98-
element: 'ELEM',
97+
// node: 'NODE',
98+
// element: 'ELEM',
9999
any: 'ANY',
100100
tuple: 'TUP',
101101
enum: 'ENUM'

src/containers/MainContainer.tsx

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,7 @@ const mapDispatchToProps = (dispatch: any) => ({
5353
handleTransformation: (
5454
componentId: number,
5555
childId: number,
56-
{
57-
x,
58-
y,
59-
width,
60-
height
61-
}: { x: number; y: number; width: number; height: number }
56+
{ x, y, width, height }: { x: number; y: number; width: number; height: number }
6257
) =>
6358
dispatch(
6459
handleTransform(componentId, childId, {
@@ -68,25 +63,18 @@ const mapDispatchToProps = (dispatch: any) => ({
6863
height
6964
})
7065
),
71-
//this doesn't do anything here
66+
//this doesn't do anything here
7267
// changeImagePath: (imageSource: string) =>
7368
// dispatch(actions.changeImagePath(imageSource)),
7469

75-
7670
//this function changes the focus of the child within the focused component, thereby binding it to the transformer as a node
77-
changeFocusChild: ({ childId }: { childId: number }) =>
78-
dispatch(changeFocusChild({ childId })),
71+
changeFocusChild: ({ childId }: { childId: number }) => dispatch(changeFocusChild({ childId })),
7972

8073
//the difference between this dispatch function and the one above, is that this once alters the focused child status within the array of components,
8174
//vs the one above changes the focusChild property in the state
82-
changeComponentFocusChild: ({
83-
componentId,
84-
childId
85-
}: {
86-
componentId: number;
87-
childId: number;
88-
}) => dispatch(changeComponentFocusChild({ componentId, childId })),
89-
deleteChild: ({}) => dispatch(deleteChild({})) // if u send no prms, function will delete focus child. <-- This comment was already here, unsure what exactly it means.
75+
changeComponentFocusChild: ({ componentId, childId }: { componentId: number; childId: number }) =>
76+
dispatch(changeComponentFocusChild({ componentId, childId })),
77+
deleteChild: ({}) => dispatch(deleteChild({})) // if u send no prms, function will delete focus child. <-- This comment was already here, unsure what exactly it means.
9078
});
9179

9280
const mapStateToProps = (store: any) => ({
@@ -109,7 +97,7 @@ class MainContainer extends Component<PropsInt, StateInt> {
10997
// };
11098

11199
render() {
112-
//const { draggable, modal } = this.state; //this is being destructured but never read.
100+
//const { draggable, modal } = this.state; //this is being destructured but never read.
113101
const {
114102
components,
115103
handleTransformation,
@@ -126,9 +114,10 @@ class MainContainer extends Component<PropsInt, StateInt> {
126114

127115
return (
128116
<MuiThemeProvider theme={theme}>
129-
<div className='main-container'>
117+
<div className="main-container">
130118
{/* {modal} */}
131-
<div className='main' //ref={main} **no function, commenting out**
119+
<div
120+
className="main" //ref={main} **no function, commenting out**
132121
>
133122
<KonvaStage
134123
image={image}

src/utils/componentRender.util.ts

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
import {
2-
ComponentInt,
3-
ComponentsInt,
4-
ChildInt,
5-
ChildrenInt,
6-
PropInt
7-
} from './Interfaces';
1+
import { ComponentInt, ComponentsInt, ChildInt, ChildrenInt, PropInt } from './Interfaces';
82
import cloneDeep from './cloneDeep';
93

10-
const componentRender = (
11-
component: ComponentInt,
12-
components: ComponentsInt
13-
) => {
4+
const componentRender = (component: ComponentInt, components: ComponentsInt) => {
145
const {
156
childrenArray,
167
title,
@@ -130,10 +121,7 @@ const componentRender = (
130121
131122
${childrenArray
132123
.filter(child => child.childType !== 'HTML')
133-
.map(
134-
child =>
135-
`import ${child.componentName} from './${child.componentName}.tsx'`
136-
)
124+
.map(child => `import ${child.componentName} from './${child.componentName}.tsx'`)
137125
.reduce((acc: Array<string>, child) => {
138126
if (!acc.includes(child)) {
139127
acc.push(child);
@@ -147,11 +135,7 @@ const componentRender = (
147135
${props.map(prop => `${prop.key}: ${typeSwitcher(prop.type)}\n`)}
148136
};
149137
150-
${
151-
classBased
152-
? `class ${title} extends Component {`
153-
: `const ${title} = (props: Props) => {`
154-
}
138+
${classBased ? `class ${title} extends Component {` : `const ${title} = (props: Props) => {`}
155139
${
156140
stateful && !classBased
157141
? `const [prop, setProp] = useState("INITIAL VALUE FOR PROP");`
@@ -165,11 +149,9 @@ const componentRender = (
165149
}`
166150
: ``
167151
}
168-
169152
${classBased ? `render(): JSX.Element {` : ``}
170-
const {${props.map(el => el.key).join(', ')}} = ${
171-
classBased ? `this.props` : `props`
172-
};
153+
const {${props.map(el => el.key).join(', ')}} = ${classBased ? `this.props` : `props`};
154+
173155
return (
174156
<div>
175157
${cloneDeep(childrenArray)
@@ -178,14 +160,12 @@ const componentRender = (
178160
//console.log('this is childrenArray', child.HTMLInfo); //Did someone leave this here?//
179161
if (child.componentName == 'Button') {
180162
return `
181-
<${componentNameGenerator(child)} ${propDrillTextGenerator(
182-
child
183-
)}>${child.HTMLInfo.value}</${componentNameGenerator(child)}>`;
163+
<${componentNameGenerator(child)} ${propDrillTextGenerator(child)}>${
164+
child.HTMLInfo.value
165+
}</${componentNameGenerator(child)}>`;
184166
} else
185167
return `
186-
<${componentNameGenerator(child)} ${propDrillTextGenerator(
187-
child
188-
)}/>`;
168+
<${componentNameGenerator(child)} ${propDrillTextGenerator(child)}/>`;
189169
})
190170
.join('\n')}
191171
</div>

0 commit comments

Comments
 (0)