We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentae49579 commit9e2d05aCopy full SHA for 9e2d05a
src/channel/index.ts
@@ -297,6 +297,11 @@ class Channel implements Channel {
297
vscode.commands.executeCommand(COMMANDS.RUN_TEST)
298
return
299
300
+case'EDITOR_SYNC_PROGRESS':
301
+// update progress when a level is deemed complete in the client
302
+awaitthis.context.progress.syncProgress(action.payload.progress)
303
+return
304
+
305
default:
306
logger(`No match for action type:${actionType}`)
307
src/channel/state/Progress.ts
@@ -39,6 +39,10 @@ class Progress {
39
publicreset=()=>{
40
this.set(defaultValue)
41
}
42
+publicsyncProgress=(progress:T.Progress):T.Progress=>{
43
+constnext={ ...this.value, ...progress}
44
+returnthis.set(next)
45
+}
46
publicsetStepComplete=(tutorial:TT.Tutorial,stepId:string):T.Progress=>{
47
constnext=this.value
48
// mark step complete
web-app/src/containers/Tutorial/index.tsx
@@ -5,7 +5,7 @@ import { Menu } from '@alifd/next'
5
import*asselectorsfrom'../../services/selectors'
6
importIconfrom'../../components/Icon'
7
importLevelfrom'./components/Level'
8
-importloggerfrom'services/logger'
+importloggerfrom'../../services/logger'
9
10
interfacePageProps{
11
context:T.MachineContext
web-app/src/environment.ts
@@ -9,7 +9,6 @@ for (const required of requiredKeys) {
exportconstDEBUG:boolean=(process.env.REACT_APP_DEBUG||'').toLowerCase()==='true'
exportconstVERSION:string=process.env.VERSION||'unknown'
exportconstNODE_ENV:string=process.env.NODE_ENV||'development'
12
-exportconstLOG:boolean=
13
-(process.env.REACT_APP_LOG||'').toLowerCase()==='true'&&process.env.NODE_ENV!=='production'
+exportconstLOG:boolean=(process.env.REACT_APP_LOG||'').toLowerCase()==='true'
14
exportconstTUTORIAL_LIST_URL:string=process.env.REACT_APP_TUTORIAL_LIST_URL||''
15
exportconstSENTRY_DSN:string|null=process.env.REACT_APP_SENTRY_DSN||null
web-app/src/services/state/actions/editor.ts
@@ -74,6 +74,14 @@ export default (editorSend: any) => ({
74
})
75
76
},
77
+syncLevelProgress(context:CR.MachineContext):void{
78
+editorSend({
79
+type:'EDITOR_SYNC_PROGRESS',
80
+payload:{
81
+progress:context.progress,
82
+},
83
+})
84
85
clearStorage():void{
86
editorSend({type:'TUTORIAL_CLEAR'})
87
web-app/src/services/state/machine.ts
@@ -207,13 +207,12 @@ export const createMachine = (options: any) => {
207
target:'Normal',
208
actions:['loadStep'],
209
210
-LEVEL_COMPLETE:{
211
-target:'LevelComplete',
212
-actions:['updateLevelProgress'],
213
-},
+LEVEL_COMPLETE:'LevelComplete',
214
215
216
LevelComplete:{
+onEntry:['updateLevelProgress'],
+onExit:['syncLevelProgress'],
217
on:{
218
LEVEL_NEXT:{
219
target:'#tutorial-load-next',