57 lines
1.2 KiB
JavaScript
57 lines
1.2 KiB
JavaScript
const preact = require('preact');
|
|
const { connect } = require('preact-redux');
|
|
|
|
const actions = require('./../actions');
|
|
|
|
const addState = connect(
|
|
function receiveState(state) {
|
|
const {
|
|
teamSelect,
|
|
showNav,
|
|
ws,
|
|
} = state;
|
|
|
|
function sendAccountSetTeam() {
|
|
return ws.sendAccountSetTeam(teamSelect);
|
|
}
|
|
|
|
return {
|
|
sendAccountSetTeam,
|
|
teamSelect,
|
|
showNav,
|
|
};
|
|
},
|
|
function receiveDispatch(dispatch) {
|
|
|
|
function setShowNav(v) {
|
|
return dispatch(actions.setShowNav(v));
|
|
}
|
|
|
|
return {
|
|
setShowNav,
|
|
};
|
|
}
|
|
);
|
|
|
|
function TeamFooter(args) {
|
|
const {
|
|
showNav,
|
|
teamSelect,
|
|
sendAccountSetTeam,
|
|
setShowNav,
|
|
} = args;
|
|
|
|
return (
|
|
<footer>
|
|
<button id="nav-btn" onClick={() => setShowNav(!showNav)} >☰</button>
|
|
<button
|
|
disabled={teamSelect.some(c => !c)}
|
|
onClick={sendAccountSetTeam}>
|
|
Set Team
|
|
</button>
|
|
</footer>
|
|
);
|
|
}
|
|
|
|
module.exports = addState(TeamFooter);
|