Skip to content

Commit

Permalink
feat: add icons and fix linting
Browse files Browse the repository at this point in the history
add icons

close #7
  • Loading branch information
hassan committed Dec 18, 2018
1 parent a8d64e4 commit a213bcd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
Binary file modified assets/icon.icns
Binary file not shown.
Binary file modified assets/icon.ico
Binary file not shown.
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 10 additions & 12 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ createWindow = () => {
};

handleLoad = () => {
console.log('que vidinha');
console.log('load');
};

generateMenu = () => {
Expand Down Expand Up @@ -154,8 +154,8 @@ app.on('ready', () => {
generateMenu();
ipcMain.on('space:get', async (event, { id, spaces }) => {
try {
const space = spaces.find(el => Number(el.id) === Number(id));
const { phases } = space;
const space = spaces.find(el => Number(el.id) === Number(id));
const { phases } = space;
for (const phase of phases) {
const { items = [] } = phase;
for (let i=0; i < items.length; i++) {
Expand All @@ -168,7 +168,7 @@ app.on('ready', () => {
} = resource;
const fileName = `${hash}.${type}`;
const filePath = `${savedSpacesPath}/${fileName}`;
const fileAvailable = await checkFileAvailable({ filePath });
const fileAvailable = await checkFileAvailable(filePath);
if (fileAvailable){
phase.items[i].asset = filePath;
} else {
Expand All @@ -178,12 +178,10 @@ app.on('ready', () => {
.then(dl => {
phase.items[i].asset = dl.getSavePath();
})
.catch(console.log('error'));
} else {
mainWindow.webContents.send(
'space:get',
ERROR_GENERAL

);
}
}
Expand Down Expand Up @@ -338,7 +336,7 @@ app.on('ready', () => {
const filesPaths = [ssPath];
for (const phase of phases) {
const { items = [] } = phase;
for (let i=0; i < items.length; i++) {
for (let i = 0; i < items.length; i += 1) {
const { resource } = items[i];
if (resource) {
const {
Expand All @@ -347,7 +345,7 @@ app.on('ready', () => {
} = resource;
const fileName = `${hash}.${type}`;
const filePath = `${savedSpacesPath}/${fileName}`;
const fileAvailable = await checkFileAvailable({ filePath });
const fileAvailable = await checkFileAvailable(filePath);
if (fileAvailable){
filesPaths.push(filePath);
}
Expand Down Expand Up @@ -388,7 +386,7 @@ app.on('ready', () => {
archive.pipe(output);
filesPaths.forEach( path => {
const pathArr = path.split('/');
archive.file(path, { name: pathArr[pathArr.length -1 ] });
archive.file(path, { name: pathArr[pathArr.length - 1 ] });
});
archive.finalize();
} catch (err) {
Expand All @@ -406,7 +404,7 @@ app.on('ready', () => {
});
ipcMain.on('show-save-dialog', (event, spaceTitle) => {
const options = {
title: 'Save as',
title: 'Save As',
defaultPath: `${spaceTitle}.zip`,
};
dialog.showSaveDialog(null, options, (filePath) => {
Expand All @@ -419,7 +417,7 @@ app.on('ready', () => {
buttons: ['Cancel', 'Delete'],
defaultId: 0,
cancelId: 0,
message: 'Are you sure you want to delete the space?'
message: 'Are you sure you want to delete this space?'
};
dialog.showMessageBox(null, options, (respond) => {
mainWindow.webContents.send('message-dialog-respond', respond)
Expand All @@ -441,5 +439,5 @@ ipcMain.on('load-page', (event, arg) => {
mainWindow.loadURL(arg);
});

const checkFileAvailable = ({ filePath }) =>
const checkFileAvailable = (filePath) =>
new Promise(resolve => fs.access(filePath, fs.constants.F_OK, err => resolve(!err)));
13 changes: 7 additions & 6 deletions src/actions/space/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
CLEAR_SPACE,
ON_GET_SPACE_SUCCESS,
FLAG_EXPORTING_SPACE,
FLAG_DELETING_SPACE, ON_SPACE_DELETED,
FLAG_DELETING_SPACE,
ON_SPACE_DELETED,
} from '../../types/space';
import {
ERROR_ZIP_CORRUPTED,
Expand Down Expand Up @@ -99,10 +100,10 @@ const exportSpace = (id, spaces, spaceTitle) => (dispatch) => {
window.ipcRenderer.once('space:exported', (event, newSpaces) => {
switch (newSpaces) {
case ERROR_GENERAL:
toastr.error('Error', 'There was a problem exporting the space');
toastr.error('Error', 'There was a problem exporting this space.');
break;
default:
toastr.success('Success', 'Space exported successfully');
toastr.success('Success', 'Space was exported successfully');
}
dispatch(flagExportingSpace(false));
});
Expand All @@ -121,10 +122,10 @@ const deleteSpace = ({ id }) => (dispatch) => {
window.ipcRenderer.once('space:deleted', (event, deletedReply) => {
switch (deletedReply) {
case ERROR_GENERAL:
toastr.error('Error', 'There was a problem deleting the space');
toastr.error('Error', 'There was a problem deleting this space');
break;
default:
toastr.success('Success', 'Space deleted successfully');
toastr.success('Success', 'Space was deleted successfully');
dispatch({
type: ON_SPACE_DELETED,
payload: true,
Expand All @@ -150,7 +151,7 @@ const loadSpace = ({ fileLocation }) => (dispatch) => {
toastr.error('Error', 'A space with the same id is already available');
break;
default:
toastr.success('Success', 'Space Loaded successfully!');
toastr.success('Success', 'Space was loaded successfully!');
dispatch({
type: GET_SPACES,
payload: newSpaces,
Expand Down
Binary file added src/data/Graasp.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a213bcd

Please sign in to comment.