Skip to content

Commit

Permalink
Merge pull request #17 from robinmitra/update-category
Browse files Browse the repository at this point in the history
Update 'movies' category key to be 'movie'.
  • Loading branch information
robinmitra authored Jun 23, 2019
2 parents 38f5d5b + 2187824 commit 3951fbc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions src/menu/components/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion src/menu/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};

Expand Down
2 changes: 1 addition & 1 deletion src/quoteService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3951fbc

Please sign in to comment.