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.
30 lines
796 B
30 lines
796 B
import * as WelcomeActions from '../../actions/welcome/welcome.actions';
|
|
import * as ModeActions from '../../actions/mode.actions';
|
|
import SETTINGS from '../../AppSettings';
|
|
|
|
let dispatch;
|
|
|
|
const emptyScores = [
|
|
{ initials: "AAA", score: "0" },
|
|
{ initials: "AAA", score: "0" },
|
|
{ initials: "AAA", score: "0" },
|
|
{ initials: "AAA", score: "0" },
|
|
{ initials: "AAA", score: "0" },
|
|
];
|
|
|
|
const WelcomeCtrl = {
|
|
setDispatch: (d) => dispatch = d,
|
|
|
|
updateFromLocalStorage: () => {
|
|
const scores = localStorage.getItem(SETTINGS.LOCAL_STORAGE_KEY) || emptyScores;
|
|
dispatch(WelcomeActions.updateScores(scores));
|
|
},
|
|
|
|
keydown: (e) => {
|
|
if (e.keyCode === 32) {
|
|
dispatch(ModeActions.options());
|
|
}
|
|
}
|
|
};
|
|
|
|
export default WelcomeCtrl;
|
|
|