You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
1.3 KiB

import * as MessageActions from '../actions/board/message.actions';
const positives = [
'All finished!',
'Boom!',
'Capital!',
'Congratulations!',
'Great job!',
'Huzzah!',
'Hooray!',
'Hot dog!',
'Marvelous!',
'Nice work!',
'Shazam!',
'Spot on!',
'Whee!',
'Wonderful!',
'Woohoo!',
'Yippee!'
];
const negatives = [
'Cripes!',
'Darn it!',
'Doggone it!',
'Drat!',
'Fiddlesticks!',
'Good grief!',
'Oh dear!',
'Oh no!',
'Rats!',
'Shazbot!',
'Shoot!',
'Shucks!',
'Too bad!',
'Uh oh!'
];
let dispatch;
let show = false;
const MessageCtrl = {
setDispatch: (d) => dispatch = d,
hide: () => {
show = false;
dispatch(MessageActions.hide());
},
show: (msg) => {
show = true;
dispatch(MessageActions.show(`${msg}`));
},
goodNews: (msg) => {
show = true;
const exclaim = positives[Math.floor(positives.length * Math.random())];
dispatch(MessageActions.show(`${exclaim} ${msg}`));
},
badNews: (msg) => {
show = true;
const exclaim = negatives[Math.floor(negatives.length * Math.random())];
dispatch(MessageActions.show(`${exclaim} ${msg}`));
},
isShowing: () => show
};
export default MessageCtrl;