Skip to content

Commit

Permalink
Init app and table ui fix (#81)
Browse files Browse the repository at this point in the history
fix app crash and table ui
  • Loading branch information
giankotarola authored Jun 26, 2020
1 parent 877fd48 commit f069565
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 97 deletions.
17 changes: 9 additions & 8 deletions public/electron-app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require('dotenv').config();

const path = require('path');
const { app, Tray } = require('electron');
const isDev = require('electron-is-dev');

const DaemonProcess = require('./electron/daemon');
const registerEvents = require('./electron/events');
const createMainWindow = require('./electron/window/main');
const createSplashWindow = require('./electron/window/splash');
const { getMenuOptions, trayIcon } = require('./electron/tray-menu');

let appIcon;
Expand All @@ -21,6 +21,8 @@ const enableDevDaemon = process.env.DEV_DAEMON === 'true';
* App events
*/
app.on('window-all-closed', () => {
// eslint-disable-next-line no-console
console.log('All windows are closed...');
destroyStream();

if (process.platform !== 'darwin' || app.newUpdate) {
Expand All @@ -43,12 +45,14 @@ app.on('activate', () => {
});

app.on('before-quit', () => {
// eslint-disable-next-line no-console
console.log('App is quiting...');
daemon.stop();
app.quitting = true;
});

app.on('ready', () => {
mainWindow = createSplashWindow();
mainWindow = createMainWindow();

const contextMenu = getMenuOptions(app, 'pending');

Expand All @@ -60,9 +64,9 @@ app.on('ready', () => {
* Daemon Event handlers
*/
daemon.on('ready', () => {
const prevWindow = mainWindow;

mainWindow = createMainWindow();
mainWindow.loadURL(isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../build/index.html')}`);

mainWindow.on('closed', () => {
mainWindow = null;
Expand All @@ -77,8 +81,6 @@ daemon.on('ready', () => {
}
});

prevWindow.destroy();

destroyStream = registerEvents({
app,
isDev,
Expand All @@ -98,5 +100,4 @@ if (isDev && !enableDevDaemon) {
daemon.startDev();
return;
}

daemon.start();
2 changes: 1 addition & 1 deletion public/electron/events/app-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const registerAppUpdateEvents = ({
});
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Errror when try to check for updates: ${error.stack || error.message}`);
console.error(`Errror when try to check for updates: ${error.message}`);
}
};

Expand Down
5 changes: 3 additions & 2 deletions public/electron/window/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ const isMac = process.platform === 'darwin';

const createWindow = () => {
const url = isDev
? 'http://localhost:3000'
: `file://${path.join(__dirname, '../../../build/index.html')}`;
? 'http://localhost:3000/#/splash'
: `file://${path.join(__dirname, '../../../build/index.html#/splash')}`;

const win = new BrowserWindow({
width: 1200,
height: 680,
minWidth: 680,
minHeight: 500,
backgroundColor: '#000000',
titleBarStyle: isMac ? 'hiddenInset' : undefined,
icon: path.join(__dirname, '..', '..', 'icon.png'),
webPreferences: {
Expand Down
29 changes: 0 additions & 29 deletions public/electron/window/splash.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,60 +37,6 @@ const SharePanel = ({ t }) => {
{
username: 'sddavcsdgdfhfhjhmfhjsrgdfb',
},
{
username: 'zxczxcasdasdaczxcasdasdaczxas',
},
{
username: 'someuser1asdasdzcxc',
},
{
username: '4retxcssdsd',
},
{
username: 'xzcasd',
},
{
username: 'pfdoggohikjym',
},
{
username: 'asdxcasd',
},
{
username: 'hjgtybb',
},
{
username: 'zxczxcasdasdasdaczxas',
},
{
username: 'sobbvbasdasdzcxc',
},
{
username: '4regjfghjssdsd',
},
{
username: 'xzcasdvbdsfs45',
},
{
username: 'bnsiduyty',
},
{
username: 'zxcsffhgfhher',
},
{
username: 'bvsdfs',
},
{
username: 'cxvcxvsd',
},
{
username: 'dflgkwer',
},
{
username: 'xcvoiiuyen',
},
{
username: 'dfrtrtmm',
},
],
}));

Expand Down Expand Up @@ -196,8 +142,11 @@ const SharePanel = ({ t }) => {
return newArray.concat(collaborator);
}

// eslint-disable-next-line no-param-reassign
newArray[newArray.length - 1].username = t('detailsPanel.share.group', { number: index - state.maxCollaborators + 2 });
if (newArray.length) {
// eslint-disable-next-line no-param-reassign
newArray[newArray.length - 1].username = t('detailsPanel.share.group', { number: index - state.maxCollaborators + 2 });
}

return newArray;
}, [])
.map((collaborator, index, arr) => (
Expand Down
2 changes: 1 addition & 1 deletion src/views/Storage/Files/components/FileTable/FileTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const FileTable = () => {
return () => {
document.removeEventListener('click', handleTableOutsideClick);
};
}, [rows.length]);
}, [rows]);

return (
<div className={classes.tableWrapper}>
Expand Down

0 comments on commit f069565

Please sign in to comment.