team ctrl
This commit is contained in:
parent
1dbf55991c
commit
832442a1e4
@ -5,7 +5,6 @@
|
|||||||
* stripe prod
|
* stripe prod
|
||||||
* mobile styles
|
* mobile styles
|
||||||
* pct based translates for combat animation
|
* pct based translates for combat animation
|
||||||
* info fix
|
|
||||||
* account page
|
* account page
|
||||||
* graphs n shit
|
* graphs n shit
|
||||||
* acp init
|
* acp init
|
||||||
|
|||||||
@ -3,6 +3,7 @@ const { connect } = require('preact-redux');
|
|||||||
|
|
||||||
const PlayerCtrl = require('./player.ctrl');
|
const PlayerCtrl = require('./player.ctrl');
|
||||||
const PlayCtrl = require('./play.ctrl');
|
const PlayCtrl = require('./play.ctrl');
|
||||||
|
const TeamCtrl = require('./team.ctrl');
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
@ -31,6 +32,7 @@ function Controls(args) {
|
|||||||
|
|
||||||
if (game || instance) return <PlayerCtrl />;
|
if (game || instance) return <PlayerCtrl />;
|
||||||
if (nav === 'play' || !nav) return <PlayCtrl />
|
if (nav === 'play' || !nav) return <PlayCtrl />
|
||||||
|
if (nav === 'team' || !nav) return <TeamCtrl />
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
42
client/src/components/team.ctrl.jsx
Normal file
42
client/src/components/team.ctrl.jsx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
const preact = require('preact');
|
||||||
|
const { connect } = require('preact-redux');
|
||||||
|
|
||||||
|
const actions = require('./../actions');
|
||||||
|
|
||||||
|
const addState = connect(
|
||||||
|
function receiveState(state) {
|
||||||
|
const {
|
||||||
|
teamSelect,
|
||||||
|
ws,
|
||||||
|
} = state;
|
||||||
|
|
||||||
|
function sendAccountSetTeam() {
|
||||||
|
return ws.sendAccountSetTeam(teamSelect);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
sendAccountSetTeam,
|
||||||
|
teamSelect,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
function TeamCtrl(args) {
|
||||||
|
const {
|
||||||
|
teamSelect,
|
||||||
|
sendAccountSetTeam,
|
||||||
|
} = args;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<aside>
|
||||||
|
<button
|
||||||
|
class='ready'
|
||||||
|
disabled={teamSelect.some(c => !c)}
|
||||||
|
onClick={sendAccountSetTeam}>
|
||||||
|
Set Team
|
||||||
|
</button>
|
||||||
|
</aside>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = addState(TeamCtrl);
|
||||||
Loading…
x
Reference in New Issue
Block a user