diff --git a/client/src/events.jsx b/client/src/events.jsx index fab4ee32..4c4aeed0 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -1,4 +1,3 @@ -const toast = require('izitoast'); const eachSeries = require('async/eachSeries'); const actions = require('./actions'); @@ -31,6 +30,8 @@ function registerEvents(store) { } store.dispatch(actions.setConstructs(constructs)); + // Now that constructs have been set we can switch to list + setNav('list'); } function setInstanceList(list) { @@ -158,7 +159,7 @@ function registerEvents(store) { } function setInstance(v) { - const { account, ws, instance } = store.getState(); + const { account, instance } = store.getState(); if (v) { const player = v.players.find(p => p.id === account.id); store.dispatch(actions.setPlayer(player)); @@ -176,6 +177,11 @@ function registerEvents(store) { return store.dispatch(actions.setItemInfo(v)); } + const team = JSON.parse(localStorage.getItem('team')); + if (team && team.every(t => t)) { + store.dispatch(actions.setTeam(team)); + } + // events.on('SET_PLAYER', setInstance); // events.on('SEND_SKILL', function skillActive(gameId, constructId, targetConstructId, skill) { @@ -190,14 +196,7 @@ function registerEvents(store) { // return setConstructs(constructs); // }); - const errMessages = { - select_constructs: 'Select your constructs before battle using the numbered buttons next to the construct avatar', - complete_nodes: 'You need to complete the previously connected nodes first', - max_skills: 'Your construct can only learn a maximum of 4 skills', - - }; - - function errorPrompt(type) { + /* function errorPrompt(type) { const message = errMessages[type]; const OK_BUTTON = ''; toast.error({ @@ -213,14 +212,8 @@ function registerEvents(store) { ], message, }); - } - + } */ // setup / localstorage - const team = JSON.parse(localStorage.getItem('team')); - if (team && team.every(t => t)) { - setTeam(team); - setNav('list'); - } return { clearCombiner, @@ -228,7 +221,6 @@ function registerEvents(store) { clearInfo, clearInstance, clearMtxActive, - errorPrompt, setAccount, setAccountInstances, setActiveItem, diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index 22c45295..f7979e6f 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -36,7 +36,7 @@ module.exports = { itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'), itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'), mtxActive: createReducer(null, 'SET_MTX_ACTIVE'), - nav: createReducer('team', 'SET_NAV'), + nav: createReducer(null, 'SET_NAV'), showNav: createReducer(null, 'SET_SHOW_NAV'), ping: createReducer(null, 'SET_PING'), player: createReducer(null, 'SET_PLAYER'),