default view games list
This commit is contained in:
@@ -3,6 +3,7 @@ const preact = require('preact');
|
||||
const { Elements, injectStripe } = require('react-stripe-elements');
|
||||
|
||||
const { saw } = require('./shapes');
|
||||
const { postData } = require('./../utils');
|
||||
|
||||
function pingColour(ping) {
|
||||
if (ping < 100) return 'forestgreen';
|
||||
|
||||
@@ -21,8 +21,6 @@ function Main(props) {
|
||||
instance,
|
||||
account,
|
||||
nav,
|
||||
team,
|
||||
constructs,
|
||||
} = props;
|
||||
|
||||
if (!account) {
|
||||
@@ -37,7 +35,7 @@ function Main(props) {
|
||||
return <Instance />;
|
||||
}
|
||||
|
||||
if (nav === 'team' || !team.some(t => t) || constructs.length < 3) return <Team />;
|
||||
if (nav === 'team') return <Team />;
|
||||
if (nav === 'list') return <List />;
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,6 +3,7 @@ const preact = require('preact');
|
||||
const { Fragment } = require('preact');
|
||||
|
||||
const { postData } = require('../utils');
|
||||
console.log(postData);
|
||||
const actions = require('../actions');
|
||||
const AccountStatus = require('./account.status');
|
||||
|
||||
@@ -33,10 +34,6 @@ const addState = connect(
|
||||
return ws.sendInstanceList();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
postData('/logout').then(() => window.location.reload(true));
|
||||
}
|
||||
|
||||
return {
|
||||
account,
|
||||
instances,
|
||||
@@ -46,7 +43,6 @@ const addState = connect(
|
||||
sendInstanceState,
|
||||
sendAccountInstances,
|
||||
sendInstanceList,
|
||||
logout,
|
||||
};
|
||||
},
|
||||
function receiveDispatch(dispatch) {
|
||||
@@ -142,7 +138,6 @@ function Nav(args) {
|
||||
<h1 class="header-title">mnml.gg</h1>
|
||||
<AccountStatus />
|
||||
<hr />
|
||||
<button onClick={() => navTo('team')}>Select Team</button>
|
||||
<button disabled={canJoin} onClick={() => navTo('list')}>Play</button>
|
||||
<hr />
|
||||
{joined}
|
||||
|
||||
@@ -33,7 +33,12 @@ function registerEvents(store) {
|
||||
// check team is in list
|
||||
const { team } = store.getState();
|
||||
const ids = constructs.map(c => c.id);
|
||||
if (!team.every(t => t && ids.includes(t))) store.dispatch(actions.setTeam([null, null, null]));
|
||||
|
||||
// team is fucked up, or just registered
|
||||
// reset to the first 3 constructs
|
||||
if (!team.every(t => t && ids.includes(t))) {
|
||||
store.dispatch(actions.setTeam([ids[0], ids[1], ids[2]]));
|
||||
}
|
||||
|
||||
store.dispatch(actions.setConstructs(constructs));
|
||||
}
|
||||
|
||||
@@ -221,9 +221,7 @@ function createSocket(events) {
|
||||
};
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem('account');
|
||||
account = null;
|
||||
event.setAccount(null);
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
function errHandler(error) {
|
||||
|
||||
Reference in New Issue
Block a user