Revert "wip"

This reverts commit 90254f8294987ea202b26941b4d9411fc407dc60.
This commit is contained in:
ntr 2019-12-24 10:36:45 +10:00
parent 4193b71853
commit 1bbaede2a6
7 changed files with 13 additions and 66 deletions

View File

@ -174,19 +174,3 @@ section {
} }
} }
.vbox {
.login {
display: flex;
flex-flow: column;
label {
line-height: initial;
}
.terms {
display: inline;
margin: 0 1em;
}
}
}

View File

@ -164,7 +164,7 @@
// portrait menu or small size vertical in landscape // portrait menu or small size vertical in landscape
@media (max-width: 550px) and (max-height: 800px) and (orientation: portrait) { @media (max-width: 550px) and (max-height: 800px) {
#mnml { #mnml {
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: 1fr; grid-template-rows: 1fr;

View File

@ -4,7 +4,6 @@ const { Component } = require('preact')
const { connect } = require('preact-redux'); const { connect } = require('preact-redux');
const linkState = require('linkstate').default; const linkState = require('linkstate').default;
const actions = require('./../actions');
const { postData, errorToast } = require('../utils'); const { postData, errorToast } = require('../utils');
const addState = connect( const addState = connect(
@ -27,29 +26,18 @@ const addState = connect(
submitLogin, submitLogin,
} }
}, },
function receiveDispatch(dispatch) {
function clearInstance(user) {
dispatch(actions.setInstance(null));
}
return {
clearInstance,
}
}
); );
function Login(args) { function Login(args) {
const { const {
submitLogin, submitLogin,
clearInstance,
} = args; } = args;
const { password, name } = this.state; const { password, name } = this.state;
const loginSubmit = (event) => { const loginSubmit = (event) => {
event.preventDefault(); event.preventDefault();
clearInstance();
submitLogin(name, password); submitLogin(name, password);
this.setState({ name: '', password: '' }); this.setState({ name: '', password: '' });
}; };

View File

@ -27,6 +27,7 @@ function registerEvents(store) {
function clearTutorial() { function clearTutorial() {
store.dispatch(actions.setTutorial(null)); store.dispatch(actions.setTutorial(null));
localStorage.setItem('tutorial-complete', true);
} }
@ -34,6 +35,7 @@ function registerEvents(store) {
store.dispatch(actions.setTutorialGame(null)); store.dispatch(actions.setTutorialGame(null));
} }
function setPing(ping) { function setPing(ping) {
store.dispatch(actions.setPing(ping)); store.dispatch(actions.setPing(ping));
} }
@ -177,13 +179,17 @@ function registerEvents(store) {
const player = v.players.find(p => p.id === account.id); const player = v.players.find(p => p.id === account.id);
store.dispatch(actions.setPlayer(player)); store.dispatch(actions.setPlayer(player));
if (tutorial) tutorialVbox(player, store, tutorial);
if (v.phase === 'Finished') { if (v.phase === 'Finished') {
ws.sendAccountInstances(); ws.sendAccountInstances();
} }
}
// instance.mobile.less hides info at @media 1000
if (localStorage.getItem('tutorial-complete') || window.innerWidth <= 1100) {
store.dispatch(actions.setTutorial(null));
} else if (v.time_control === 'Practice' && v.rounds.length === 1 && tutorial) {
tutorialVbox(player, store, tutorial);
}
}
return store.dispatch(actions.setInstance(v)); return store.dispatch(actions.setInstance(v));
} }
@ -208,11 +214,6 @@ function registerEvents(store) {
return true; return true;
} }
function startTutorial() {
store.dispatch(actions.setTutorial(1));
}
window.addEventListener('hashchange', urlHashChange, false); window.addEventListener('hashchange', urlHashChange, false);
return { return {
@ -242,8 +243,6 @@ function registerEvents(store) {
setSubscription, setSubscription,
setWs, setWs,
startTutorial,
urlHashChange, urlHashChange,
notify, notify,

View File

@ -299,8 +299,6 @@ function createSocket(events) {
ChatWheel: wheel => events.setChatWheel(wheel), ChatWheel: wheel => events.setChatWheel(wheel),
// Joining: () => events.notify('Searching for instance...'), // Joining: () => events.notify('Searching for instance...'),
StartTutorial: () => events.startTutorial(),
Processing: () => true, Processing: () => true,
Error: errHandler, Error: errHandler,
}; };

View File

@ -1,8 +1,6 @@
const preact = require('preact'); const preact = require('preact');
const actions = require('./actions'); const actions = require('./actions');
const Login = require('./components/welcome.login');
function tutorialConstructDisplay(player, instance, tutorial, i) { function tutorialConstructDisplay(player, instance, tutorial, i) {
if (instance.time_control === 'Practice' && instance.rounds.length === 1 && tutorial && tutorial < 6) { if (instance.time_control === 'Practice' && instance.rounds.length === 1 && tutorial && tutorial < 6) {
if (tutorial <= 2 || (tutorial > 2 && i > 0)) { if (tutorial <= 2 || (tutorial > 2 && i > 0)) {
@ -29,7 +27,6 @@ function tutorialVbox(player, store, tutorial) {
for (let i = 2; i < 6; i += 1) { for (let i = 2; i < 6; i += 1) {
delete vbox.store.Colours[i]; delete vbox.store.Colours[i];
} }
vbox.store.Colours = {};
vbox.store.Skills = {}; vbox.store.Skills = {};
vbox.store.Specs = {}; vbox.store.Specs = {};
delete vbox.stash[0]; delete vbox.stash[0];
@ -115,21 +112,6 @@ function tutorialStage(tutorial, clearTutorial, instance) {
const exit = () => clearTutorial(); const exit = () => clearTutorial();
const tutorialText = () => { const tutorialText = () => {
if (tutorial === 1) {
return (
<div>
<div class='logo login-btn'> &nbsp; </div>
<p> MNML is a turn-based 1v1 strategy game in an abstract setting. </p>
<p>
Build a unique team of 3 constructs from a range of skills and specialisations.<br />
Outplay your opponent in multiple rounds by adapting to an always shifting meta. <br />
Simple rules, complex interactions and unique mechanics.<br />
</p>
<Login />
</div>
);
}
if (tutorial === 1) { if (tutorial === 1) {
return ( return (
<div class='info-item'> <div class='info-item'>
@ -238,14 +220,12 @@ function tutorialStage(tutorial, clearTutorial, instance) {
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
onMouseDown={exit}> {text} </button>; onMouseDown={exit}> {text} </button>;
// <figure>
// {exitTutorial}
// </figure>
return ( return (
<div class='tutorial'> <div class='tutorial'>
{tutorialText()} {tutorialText()}
<figure>
{exitTutorial}
</figure>
</div>); </div>);
} }

View File

@ -60,8 +60,6 @@ pub enum RpcMessage {
EmailState(Option<Email>), EmailState(Option<Email>),
SubscriptionState(Option<Subscription>), SubscriptionState(Option<Subscription>),
StartTutorial(()),
Pong(()), Pong(()),
QueueRequested(()), QueueRequested(()),