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