File tree 2 files changed +56
-1
lines changed
2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change @@ -87,5 +87,59 @@ export default {
87
87
} ,
88
88
testStart ( ) {
89
89
vscode . commands . executeCommand ( 'coderoad.run_test' )
90
- }
90
+ } ,
91
+ // @ts -ignore
92
+ stepComplete : assign ( {
93
+ progress : ( context : CR . MachineContext ) : CR . Progress => {
94
+ const nextProgress = {
95
+ ...context . progress ,
96
+ steps : {
97
+ ...context . progress . steps ,
98
+ [ context . position . stepId ] : true ,
99
+ }
100
+ }
101
+ storage . setProgress ( nextProgress )
102
+ return nextProgress
103
+ }
104
+ } ) ,
105
+ // @ts -ignore
106
+ stageComplete : assign ( {
107
+ progress : ( context : CR . MachineContext ) : CR . Progress => {
108
+ const nextProgress = {
109
+ ...context . progress ,
110
+ stages : {
111
+ ...context . progress . stages ,
112
+ [ context . position . stageId ] : true ,
113
+ }
114
+ }
115
+ storage . setProgress ( nextProgress )
116
+ return nextProgress
117
+ }
118
+ } ) ,
119
+ // @ts -ignore
120
+ levelComplete : assign ( {
121
+ progress : ( context : CR . MachineContext ) : CR . Progress => {
122
+ const nextProgress = {
123
+ ...context . progress ,
124
+ levels : {
125
+ ...context . progress . levels ,
126
+ [ context . position . levelId ] : true ,
127
+ }
128
+ }
129
+ storage . setProgress ( nextProgress )
130
+ return nextProgress
131
+
132
+ }
133
+ } ) ,
134
+ // @ts -ignore
135
+ tutorialComplete : assign ( {
136
+ progress : ( context : CR . MachineContext ) : CR . Progress => {
137
+ const nextProgress = {
138
+ ...context . progress ,
139
+ complete : true ,
140
+ }
141
+ storage . setProgress ( nextProgress )
142
+ return nextProgress
143
+ }
144
+ } ) ,
91
145
}
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ export const machine = Machine<
135
135
} ,
136
136
} ,
137
137
StageComplete : {
138
+ onEntry : 'stageComplete' ,
138
139
on : {
139
140
NEXT : [
140
141
{
You can’t perform that action at this time.
0 commit comments