account apply
This commit is contained in:
@@ -4,11 +4,20 @@ const { connect } = require('preact-redux');
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const {
|
||||
ws,
|
||||
account,
|
||||
mtxActive,
|
||||
} = state;
|
||||
|
||||
function sendMtxAccountApply() {
|
||||
return ws.sendMtxAccountApply(mtxActive);
|
||||
}
|
||||
|
||||
return {
|
||||
account,
|
||||
mtxActive,
|
||||
|
||||
sendMtxAccountApply,
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -17,10 +26,13 @@ const addState = connect(
|
||||
function AccountBox(args) {
|
||||
const {
|
||||
account,
|
||||
mtxActive,
|
||||
|
||||
sendMtxAccountApply,
|
||||
} = args;
|
||||
|
||||
const imgStyle = account.img
|
||||
? { 'background-image': `url(/imgs/${account.img}.svg)` }
|
||||
? { 'background-image': `url(/imgs/${account.img}.svg)`, cursor: mtxActive ? 'pointer' : '' }
|
||||
: null;
|
||||
|
||||
// if (!isTop) {
|
||||
@@ -33,10 +45,20 @@ function AccountBox(args) {
|
||||
// );
|
||||
// }
|
||||
|
||||
const onClick = () => {
|
||||
if (!mtxActive) return false;
|
||||
return sendMtxAccountApply();
|
||||
};
|
||||
|
||||
return (
|
||||
<div class='player-box bottom'>
|
||||
<div class="msg"> </div>
|
||||
<div class="img avatar" id={account.img} style={imgStyle}></div>
|
||||
<div
|
||||
class="img avatar"
|
||||
id={account.img}
|
||||
onClick={onClick}
|
||||
style={imgStyle}>
|
||||
</div>
|
||||
<div class="name">{account.name}</div>
|
||||
<div class="score">0 MMR</div>
|
||||
</div>
|
||||
|
||||
@@ -150,6 +150,10 @@ function createSocket(events) {
|
||||
}
|
||||
}
|
||||
|
||||
function sendMtxAccountApply(mtx) {
|
||||
send(['MtxAccountApply', { mtx }]);
|
||||
}
|
||||
|
||||
function sendMtxBuy(mtx) {
|
||||
send(['MtxBuy', { mtx }]);
|
||||
}
|
||||
@@ -368,6 +372,7 @@ function createSocket(events) {
|
||||
sendSubscriptionState,
|
||||
sendSubscriptionEnding,
|
||||
|
||||
sendMtxAccountApply,
|
||||
sendMtxApply,
|
||||
sendMtxBuy,
|
||||
sendMtxConstructSpawn,
|
||||
|
||||
Reference in New Issue
Block a user