File tree Expand file tree Collapse file tree 4 files changed +58
-4
lines changed
web-app/src/services/state Expand file tree Collapse file tree 4 files changed +58
-4
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,15 @@ class Channel implements Channel {
8181 case 'EDITOR_RUN_RESET_POSITION' :
8282 actions . onRunReset ( { type : 'POSITION' , position : action . payload . position } , this . context )
8383 return
84+ case 'EDITOR_STEP_COMPLETE' :
85+ hooks . onStepComplete ( action . payload )
86+ return
87+ case 'EDITOR_LEVEL_COMPLETE' :
88+ hooks . onLevelComplete ( action . payload )
89+ return
90+ case 'EDITOR_TUTORIAL_COMPLETE' :
91+ hooks . onTutorialComplete ( action . payload )
92+ return
8493 default :
8594 logger ( `No match for action type: ${ actionType } ` )
8695 return
Original file line number Diff line number Diff line change 1+ import * as T from 'typings'
12import * as TT from 'typings/tutorial'
23import * as git from '../git'
34import loadCommits from './utils/loadCommits'
@@ -39,3 +40,18 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
3940export const onError = async ( error : Error ) : Promise < void > => {
4041 telemetryOnError ( error )
4142}
43+
44+ export const onStepComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
45+ /* TODO */
46+ console . log ( `ON STEP COMPLETE: ${ JSON . stringify ( position ) } ` )
47+ }
48+
49+ export const onLevelComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
50+ /* TODO */
51+ console . log ( `ON LEVEL COMPLETE: ${ JSON . stringify ( position ) } ` )
52+ }
53+
54+ export const onTutorialComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
55+ /* TODO */
56+ console . log ( `ON LEVEL COMPLETE: ${ JSON . stringify ( position ) } ` )
57+ }
Original file line number Diff line number Diff line change @@ -133,4 +133,28 @@ export default (editorSend: any) => ({
133133 } ,
134134 } )
135135 } ,
136+ onStepComplete ( context : T . MachineContext ) : void {
137+ editorSend ( {
138+ type : 'EDITOR_STEP_COMPLETE' ,
139+ payload : {
140+ position : context . position ,
141+ } ,
142+ } )
143+ } ,
144+ onLevelComplete ( context : T . MachineContext ) : void {
145+ editorSend ( {
146+ type : 'EDITOR_LEVEL_COMPLETE' ,
147+ payload : {
148+ position : context . position ,
149+ } ,
150+ } )
151+ } ,
152+ onTutorialComplete ( context : T . MachineContext ) : void {
153+ editorSend ( {
154+ type : 'EDITOR_TUTORIAL_COMPLETE' ,
155+ payload : {
156+ position : context . position ,
157+ } ,
158+ } )
159+ } ,
136160} )
Original file line number Diff line number Diff line change @@ -198,9 +198,12 @@ export const createMachine = (options: any) => {
198198 on : {
199199 LOAD_NEXT_STEP : {
200200 target : 'Normal' ,
201- actions : [ 'loadStep' , 'updateStepPosition' ] ,
201+ actions : [ 'onStepComplete' , 'loadStep' , 'updateStepPosition' ] ,
202+ } ,
203+ LEVEL_COMPLETE : {
204+ target : 'LevelComplete' ,
205+ actions : [ 'onLevelComplete' ] ,
202206 } ,
203- LEVEL_COMPLETE : 'LevelComplete' ,
204207 } ,
205208 } ,
206209 LevelComplete : {
@@ -223,14 +226,16 @@ export const createMachine = (options: any) => {
223226 target : 'Load' ,
224227 actions : [ 'updatePosition' ] ,
225228 } ,
226- COMPLETED : '#completed-tutorial' ,
229+ COMPLETED : {
230+ target : '#completed-tutorial' ,
231+ actions : [ 'onTutorialComplete' ] ,
232+ } ,
227233 } ,
228234 } ,
229235 } ,
230236 } ,
231237 Completed : {
232238 id : 'completed-tutorial' ,
233- onEntry : [ 'userTutorialComplete' ] , // unusued
234239 on : {
235240 SELECT_TUTORIAL : {
236241 target : '#select-new-tutorial' ,
You can’t perform that action at this time.
0 commit comments