diff --git a/client/src/components/collection.jsx b/client/src/components/collection.jsx index c6441803..8a598b8a 100644 --- a/client/src/components/collection.jsx +++ b/client/src/components/collection.jsx @@ -56,7 +56,7 @@ function Collection(args) { teamSelect[insert] = id; return setTeam(teamSelect); } - console.log(constructs.length); + const dispConstructs = constructs.length >= ((teamPage + 1) * 6) ? constructs.slice(teamPage * 6, (teamPage + 1) * 6) : constructs.slice(teamPage * 6, constructs.length); diff --git a/client/src/components/main.jsx b/client/src/components/main.jsx index 8441782e..c312849d 100644 --- a/client/src/components/main.jsx +++ b/client/src/components/main.jsx @@ -11,8 +11,8 @@ const Bottom = require('./main.bottom'); const addState = connect( state => { - const { game, instance, account, nav } = state; - return { game, instance, account, nav }; + const { game, instance, account, nav, ws } = state; + return { game, instance, account, nav, ws }; } ); @@ -22,6 +22,7 @@ function Main(props) { instance, account, nav, + ws, } = props; if (!account) { diff --git a/client/src/events.jsx b/client/src/events.jsx index f2e5d498..e17c7bff 100644 --- a/client/src/events.jsx +++ b/client/src/events.jsx @@ -169,7 +169,7 @@ function registerEvents(store) { } function setInstance(v) { - const { account, instance } = store.getState(); + const { account, instance, ws } = store.getState(); if (v) { const player = v.players.find(p => p.id === account.id); store.dispatch(actions.setPlayer(player)); @@ -180,7 +180,11 @@ function registerEvents(store) { store.dispatch(actions.setActiveConstruct(first)); } } - if (v.phase === 'Finished') setGame(null); + if (v.phase === 'Finished') { + setGame(null); + ws.sendAccountState(); + } + return store.dispatch(actions.setInstance(v)); } diff --git a/client/src/socket.jsx b/client/src/socket.jsx index a6a97162..dd6049aa 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -43,8 +43,8 @@ function createSocket(events) { send(['AccountConstructs', {}]); } - function sendAccountInstances() { - send(['AccountInstances', {}]); + function sendAccountState() { + send(['AccountState', {}]); } function sendAccountSetTeam(ids) { @@ -323,7 +323,7 @@ function createSocket(events) { return { sendAccountConstructs, - sendAccountInstances, + sendAccountState, sendAccountSetTeam,