File tree Expand file tree Collapse file tree 2 files changed +4
-30
lines changed
web-app/src/services/state Expand file tree Collapse file tree 2 files changed +4
-30
lines changed Original file line number Diff line number Diff line change @@ -60,27 +60,6 @@ export const updateStepPosition = assign({
6060 } ,
6161} )
6262
63- export const updateLevelPosition = assign ( {
64- position : ( context : T . MachineContext ) : any => {
65- const { position } = context
66- const tutorial = selectors . currentTutorial ( context )
67- // merge in the updated position
68- // sent with the test to ensure consistency
69- const levels : TT . Level [ ] = tutorial . levels
70-
71- const levelIndex = levels . findIndex ( ( l : TT . Level ) => l . id === position . levelId )
72- const level : TT . Level = levels [ levelIndex + 1 ]
73-
74- const nextPosition : T . Position = {
75- levelId : level . id ,
76- stepId : level . steps . length ? level . steps [ 0 ] . id : null ,
77- complete : ! level . steps . length ,
78- }
79-
80- return nextPosition
81- } ,
82- } )
83-
8463export const updatePosition = assign ( {
8564 position : ( context : T . MachineContext , event : T . MachineEvent ) : any => {
8665 return event . payload
@@ -90,6 +69,7 @@ export const updatePosition = assign({
9069export const updateLevel = assign ( {
9170 position : ( context : T . MachineContext , event : T . MachineEvent ) : any => {
9271 const levelId = context . position . levelId
72+ console . log ( `updateLevel: ${ JSON . stringify ( context . position ) } ` )
9373 return { levelId, complete : false }
9474 } ,
9575} )
Original file line number Diff line number Diff line change @@ -215,16 +215,10 @@ export const createMachine = (options: any) => {
215215 } ,
216216 } ,
217217 LevelComplete : {
218- onExit : [ 'syncLevelPosition' ] ,
218+ onExit : [ 'testClear' , ' syncLevelPosition'] ,
219219 on : {
220- NEXT_LEVEL : {
221- target : 'LoadNext' ,
222- actions : [ 'testClear' , 'updateLevel' ] ,
223- } ,
224- KEY_PRESS_ENTER : {
225- target : 'LoadNext' ,
226- actions : [ 'testClear' , 'updateLevel' ] ,
227- } ,
220+ NEXT_LEVEL : 'LoadNext' ,
221+ KEY_PRESS_ENTER : 'LoadNext' ,
228222 } ,
229223 } ,
230224 LoadNext : {
You can’t perform that action at this time.
0 commit comments