File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed
web-app/src/services/state Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import runCommands from './utils/runCommands'
88import runVSCodeCommands from './utils/runVSCodeCommands'
99import { onError as telemetryOnError } from '../telemetry'
1010import { onRunTest } from '../../actions/onTest'
11+ import logger from '../logger'
1112
1213export const onInit = async ( actions : TT . StepActions ) : Promise < void > => {
1314 await loadCommits ( actions ?. commits )
@@ -41,17 +42,14 @@ export const onError = async (error: Error): Promise<void> => {
4142 telemetryOnError ( error )
4243}
4344
44- export const onStepComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
45- /* TODO */
46- console . log ( `ON STEP COMPLETE: ${ JSON . stringify ( position ) } ` )
45+ export const onStepComplete = async ( { levelId, stepId } : { levelId : string ; stepId : string } ) : Promise < void > => {
46+ logger ( `ON STEP COMPLETE: ${ JSON . stringify ( { levelId, stepId } ) } ` )
4747}
4848
49- export const onLevelComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
50- /* TODO */
51- console . log ( `ON LEVEL COMPLETE: ${ JSON . stringify ( position ) } ` )
49+ export const onLevelComplete = async ( { levelId } : { levelId : string } ) : Promise < void > => {
50+ logger ( `ON LEVEL COMPLETE: ${ JSON . stringify ( levelId ) } ` )
5251}
5352
54- export const onTutorialComplete = async ( { position } : { position : T . Position } ) : Promise < void > => {
55- /* TODO */
56- console . log ( `ON LEVEL COMPLETE: ${ JSON . stringify ( position ) } ` )
53+ export const onTutorialComplete = async ( { tutorialId } : { tutorialId : string } ) : Promise < void > => {
54+ logger ( `ON TUTORIAL COMPLETE: ${ JSON . stringify ( tutorialId ) } ` )
5755}
Original file line number Diff line number Diff line change @@ -137,23 +137,24 @@ export default (editorSend: any) => ({
137137 editorSend ( {
138138 type : 'EDITOR_STEP_COMPLETE' ,
139139 payload : {
140- position : context . position ,
140+ levelId : context . position . levelId ,
141+ stepId : context . position . levelId ,
141142 } ,
142143 } )
143144 } ,
144145 onLevelComplete ( context : T . MachineContext ) : void {
145146 editorSend ( {
146147 type : 'EDITOR_LEVEL_COMPLETE' ,
147148 payload : {
148- position : context . position ,
149+ levelId : context . position . levelId ,
149150 } ,
150151 } )
151152 } ,
152153 onTutorialComplete ( context : T . MachineContext ) : void {
153154 editorSend ( {
154155 type : 'EDITOR_TUTORIAL_COMPLETE' ,
155156 payload : {
156- position : context . position ,
157+ tutorialId : context . tutorial ?. id ,
157158 } ,
158159 } )
159160 } ,
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ export const createMachine = (options: any) => {
181181 on : {
182182 TEST_PASS : {
183183 target : 'StepNext' ,
184- actions : [ 'testPass' , 'updateStepPosition' ] ,
184+ actions : [ 'onStepComplete' , ' testPass', 'updateStepPosition' ] ,
185185 } ,
186186 TEST_FAIL : {
187187 target : 'Normal' ,
@@ -198,7 +198,7 @@ export const createMachine = (options: any) => {
198198 on : {
199199 LOAD_NEXT_STEP : {
200200 target : 'Normal' ,
201- actions : [ 'onStepComplete' , ' loadStep', 'updateStepPosition' ] ,
201+ actions : [ 'loadStep' , 'updateStepPosition' ] ,
202202 } ,
203203 LEVEL_COMPLETE : {
204204 target : 'LevelComplete' ,
You can’t perform that action at this time.
0 commit comments