diff --git a/client/index.html b/client/index.html index 77fe1f70..ebe141f8 100644 --- a/client/index.html +++ b/client/index.html @@ -10,8 +10,8 @@ - - + + diff --git a/client/src/actions.jsx b/client/src/actions.jsx index cfd94ee6..6324b9e0 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -7,6 +7,7 @@ export const setInstances = value => ({ type: 'SET_INSTANCES', value }); export const setNav = value => ({ type: 'SET_NAV', value }); export const setShowNav = value => ({ type: 'SET_SHOW_NAV', value }); export const setInstance = value => ({ type: 'SET_INSTANCE', value }); +export const setInstanceList = value => ({ type: 'SET_INSTANCE_LIST', value }); export const setPing = value => ({ type: 'SET_PING', value }); export const setPlayer = value => ({ type: 'SET_PLAYER', value }); export const setGame = value => ({ type: 'SET_GAME', value }); diff --git a/client/src/components/list.jsx b/client/src/components/list.jsx index 203b7789..d30bff7d 100644 --- a/client/src/components/list.jsx +++ b/client/src/components/list.jsx @@ -9,7 +9,7 @@ const idSort = stringSort('id'); const addState = connect( function receiveState(state) { - const { ws, constructs, team, instances, account } = state; + const { ws, constructs, team, instanceList, account } = state; function sendInstanceJoin(instance) { if (team.length) { @@ -33,7 +33,7 @@ const addState = connect( sendInstanceJoin, sendInstanceState, sendInstanceList, - instances, + instanceList, }; }, @@ -55,14 +55,14 @@ function List(args) { sendInstanceState, sendInstanceJoin, sendInstanceList, - instances, + instanceList, navToTeam, } = args; - function instanceList() { - if (!instances) return
...
; + function listElements() { + if (!instanceList) return
...
; - const instancePanels = instances.map(instance => { + const instancePanels = instanceList.map(instance => { const player = instance.players.find(p => p.id === account.id); const scoreText = player ? `${player.score.wins} : ${player.score.losses}` @@ -110,11 +110,7 @@ function List(args) { const constructPanels = constructs .filter(c => team.includes(c.id)) .sort(idSort) - .map(construct => { - const colour = team.indexOf(construct.id); - const selected = colour > -1; - - return ( + .map(construct =>
@@ -122,7 +118,6 @@ function List(args) {

{construct.name}

); - }); const header = (
@@ -141,7 +136,7 @@ function List(args) {
{constructPanels}
- {instanceList()} + {listElements()} ); } diff --git a/client/src/components/nav.jsx b/client/src/components/nav.jsx index 80d4241f..6fed6645 100644 --- a/client/src/components/nav.jsx +++ b/client/src/components/nav.jsx @@ -13,7 +13,7 @@ const addState = connect( account, instances, team, - constructs, + // constructs, game, } = state; @@ -25,14 +25,18 @@ const addState = connect( return ws.sendAccountInstances(); } + function sendInstanceList() { + return ws.sendInstanceList(); + } + return { account, instances, team, - constructs, game, sendInstanceState, sendAccountInstances, + sendInstanceList, }; }, function receiveDispatch(dispatch) { @@ -77,9 +81,9 @@ function Nav(args) { account, sendInstanceState, sendAccountInstances, + sendInstanceList, team, - constructs, instances, game, @@ -90,7 +94,10 @@ function Nav(args) { } = args; function navTo(p) { - if (p === 'list') sendAccountInstances(); + if (p === 'list') { + sendInstanceList(); + sendAccountInstances(); + } return setNav(p); } @@ -104,14 +111,6 @@ function Nav(args) { )); - const teamElements = team.map((c, i) => { - if (c) { - const construct = constructs.find(f => f.id === c); - return ; - } - return ; - }); - const haxSection = process.env.NODE_ENV === 'development' ? ( @@ -121,13 +120,12 @@ function Nav(args) { ) : null; + const canJoin = team.some(c => !c); + return (