Skip to content

Commit 1f02547

Browse files
committed
made minor changes: made the app logo show up on linux, also fixed some methods in BottomPannel
1 parent 9a650d5 commit 1f02547

File tree

4 files changed

+65
-89
lines changed

4 files changed

+65
-89
lines changed

main.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ function openFile() {
2020
filters: [
2121
{
2222
name: 'Images',
23-
extensions: ['jpeg', 'jpg', 'png', 'gif', 'pdf'],
24-
},
25-
],
23+
extensions: ['jpeg', 'jpg', 'png', 'gif', 'pdf']
24+
}
25+
]
2626
});
2727

2828
// if no files
@@ -37,7 +37,7 @@ function openFile() {
3737
ipcMain.on('choose_app_dir', event => {
3838
const directory = dialog.showOpenDialog(mainWindow, {
3939
properties: ['openDirectory'],
40-
buttonLabel: 'Export',
40+
buttonLabel: 'Export'
4141
});
4242

4343
if (!directory) return;
@@ -62,14 +62,14 @@ const createWindow = () => {
6262
height,
6363
webPreferences: {
6464
zoomFactor: 0.7,
65-
'node-Integration': false,
65+
'node-Integration': false
6666
},
6767
show: false,
68-
icon: path.join(__dirname, '/src/public/icons/mac/icon.icns'),
68+
icon: path.join(__dirname, '/src/public/icons/png/256x256.png'),
6969
win: {
7070
icon: path.join(__dirname, '/src/public/icons/win/icon.ico'),
71-
target: ['portable'],
72-
},
71+
target: ['portable']
72+
}
7373
});
7474

7575
// and load the index.html of the app.
@@ -88,9 +88,9 @@ const createWindow = () => {
8888
accelerator: process.platform === 'darwin' ? 'Cmd+O' : 'Ctrl+Shift+O',
8989
click() {
9090
openFile();
91-
},
92-
},
93-
],
91+
}
92+
}
93+
]
9494
},
9595
// {
9696
// label: 'Edit',
@@ -116,12 +116,12 @@ const createWindow = () => {
116116
{ role: 'zoomin' },
117117
{ role: 'zoomout' },
118118
{ type: 'separator' },
119-
{ role: 'togglefullscreen' },
120-
],
119+
{ role: 'togglefullscreen' }
120+
]
121121
},
122122
{
123123
role: 'window',
124-
submenu: [{ role: 'minimize' }, { role: 'close' }],
124+
submenu: [{ role: 'minimize' }, { role: 'close' }]
125125
},
126126
{
127127
role: 'help',
@@ -130,9 +130,9 @@ const createWindow = () => {
130130
label: 'Learn More',
131131
click() {
132132
shell.openExternal('https://electronjs.org');
133-
},
134-
},
135-
],
133+
}
134+
}
135+
]
136136
},
137137
{
138138
label: 'Developer',
@@ -142,10 +142,10 @@ const createWindow = () => {
142142
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
143143
click() {
144144
mainWindow.webContents.toggleDevTools();
145-
},
146-
},
147-
],
148-
},
145+
}
146+
}
147+
]
148+
}
149149
];
150150

151151
if (process.platform === 'darwin') {
@@ -160,19 +160,19 @@ const createWindow = () => {
160160
{ role: 'hideothers' },
161161
{ role: 'unhide' },
162162
{ type: 'separator' },
163-
{ role: 'quit' },
164-
],
163+
{ role: 'quit' }
164+
]
165165
});
166166

167167
// Edit menu
168168
template[2].submenu.push(
169169
{
170-
type: 'separator',
170+
type: 'separator'
171171
},
172172
{
173173
label: 'Speech',
174-
submenu: [{ role: 'startspeaking' }, { role: 'stopspeaking' }],
175-
},
174+
submenu: [{ role: 'startspeaking' }, { role: 'stopspeaking' }]
175+
}
176176
);
177177

178178
// Window menu
@@ -181,7 +181,7 @@ const createWindow = () => {
181181
{ role: 'minimize' },
182182
{ role: 'zoom' },
183183
{ type: 'separator' },
184-
{ role: 'front' },
184+
{ role: 'front' }
185185
];
186186
}
187187

@@ -202,7 +202,11 @@ const createWindow = () => {
202202
// Some APIs can only be used after this event occurs.
203203
app.on('ready', () => {
204204
if (isDev) {
205-
const { default: installExtension, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } = require('electron-devtools-installer');
205+
const {
206+
default: installExtension,
207+
REACT_DEVELOPER_TOOLS,
208+
REDUX_DEVTOOLS
209+
} = require('electron-devtools-installer');
206210

207211
installExtension([REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS])
208212
.then(() => {

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: {
@@ -93,8 +93,8 @@ const availablePropTypes = {
9393
boolean: 'BOOL',
9494
function: 'FUNC',
9595
// symbol: 'SYM',
96-
node: 'NODE',
97-
element: 'ELEM',
96+
// node: 'NODE',
97+
// element: 'ELEM',
9898
any: 'ANY',
9999
tuple: 'TUP',
100100
enum: 'ENUM'

src/containers/MainContainer.tsx

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
//The main container includes both the Konva stage for creating component wireframes and
2-
//the bottom panel.
1+
//The main container includes both the Konva stage for creating component wireframes and
2+
//the bottom panel.
33

4-
import React, { Component } from "react";
5-
import { connect } from "react-redux";
6-
import { MuiThemeProvider } from "@material-ui/core/styles";
7-
import BottomPanel from "../components/BottomPanel";
8-
import theme from "../components/theme";
4+
import React, { Component } from 'react';
5+
import { connect } from 'react-redux';
6+
import { MuiThemeProvider } from '@material-ui/core/styles';
7+
import BottomPanel from '../components/BottomPanel';
8+
import theme from '../components/theme';
99
import {
1010
handleTransform,
1111
changeFocusChild,
1212
changeComponentFocusChild,
1313
deleteChild
14-
} from "../actions/components";
15-
import KonvaStage from "../components/KonvaStage";
16-
import { ComponentInt, ComponentsInt } from "../utils/Interfaces";
14+
} from '../actions/components';
15+
import KonvaStage from '../components/KonvaStage';
16+
import { ComponentInt, ComponentsInt } from '../utils/Interfaces';
1717
import * as actions from '../actions/components';
1818

1919
interface PropsInt {
@@ -46,18 +46,13 @@ interface StateInt {
4646
modal: any;
4747
}
4848

49-
const IPC = require("electron").ipcRenderer;
49+
const IPC = require('electron').ipcRenderer;
5050

5151
const mapDispatchToProps = (dispatch: any) => ({
5252
handleTransformation: (
5353
componentId: number,
5454
childId: number,
55-
{
56-
x,
57-
y,
58-
width,
59-
height
60-
}: { x: number; y: number; width: number; height: number }
55+
{ x, y, width, height }: { x: number; y: number; width: number; height: number }
6156
) =>
6257
dispatch(
6358
handleTransform(componentId, childId, {
@@ -69,15 +64,9 @@ const mapDispatchToProps = (dispatch: any) => ({
6964
),
7065
changeImagePath: (imageSource: string) => dispatch(actions.changeImagePath(imageSource)),
7166

72-
changeFocusChild: ({ childId }: { childId: number }) =>
73-
dispatch(changeFocusChild({ childId })),
74-
changeComponentFocusChild: ({
75-
componentId,
76-
childId
77-
}: {
78-
componentId: number;
79-
childId: number;
80-
}) => dispatch(changeComponentFocusChild({ componentId, childId })),
67+
changeFocusChild: ({ childId }: { childId: number }) => dispatch(changeFocusChild({ childId })),
68+
changeComponentFocusChild: ({ componentId, childId }: { componentId: number; childId: number }) =>
69+
dispatch(changeComponentFocusChild({ componentId, childId })),
8170
deleteChild: ({}) => dispatch(deleteChild({})) // if u send no prms, function will delete focus child.
8271
});
8372

@@ -95,7 +84,7 @@ class MainContainer extends Component<PropsInt, StateInt> {
9584
scaleY: 1,
9685
x: 0,
9786
y: 0,
98-
modal: ""
87+
modal: ''
9988
};
10089

10190
render() {
@@ -141,7 +130,4 @@ class MainContainer extends Component<PropsInt, StateInt> {
141130
}
142131
}
143132

144-
export default connect(
145-
mapStateToProps,
146-
mapDispatchToProps
147-
)(MainContainer);
133+
export default connect(mapStateToProps, mapDispatchToProps)(MainContainer);

0 commit comments

Comments
 (0)