diff --git a/package-lock.json b/package-lock.json index e423553..1a6e5f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gimme-quote", - "version": "0.2.3", + "version": "0.2.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 280c0b0..c2af0b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gimme-quote", - "version": "0.2.3", + "version": "0.2.4", "description": "A minimal desktop app for getting your dose of famous quotes.", "main": "main.js", "scripts": { diff --git a/src/menu/components/category.js b/src/menu/components/category.js index 79b327b..a3cca18 100644 --- a/src/menu/components/category.js +++ b/src/menu/components/category.js @@ -36,11 +36,11 @@ const menuItem = new MenuItem({ checked: isChecked('inspirational') }, { - id: 'movies', - label: 'Movies', + id: 'movie', + label: 'Movie', type: 'checkbox', click: updateCategory, - checked: isChecked('movies') + checked: isChecked('movie') }, { id: 'programming', diff --git a/src/menu/menu.js b/src/menu/menu.js index 0963c1e..c59438c 100644 --- a/src/menu/menu.js +++ b/src/menu/menu.js @@ -17,11 +17,12 @@ const clearSchedule = () => clearInterval(intervalId); const showQuote = () => { const { quote, author, year } = quoteService.getRandom(store.getState().category); + if (!quote) return; (new Notification({ title: author, body: quote, subtitle: year, - silent: store.getState().silent + silent: store.getState().silent, })).show(); }; diff --git a/src/quoteService.js b/src/quoteService.js index 9b0b2cf..9500a5b 100644 --- a/src/quoteService.js +++ b/src/quoteService.js @@ -36,7 +36,7 @@ exports.getRandom = categories => { } logger.log('Remaining quotes', remainingQuotes); const randomIndex = Math.floor(Math.random() * (remainingQuotes.length - 1)); - const randomQuote = remainingQuotes[randomIndex]; + const randomQuote = remainingQuotes[randomIndex] ? remainingQuotes[randomIndex] : {}; remainingQuotes.splice(randomIndex, 1); logger.info('Returning random quote', randomQuote); return randomQuote;