test instance
This commit is contained in:
@@ -2,10 +2,14 @@ const { connect } = require('preact-redux');
|
||||
const preact = require('preact');
|
||||
const actions = require('../actions');
|
||||
|
||||
const testGame = require('./../test.game');
|
||||
const testInstance = require('./../test.instance');
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const {
|
||||
ws,
|
||||
account,
|
||||
instances,
|
||||
cryps,
|
||||
} = state;
|
||||
@@ -15,17 +19,36 @@ const addState = connect(
|
||||
}
|
||||
|
||||
return {
|
||||
account,
|
||||
instances,
|
||||
sendInstanceState,
|
||||
};
|
||||
},
|
||||
function receiveDispatch(dispatch) {
|
||||
function setTestGame(id) {
|
||||
return dispatch(actions.setGame(testGame(id)));
|
||||
}
|
||||
|
||||
function setTestInstance(id) {
|
||||
return dispatch(actions.setInstance(testInstance(id)));
|
||||
}
|
||||
|
||||
return {
|
||||
setTestGame,
|
||||
setTestInstance,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
function Nav(args) {
|
||||
const {
|
||||
account,
|
||||
sendInstanceState,
|
||||
instances,
|
||||
} = args;
|
||||
|
||||
setTestGame,
|
||||
setTestInstance,
|
||||
} = args;
|
||||
|
||||
const joined = instances.map((i, j) => (
|
||||
<button key={j} onClick={() => sendInstanceState(i)} >{i.name}</button>
|
||||
@@ -33,10 +56,17 @@ function Nav(args) {
|
||||
|
||||
return (
|
||||
<nav>
|
||||
<h2>Team</h2>
|
||||
<button>spawn</button>
|
||||
<button>select</button>
|
||||
<h2>Instances</h2>
|
||||
<button>list</button>
|
||||
<button>new</button>
|
||||
<hr />
|
||||
{joined}
|
||||
<h2>Hax</h2>
|
||||
<button onClick={() => setTestGame(account.id)}>Test Game</button>
|
||||
<button onClick={() => setTestInstance(account.id)}>Test Instance</button>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user