Skip to content

Commit 801db4b

Browse files
committed
minor styling changes
1 parent 56316ea commit 801db4b

File tree

1 file changed

+23
-55
lines changed

1 file changed

+23
-55
lines changed

main.js

Lines changed: 23 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,13 @@ require("./menu/mainMenu");
4848
// autoUpdater.logger.transports.file.level = "info";
4949
// log.info("App starting...");
5050

51-
<<<<<<< HEAD
5251
console.log("app.name is ->", app.name);
5352

54-
=======
55-
>>>>>>> master
5653
let mainWindow;
5754

58-
/****************************
59-
** Create Touchbar buttons **
60-
*****************************/
61-
55+
// -----------------------------------------------------------------
56+
// Create Touchbar buttons
57+
// -----------------------------------------------------------------
6258
const tbSelectAllButton = new TouchBarButton({
6359
label: "Select All",
6460
backgroundColor: "#3DADC2",
@@ -120,10 +116,9 @@ const tbSpacer = new TouchBarSpacer();
120116
const tbFlexSpacer = new TouchBarSpacer({
121117
size: "flexible",
122118
});
123-
124-
/********************************
125-
** Attach buttons to touchbar **
126-
********************************/
119+
// -----------------------------------------------------------------
120+
// Attach earlier made buttons to a touch bar
121+
// -----------------------------------------------------------------
127122

128123
const touchBar = new TouchBar([
129124
tbSpacer,
@@ -136,34 +131,16 @@ const touchBar = new TouchBar([
136131
tbClearAllButton,
137132
]);
138133

139-
/************************
140-
******** SET isDev *****
141-
************************/
134+
// -----------------------------------------------
135+
// prod / dev mode determined by boolean 'isDev'
136+
// -----------------------------------------------
142137

143138
let isDev;
144139
// if using Spectron, run it in production
145140
process.argv.includes("--noDevServer") || process.argv.includes("TEST_MODE")
146141
? (isDev = false)
147142
: (isDev = true);
148-
149-
/*************************
150-
******* MODE DISPLAY ****
151-
*************************/
152-
153-
isDev
154-
? console.log(`
155-
156-
=========================
157-
Launching in DEV mode
158-
=========================
159-
`)
160-
: console.log(`
161-
162-
================================
163-
Launching in PRODUCTION mode
164-
================================
165-
`);
166-
143+
console.log("is this in dev mode? ", isDev);
167144
// let isDev = false;
168145
// console.log("process.defaultApp ->", process.defaultApp);
169146
// console.log("process.execPath -> ", process.execPath);
@@ -191,7 +168,7 @@ if (process.platform === "win32") {
191168
}
192169

193170
/***********************************************
194-
******* createWindow function declaration *****
171+
******* createWindow function declaration ******
195172
***********************************************/
196173

197174
function createWindow() {
@@ -213,26 +190,28 @@ function createWindow() {
213190
icon: `${__dirname}/src/assets/icons/64x64.png`,
214191
});
215192

193+
if (isDev) {
194+
// If we are in developer mode Add React & Redux DevTools to Electon App
195+
installExtension(REACT_DEVELOPER_TOOLS)
196+
.then((name) => console.log(`Added Extension: ${name}`))
197+
.catch((err) => console.log("An error occurred: ", err));
198+
199+
installExtension(REDUX_DEVTOOLS)
200+
.then((name) => console.log(`Added Extension: ${name}`))
201+
.catch((err) => console.log("An error occurred: ", err));
202+
}
203+
216204
// and load the index.html of the app.
217205
let indexPath;
218206

219-
if (isDev) {
207+
if (isDev && process.argv.indexOf("--noDevServer") === -1) {
220208
// if we are in dev mode load up 'http://localhost:8080/index.html'
221209
indexPath = url.format({
222210
protocol: "http:",
223211
host: "localhost:8080",
224212
pathname: "test-index.html",
225213
slashes: true,
226214
});
227-
228-
// If we are in developer mode Add React & Redux DevTools to Electon App
229-
installExtension(REACT_DEVELOPER_TOOLS)
230-
.then((name) => console.log(`Added Extension: ${name}`))
231-
.catch((err) => console.log("An error occurred: ", err));
232-
233-
installExtension(REDUX_DEVTOOLS)
234-
.then((name) => console.log(`Added Extension: ${name}`))
235-
.catch((err) => console.log("An error occurred: ", err));
236215
} else {
237216
indexPath = url.format({
238217
// if we are not in dev mode load production build file
@@ -412,9 +391,6 @@ ipcMain.on("import-collection", (event, args) => {
412391
return;
413392
}
414393

415-
// names is the list of existing collection names in state
416-
const collectionNames = args.map((obj) => obj.name);
417-
418394
fs.readFile(filepath, "utf-8", (err, data) => {
419395
if (err) {
420396
alert("An error ocurred reading the file :", err.message);
@@ -423,7 +399,6 @@ ipcMain.on("import-collection", (event, args) => {
423399

424400
// parse data, will throw error if not parsable
425401
let parsed;
426-
// parsed.name already exists
427402
try {
428403
parsed = JSON.parse(data);
429404
} catch {
@@ -447,13 +422,6 @@ ipcMain.on("import-collection", (event, args) => {
447422
dialog.showMessageBox(null, options);
448423
return;
449424
}
450-
// duplicate collection exists already
451-
if (collectionNames.includes(parsed.name)) {
452-
options.message = "That collection already exists in the app";
453-
options.detail = "Please rename file to something else";
454-
dialog.showMessageBox(null, options);
455-
return;
456-
}
457425
}
458426

459427
// send data to chromium for state update

0 commit comments

Comments
 (0)