diff --git a/WORKLOG.md b/WORKLOG.md index ec2dffd3..9b677b19 100644 --- a/WORKLOG.md +++ b/WORKLOG.md @@ -46,6 +46,9 @@ locaalstorage team remove rounds consolidate game and instance +do not allow vbox actions for finished instances + cause of logging + *SERVER* * std game mode diff --git a/client/src/components/list.jsx b/client/src/components/list.jsx index efcf3534..092aacab 100644 --- a/client/src/components/list.jsx +++ b/client/src/components/list.jsx @@ -24,7 +24,7 @@ const addState = connect( } function sendInstanceList() { - return ws.sendAccountInstances(); + return ws.sendInstanceList(); } return { diff --git a/client/src/components/main.jsx b/client/src/components/main.jsx index 2c418847..59747677 100644 --- a/client/src/components/main.jsx +++ b/client/src/components/main.jsx @@ -10,8 +10,8 @@ const List = require('./list'); const addState = connect( state => { - const { game, instance, account, nav } = state; - return { game, instance, account, nav }; + const { game, instance, account, nav, team } = state; + return { game, instance, account, nav, team }; } ); @@ -21,6 +21,7 @@ function Main(props) { instance, account, nav, + team, } = props; if (!account) { @@ -35,8 +36,8 @@ function Main(props) { return ; } - if (nav === 'team') return ; if (nav === 'list') return ; + if (nav === 'team' || !team.some(t => t)) return ; return (
diff --git a/client/src/components/team.jsx b/client/src/components/team.jsx index 294e8dc5..7f4b182d 100644 --- a/client/src/components/team.jsx +++ b/client/src/components/team.jsx @@ -27,6 +27,7 @@ const addState = connect( function receiveDispatch(dispatch) { function setTeam(constructIds) { + localStorage.setItem('team', JSON.stringify(constructIds)); dispatch(actions.setTeam(constructIds)); } diff --git a/client/src/events.jsx b/client/src/events.jsx index 5e13ac46..2e819361 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -11,6 +11,8 @@ function registerEvents(store) { store.subscribe(() => { const { game, instance, constructs, ws } = store.getState(); + if (!ws) return true; + if (!game) ws.clearGameStateTimeout(); if (!instance) ws.clearInstanceStateTimeout(); }); @@ -19,6 +21,15 @@ function registerEvents(store) { store.dispatch(actions.setPing(ping)); } + function setTeam(team) { + localStorage.setItem('team', JSON.stringify(team)); + store.dispatch(actions.setTeam(team)); + } + + function setNav(v) { + store.dispatch(actions.setNav(v)); + } + function setConstructs(constructs) { console.log('EVENT ->', 'constructs', constructs); } @@ -190,6 +201,13 @@ function registerEvents(store) { }); } + // setup / localstorage + const team = JSON.parse(localStorage.getItem('team')); + if (team && team.every(t => t)) { + setTeam(team); + setNav('list'); + } + return { errorPrompt, clearCombiner,