79 lines
1.7 KiB
JavaScript
79 lines
1.7 KiB
JavaScript
const { connect } = require('preact-redux');
|
|
|
|
const actions = require('../actions');
|
|
|
|
const Vbox = require('./vbox.component');
|
|
|
|
const addState = connect(
|
|
function receiveState(state) {
|
|
const {
|
|
ws,
|
|
instance,
|
|
player,
|
|
combiner,
|
|
reclaiming,
|
|
activeVar,
|
|
activeCryp,
|
|
info,
|
|
} = state;
|
|
|
|
function sendVboxDiscard() {
|
|
return ws.sendVboxDiscard(instance.id);
|
|
}
|
|
|
|
function sendVboxAccept(group, index) {
|
|
return ws.sendVboxAccept(instance.id, group, index);
|
|
}
|
|
|
|
function sendVboxCombine() {
|
|
return ws.sendVboxCombine(instance.id, combiner);
|
|
}
|
|
|
|
function sendVboxReclaim(i) {
|
|
return ws.sendVboxReclaim(instance.id, i);
|
|
}
|
|
|
|
return {
|
|
instance,
|
|
player,
|
|
combiner,
|
|
reclaiming,
|
|
activeVar,
|
|
activeCryp,
|
|
info,
|
|
sendVboxAccept,
|
|
sendVboxDiscard,
|
|
sendVboxReclaim,
|
|
sendVboxCombine,
|
|
};
|
|
},
|
|
|
|
function receiveDispatch(dispatch) {
|
|
function setCombiner(c) {
|
|
return dispatch(actions.setCombiner(c));
|
|
}
|
|
|
|
function setReclaiming(v) {
|
|
return dispatch(actions.setReclaiming(v));
|
|
}
|
|
|
|
function setInfo(type, info) {
|
|
return dispatch(actions.setInfo([type, info]));
|
|
}
|
|
|
|
function setActiveVar(v) {
|
|
return dispatch(actions.setActiveVar(v));
|
|
}
|
|
|
|
return {
|
|
setCombiner,
|
|
setReclaiming,
|
|
setInfo,
|
|
setActiveVar,
|
|
};
|
|
}
|
|
|
|
);
|
|
|
|
module.exports = addState(Vbox);
|