diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index fbe20c70..5b607603 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -102,7 +102,7 @@ nav h2 { nav hr { margin: 1em 0; - border-color: whitesmoke; + border-color: #444; } nav button { @@ -120,12 +120,12 @@ nav button.active { } nav button[disabled], nav button[disabled]:hover { - color: #333333; + color: #333; text-decoration: none; } nav button:hover { - color: #888; + color: whitesmoke; text-decoration: underline; } diff --git a/client/src/actions.jsx b/client/src/actions.jsx index 96ba0ef5..d47e552f 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -31,9 +31,11 @@ export const setShowLog = value => ({ type: 'SET_SHOW_LOG', value }); export const setShowNav = value => ({ type: 'SET_SHOW_NAV', value }); export const setSkip = value => ({ type: 'SET_SKIP', value }); export const setShop = value => ({ type: 'SET_SHOP', value }); -export const setTeam = value => ({ type: 'SET_SELECTED_CONSTRUCTS', value: Array.from(value) }); -export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value }); +export const setTeam = value => ({ type: 'SET_TEAM', value: Array.from(value) }); +export const setTeamSelect = value => ({ type: 'SET_TEAM_SELECT', value: Array.from(value) }); + +export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value }); export const setVboxSelected = value => ({ type: 'SET_VBOX_SELECTED', value }); export const setWs = value => ({ type: 'SET_WS', value }); diff --git a/client/src/components/team.footer.jsx b/client/src/components/team.footer.jsx index 7b28dd9e..db3bb077 100644 --- a/client/src/components/team.footer.jsx +++ b/client/src/components/team.footer.jsx @@ -5,26 +5,29 @@ const actions = require('./../actions'); const addState = connect( function receiveState(state) { - const { team, showNav } = state; + const { + teamSelect, + showNav, + ws, + } = state; + + function sendAccountSetTeam() { + return ws.sendAccountSetTeam(teamSelect); + } return { - team, + sendAccountSetTeam, + teamSelect, showNav, }; }, function receiveDispatch(dispatch) { - function navToList() { - dispatch(actions.setGame(null)); - dispatch(actions.setInstance(null)); - return dispatch(actions.setNav('list')); - } function setShowNav(v) { return dispatch(actions.setShowNav(v)); } return { - navToList, setShowNav, }; } @@ -33,20 +36,18 @@ const addState = connect( function TeamFooter(args) { const { showNav, - team, - navToList, + teamSelect, + sendAccountSetTeam, setShowNav, } = args; - if (!team) return false; - return ( ); diff --git a/client/src/components/team.jsx b/client/src/components/team.jsx index 749aebac..fa44db67 100644 --- a/client/src/components/team.jsx +++ b/client/src/components/team.jsx @@ -8,11 +8,9 @@ const { stringSort } = require('./../utils'); const SpawnButton = require('./spawn.button'); const { ConstructAvatar } = require('./construct'); -const idSort = stringSort('id'); - const addState = connect( function receiveState(state) { - const { ws, constructs, team } = state; + const { ws, constructs, teamSelect } = state; function sendConstructSpawn(name) { return ws.sendMtxConstructSpawn(name); @@ -20,27 +18,26 @@ const addState = connect( return { constructs, - team, + teamSelect, sendConstructSpawn, }; }, - function receiveDispatch(dispatch) { function setTeam(constructIds) { - localStorage.setItem('team', JSON.stringify(constructIds)); - dispatch(actions.setTeam(constructIds)); + dispatch(actions.setTeamSelect(constructIds)); } return { setTeam, }; } + ); function Team(args) { const { constructs, - team, + teamSelect, setTeam, sendConstructSpawn, } = args; @@ -51,27 +48,25 @@ function Team(args) { // so much for dumb components function selectConstruct(id) { // remove - const i = team.findIndex(sid => sid === id); + const i = teamSelect.findIndex(sid => sid === id); if (i > -1) { - team[i] = null; - return setTeam(team); + teamSelect[i] = null; + return setTeam(teamSelect); } // window insert - const insert = team.findIndex(j => j === null); + const insert = teamSelect.findIndex(j => j === null); if (insert === -1) return setTeam([id, null, null]); - team[insert] = id; - return setTeam(team); + teamSelect[insert] = id; + return setTeam(teamSelect); } const constructPanels = constructs.map(construct => { - const colour = team.indexOf(construct.id); + const colour = teamSelect.indexOf(construct.id); const selected = colour > -1; const borderColour = selected ? COLOURS[colour] : '#000000'; - - // return (