Skip to content

Feature/completed #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace load-current with load-next
  • Loading branch information
ShMcK committed Jul 23, 2019
commit b6a15d8eab579841ff23dee42077a47154736d29
3 changes: 2 additions & 1 deletion src/state/guards/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export default {
const { data, position, progress } = context
const steps = data.stages[position.stageId].stepList
// isn't final step yet
const hasNext = !!position.stepId && (steps[steps.length - 1] !== position.stepId) || !progress.stages[position.stageId]
const stageIncomplete = !progress.stages[position.stageId]
const hasNext = stageIncomplete && (!!position.stepId && (steps[steps.length - 1] !== position.stepId))
console.log('GUARD: hasNextStep', hasNext)
return hasNext
},
Expand Down
38 changes: 17 additions & 21 deletions src/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const machine = (dispatch: CR.EditorDispatch) =>
ContinueTutorial: {
onEntry: ['tutorialContinue'],
on: {
TUTORIAL_START: '#tutorial-load-current',
TUTORIAL_START: '#tutorial-load-next',
},
},
},
Expand All @@ -57,7 +57,7 @@ export const machine = (dispatch: CR.EditorDispatch) =>
initial: 'Initialize',
onEntry: ['tutorialSetup'],
on: {
WEBVIEW_INITIALIZED: '#tutorial-load-current'
WEBVIEW_INITIALIZED: '#tutorial-load-next'
},
states: {
Initialize: {
Expand All @@ -66,28 +66,24 @@ export const machine = (dispatch: CR.EditorDispatch) =>
0: 'Summary',
},
},
LoadCurrent: {
id: 'tutorial-load-current',
// TODO: verify current is not complete
after: {
0: 'Stage',
},
},
LoadNext: {
id: 'tutorial-load-next',
after: {
0: [
{
target: 'Stage',
cond: 'hasNextStage',
},
{
target: 'Level',
cond: 'hasNextLevel',
},
{
target: '#completed-tutorial',
},
0: [{
target: 'Stage',
cond: 'hasNextStep',
},
{
target: 'Stage',
cond: 'hasNextStage',
},
{
target: 'Level',
cond: 'hasNextLevel',
},
{
target: '#completed-tutorial',
},
],
},
},
Expand Down
1 change: 0 additions & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export interface MachineStateSchema {
states: {
Initialize: {}
Summary: {}
LoadCurrent: {}
LoadNext: {}
Level: {}
Stage: {
Expand Down