diff --git a/package.json b/package.json
index dd67fa2..6524113 100644
--- a/package.json
+++ b/package.json
@@ -39,8 +39,8 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
- "electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
- "electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
+ "electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3001 electron .",
+ "electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3001 electron .",
"pack": "npm run build && electron-builder --dir --x64",
"dist": "npm run build && electron-builder --x64",
"dist-all": "npm run build && electron-builder --x64 --win --linux --mac",
diff --git a/public/electron.js b/public/electron.js
index 7c27f5d..ecbd338 100644
--- a/public/electron.js
+++ b/public/electron.js
@@ -77,7 +77,7 @@ const createWindow = () => {
}
// Create the browser window.
- const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 284 : 274) + ((os.platform() === 'win32') ? 30 : -20);
+ const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 294 : 274) + ((os.platform() === 'win32') ? 30 : -20);
mainWindow = new BrowserWindow({
width: 428 + ((os.platform() === 'win32') ? 40 : (os.platform() === 'darwin') ? 150 : 160),
height: height,
diff --git a/src/components/UI/Grid/Grid.js b/src/components/UI/Grid/Grid.js
index 9782c45..2096e9a 100644
--- a/src/components/UI/Grid/Grid.js
+++ b/src/components/UI/Grid/Grid.js
@@ -3,8 +3,7 @@ import './Grid.css';
import GridComponent from './GridComponent/GridComponent';
export default class extends Component {
- checkSizeInterval;
-
+ resizeTimeout;
state = {
calculated: false,
dimensions: {
@@ -20,6 +19,16 @@ export default class extends Component {
};
};
+ componentDidMount() {
+ window.addEventListener('resize', this.handleResize);
+ this.updateSizeAsync();
+ }
+
+ componentWillUnmount() {
+ window.removeEventListener('resize', this.handleResize);
+ clearInterval(this.resizeTimeout);
+ };
+
getSize = () => {
const elem = this.refs.GridOwner;
return {
@@ -28,6 +37,11 @@ export default class extends Component {
};
};
+ handleResize = () => {
+ clearTimeout(this.resizeTimeout);
+ this.resizeTimeout = setTimeout(this.updateSizeAsync, 10);
+ };
+
updateSize = () => {
const state = {
...this.state
@@ -43,25 +57,11 @@ export default class extends Component {
};
updateSizeAsync = () => {
- return new Promise((done) => {
+ return new Promise(() => {
this.updateSize();
- done();
});
};
- componentDidMount() {
- window.addEventListener("resize", this.updateSizeAsync);
- this.checkSizeInterval = setInterval(()=> {
- this.updateSize()
- }, 2000);
- this.updateSizeAsync();
- }
-
- componentWillUnmount() {
- window.removeEventListener("resize", this.updateSizeAsync);
- clearInterval(this.checkSizeInterval);
- };
-
render() {
let children = null;
const dimensions = this.state.dimensions;
@@ -91,17 +91,19 @@ export default class extends Component {
rowSpan = rowSpan ? (rowSpan === 'remain' ? (dimensions.rows - row) : rowSpan) : null;
colSpan = colSpan ? (colSpan === 'remain' ? dimensions.columns - col : colSpan) : null;
- return