diff --git a/client/assets/styles/styles.less b/client/assets/styles/styles.less index f44ab217..fd34a948 100644 --- a/client/assets/styles/styles.less +++ b/client/assets/styles/styles.less @@ -426,6 +426,10 @@ header { justify-content: center; } +.spawn-btn.menu-construct.selected { + color: whitesmoke; +} + .spawn-btn.menu-construct:hover { border: 1px solid whitesmoke; } @@ -437,7 +441,7 @@ header { } .spawn-btn button { - flex: 1; + flex: 1 1 100%; margin: 0.5em 1em; padding: 0 0.5em; } diff --git a/client/src/components/account.status.jsx b/client/src/components/account.status.jsx index 69544435..025022b9 100644 --- a/client/src/components/account.status.jsx +++ b/client/src/components/account.status.jsx @@ -4,6 +4,7 @@ const { Elements, injectStripe } = require('react-stripe-elements'); const { saw } = require('./shapes'); const { postData } = require('./../utils'); +const actions = require('../actions'); function pingColour(ping) { if (ping < 100) return 'forestgreen'; @@ -67,6 +68,7 @@ const addState = connect( ping, } = state; + function logout() { postData('/logout').then(() => window.location.reload(true)); } @@ -77,6 +79,14 @@ const addState = connect( logout, }; }, + function receiveDispatch(dispatch) { + function selectConstructs() { + return dispatch(actions.setNav('team')); + } + return { + selectConstructs, + }; + } ); @@ -85,6 +95,7 @@ function AccountStatus(args) { account, ping, logout, + selectConstructs, } = args; if (!account) return null; @@ -100,6 +111,7 @@ function AccountStatus(args) { + ); diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index 21e090e7..39f41db6 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -4,7 +4,7 @@ const { connect } = require('preact-redux'); const Vbox = require('./vbox.component'); const InfoContainer = require('./info.container'); const InstanceConstructsContainer = require('./instance.constructs'); -const EquipmentContainer = require('./instance.equip'); +// const EquipmentContainer = require('./instance.equip'); const ScoreBoard = require('./scoreboard'); const actions = require('../actions'); diff --git a/client/src/components/spawn.button.jsx b/client/src/components/spawn.button.jsx index e6518861..c41bcf4b 100644 --- a/client/src/components/spawn.button.jsx +++ b/client/src/components/spawn.button.jsx @@ -24,24 +24,18 @@ class SpawnButton extends Component { } enable() { - this.setState({ enabled: true }); + this.setState({ enabled: !this.state.enabled }); } render() { + const selected = this.state.enabled ? 'selected' : ''; return ( ); } diff --git a/client/src/components/team.jsx b/client/src/components/team.jsx index 0ae96c16..d357a0bb 100644 --- a/client/src/components/team.jsx +++ b/client/src/components/team.jsx @@ -12,22 +12,16 @@ const idSort = stringSort('id'); const addState = connect( function receiveState(state) { - const { ws, constructs, team, constructDeleteId } = state; + const { ws, constructs, team } = state; function sendConstructSpawn(name) { return ws.sendConstructSpawn(name); } - function sendConstructDelete(id) { - return ws.sendConstructDelete(id); - } - return { constructs, - constructDeleteId, team, sendConstructSpawn, - sendConstructDelete, }; }, @@ -37,13 +31,8 @@ const addState = connect( dispatch(actions.setTeam(constructIds)); } - function setDeleteId(id) { - dispatch(actions.setConstructDeleteId(id)); - } - return { setTeam, - setDeleteId, }; } ); @@ -52,13 +41,8 @@ function Team(args) { const { constructs, team, - constructDeleteId, - setTeam, sendConstructSpawn, - sendConstructDelete, - - setDeleteId, } = args; if (!constructs) return
; @@ -86,11 +70,6 @@ function Team(args) { const borderColour = selected ? COLOURS[colour] : '#000000'; - function deleteClick(e) { - e.stopPropagation(); - if (constructDeleteId === construct.id) return sendConstructDelete(construct.id); - return setDeleteId(construct.id); - } // return ( @@ -101,9 +80,8 @@ function Team(args) { onClick={() => selectConstruct(construct.id)} >

- {constructDeleteId === construct.id ? 'Confirm delete...' : construct.name} + {construct.name}

-
@@ -113,10 +91,10 @@ function Team(args) { const spawnButtonsNum = (3 - constructs.length % 3); const spawnButtons = range(spawnButtonsNum) - .map(i => sendConstructSpawn(name)} />); + .map(i => sendConstructSpawn()} />); return ( -
setDeleteId(null)}> +
{constructPanels} {spawnButtons}
diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx index fb1b119a..1ebbaa9e 100644 --- a/client/src/components/vbox.component.jsx +++ b/client/src/components/vbox.component.jsx @@ -242,7 +242,7 @@ function Vbox(args) { class='vbox-btn' onMouseOver={e => hoverInfo(e, 'refill')} onClick={() => sendVboxDiscard()}> - refill - 5b + refill - 2b ); diff --git a/server/src/player.rs b/server/src/player.rs index 496b4c21..0c123143 100644 --- a/server/src/player.rs +++ b/server/src/player.rs @@ -12,7 +12,7 @@ use vbox::{Vbox}; use item::{Item, ItemEffect}; use effect::{Effect}; -const DISCARD_COST: u16 = 5; +const DISCARD_COST: u16 = 2; #[derive(Debug,Clone,Serialize,Deserialize)] pub struct Player {