team update

This commit is contained in:
ntr 2019-07-30 13:25:06 +10:00
parent 3fcbedb5e3
commit 17c2c9708c
2 changed files with 3 additions and 20 deletions

View File

@ -4,22 +4,6 @@ const toast = require('izitoast');
const actions = require('./../actions'); const actions = require('./../actions');
const balanceError = () =>
toast.error({
theme: 'dark',
color: 'black',
timeout: false,
drag: false,
position: 'center',
maxWidth: window.innerWidth / 2,
close: false,
buttons: [
['<button type="submit">OK</button>',
(instance, thisToast) => instance.hide({ transitionOut: 'fadeOut' }, thisToast)],
],
message: 'Insufficient Balance',
});
const addState = connect( const addState = connect(
function receiveState(state) { function receiveState(state) {
const { const {
@ -40,8 +24,7 @@ const addState = connect(
}, },
function receiveDispatch(dispatch) { function receiveDispatch(dispatch) {
function setMtxActive(mtx, balance) { function setMtxActive(mtx) {
if (balance === 0) return balanceError();
dispatch(actions.setConstructRename(null)); dispatch(actions.setConstructRename(null));
dispatch(actions.setMtxActive(mtx)); dispatch(actions.setMtxActive(mtx));
return true; return true;
@ -64,7 +47,7 @@ function Inventory(args) {
if (!shop) return false; if (!shop) return false;
const useMtx = (item, i) => ( const useMtx = (item, i) => (
<figure key={i} onClick={() => setMtxActive(item, account.balance)} > <figure key={i} onClick={() => setMtxActive(item)} >
<figcaption>{item}</figcaption> <figcaption>{item}</figcaption>
<button>¤1</button> <button>¤1</button>
</figure> </figure>

View File

@ -184,7 +184,7 @@ impl Connection {
Ok(RpcMessage::ConstructSpawn(mtx::new_construct(&mut tx, account)?)), Ok(RpcMessage::ConstructSpawn(mtx::new_construct(&mut tx, account)?)),
RpcRequest::MtxConstructApply { mtx, construct_id, name } => RpcRequest::MtxConstructApply { mtx, construct_id, name } =>
Ok(RpcMessage::AccountConstructs(mtx::apply(&mut tx, account, mtx, construct_id, name)?)), Ok(RpcMessage::AccountTeam(mtx::apply(&mut tx, account, mtx, construct_id, name)?)),
RpcRequest::MtxBuy { mtx } => RpcRequest::MtxBuy { mtx } =>
Ok(RpcMessage::AccountShop(mtx::buy(&mut tx, account, mtx)?)), Ok(RpcMessage::AccountShop(mtx::buy(&mut tx, account, mtx)?)),