auto ready for learn mode and remove upkeep warnings
This commit is contained in:
@@ -49,6 +49,11 @@ function InstanceCtrlBtns(args) {
|
||||
|
||||
const finished = instance && instance.phase === 'Finished';
|
||||
|
||||
const skip = instance.time_control === 'Practice' && instance.phase === 'Lobby';
|
||||
if (skip) {
|
||||
sendReady();
|
||||
}
|
||||
|
||||
return (
|
||||
<div class="instance-ctrl-btns">
|
||||
<button disabled={!account.subscribed} onClick={() => setChatShow(!chatShow)}>Chat</button>
|
||||
|
||||
@@ -209,7 +209,6 @@ function registerEvents(store) {
|
||||
return store.dispatch(actions.setInvite(code));
|
||||
}
|
||||
|
||||
let autoReady = null;
|
||||
function setInstance(v) {
|
||||
const { account, instance, ws, tutorial } = store.getState();
|
||||
if (v) {
|
||||
@@ -218,25 +217,10 @@ function registerEvents(store) {
|
||||
const player = v.players.find(p => p.id === account.id);
|
||||
store.dispatch(actions.setPlayer(player));
|
||||
|
||||
if (!instance || v.id !== instance.id) {
|
||||
clearTimeout(autoReady);
|
||||
}
|
||||
|
||||
if (v.phase === 'Finished') {
|
||||
ws.sendAccountInstances();
|
||||
}
|
||||
|
||||
if (v.phase_end && v.phase === 'Lobby' && !autoReady) {
|
||||
const skip = v.time_control === 'Practice' ? 10000 : 2000;
|
||||
const autoReadyDelay = Date.parse(v.phase_end) - Date.now() - skip;
|
||||
autoReady = setTimeout(() => {
|
||||
ws.sendInstanceReady(v.id);
|
||||
autoReady = null;
|
||||
}, autoReadyDelay);
|
||||
}
|
||||
|
||||
if (v.phase !== 'Lobby') clearTimeout(autoReady);
|
||||
|
||||
// instance.mobile.less hides info at @media 1000
|
||||
if (localStorage.getItem('tutorial-complete') || window.innerWidth <= 1100) {
|
||||
store.dispatch(actions.setTutorial(null));
|
||||
|
||||
Reference in New Issue
Block a user