tutorial client fixes
This commit is contained in:
parent
8bf6f714fd
commit
d11b7dcdb3
@ -5,8 +5,8 @@ const { tutorialStage } = require('../tutorial.utils');
|
||||
const { genItemInfo } = require('./vbox.utils');
|
||||
|
||||
const addState = connect(
|
||||
({ info, player, tutorial, vboxInfo, itemInfo, instance, comboPreview }) => ({
|
||||
info, player, tutorial, vboxInfo, itemInfo, instance, comboPreview,
|
||||
({ info, player, tutorial, vboxInfo, itemInfo, instance, comboPreview, authenticated }) => ({
|
||||
info, player, tutorial, vboxInfo, itemInfo, instance, comboPreview, authenticated
|
||||
}));
|
||||
|
||||
|
||||
@ -35,12 +35,13 @@ class Info extends preact.Component {
|
||||
itemInfo,
|
||||
instance,
|
||||
comboPreview,
|
||||
authenticated,
|
||||
} = props;
|
||||
|
||||
// dispaly priority
|
||||
// tutorial -> comboPreview -> vboxInfo -> info
|
||||
if (tutorial) {
|
||||
const tutorialStageInfo = tutorialStage(tutorial, clearTutorial, instance);
|
||||
const tutorialStageInfo = tutorialStage(authenticated, tutorial, clearTutorial, instance);
|
||||
if (tutorialStageInfo) return tutorialStageInfo;
|
||||
}
|
||||
if (comboPreview) return genItemInfo(comboPreview, itemInfo, player);
|
||||
|
||||
@ -185,7 +185,7 @@ function registerEvents(store) {
|
||||
const player = v.players.find(p => p.id === account.id);
|
||||
store.dispatch(actions.setPlayer(player));
|
||||
|
||||
if (tutorial) tutorialVbox(player, store, tutorial);
|
||||
if (tutorial && process.env.NODE_ENV !== 'development') tutorialVbox(player, store, tutorial);
|
||||
|
||||
if (v.phase === 'Finished') {
|
||||
ws.sendAccountInstances();
|
||||
|
||||
@ -53,7 +53,7 @@ module.exports = {
|
||||
teamPage: createReducer(0, 'SET_TEAM_PAGE'),
|
||||
teamSelect: createReducer([null, null, null], 'SET_TEAM_SELECT'),
|
||||
|
||||
tutorial: createReducer(localStorage.getItem('tutorial-complete') ? null : 1, 'SET_TUTORIAL'),
|
||||
tutorial: createReducer(1, 'SET_TUTORIAL'),
|
||||
|
||||
vboxSelected: createReducer({ storeSelect: [], stashSelect: [] }, 'SET_VBOX_SELECTED'),
|
||||
vboxCombiner: createReducer(null, 'SET_VBOX_COMBINER'),
|
||||
|
||||
@ -106,7 +106,7 @@ function tutorialVbox(player, store, tutorial) {
|
||||
store.dispatch(actions.setTutorial(stage));
|
||||
}
|
||||
|
||||
function tutorialStage(tutorial, clearTutorial, instance) {
|
||||
function tutorialStage(authenticated, tutorial, clearTutorial, instance) {
|
||||
if (!(instance.time_control === 'Practice' && instance.rounds.length === 1)) return false;
|
||||
|
||||
const exit = () => clearTutorial();
|
||||
@ -197,7 +197,6 @@ function tutorialStage(tutorial, clearTutorial, instance) {
|
||||
}
|
||||
|
||||
if (tutorial === 8) {
|
||||
localStorage.setItem('tutorial-complete', true);
|
||||
if (window.innerWidth < 1000) {
|
||||
return exit();
|
||||
}
|
||||
@ -221,11 +220,18 @@ function tutorialStage(tutorial, clearTutorial, instance) {
|
||||
onMouseDown={exit}> Continue </button>
|
||||
: null;
|
||||
|
||||
const skipTutorial = authenticated && !exitTutorial ?
|
||||
<button
|
||||
onClick={e => e.stopPropagation()}
|
||||
onMouseDown={exit}> Skip </button>
|
||||
: null;
|
||||
|
||||
return (
|
||||
<div class='tutorial'>
|
||||
{tutorialText()}
|
||||
<figure>
|
||||
{exitTutorial}
|
||||
{skipTutorial}
|
||||
</figure>
|
||||
</div>);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user