Skip to content

Commit 9b12f5c

Browse files
MadinventorZerojonocrbuddhajjigaexkevinparkwilliamdyoon
committed
Readded delete to LeftContainer so that it's always mounted. Also added a fix for windows builds. Need set in the postinsall script.
Co-authored-by: jonocr <[email protected]> Co-authored-by: buddhajjigae <[email protected]> Co-authored-by: xkevinpark <[email protected]> Co-authored-by: williamdyoon <[email protected]>
1 parent 262b8f1 commit 9b12f5c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

app/src/containers/LeftContainer.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
import React, { useContext } from 'react';
1+
import React, { useContext, useEffect, useCallback } from 'react';
22
import Grid from '@material-ui/core/Grid';
33
import ComponentDrag from '../components/right/ComponentDrag';
44
import DragDropPanel from '../components/left/DragDropPanel';
5+
import StateContext from '../context/context';
56
import { styleContext } from './AppContainer';
67

78
// Left-hand portion of the app, where component options are displayed
89
const LeftContainer = (props): JSX.Element => {
910
const { style } = useContext(styleContext);
11+
const [state, dispatch] = useContext(StateContext);
1012

11-
// --------------------------COMPONENT PANEL MOVED TO RIGHTCONTAINER----------------------------
13+
const handleDelete = () => {
14+
dispatch({ type: 'DELETE CHILD', payload: {} });
15+
};
16+
17+
const keyBindedFunc = useCallback(e => {
18+
if (e.key === 'Backspace' && e.target.tagName !== "TEXTAREA" && e.target.tagName !== "INPUT") handleDelete();
19+
}, []);
20+
21+
useEffect(() => {
22+
document.addEventListener('keydown', keyBindedFunc);
23+
return () => {
24+
document.removeEventListener('keydown', keyBindedFunc);
25+
};
26+
}, []);
1227

1328
return (
1429
<div className="column left" style={style}>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"Tyler Sullberg"
3939
],
4040
"scripts": {
41-
"postinstall": "ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder install-app-deps",
41+
"postinstall": "set ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder install-app-deps",
4242
"dev-server": "cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js",
4343
"dev": "concurrently --success first \"cross-env NODE_ENV=development webpack-dev-server --config ./webpack.development.js\" \"cross-env NODE_ENV=development electron .\" \"npm run server\" -k",
4444
"p": "concurrently --success first \"npm run dev-server\" \"cross-env NODE_ENV=production electron .\" \"nodemon server/server.js\" -k",

0 commit comments

Comments
 (0)