Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb14901

Browse files
committed
fix stage complete
1 parenta7a7a94 commitbb14901

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

‎web-app/src/containers/Tutorial/StagePage/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ const StageSummaryPageContainer = (props: PageProps) => {
3434
})
3535
}
3636

37-
stage.steps.map((step:G.Step)=>{
38-
if(step.id===position.stepId){
39-
step.status='ACTIVE'
40-
}elseif(progress.steps[step.id]){
37+
stage.steps.forEach((step:G.Step)=>{
38+
if(progress.steps[step.id]){
4139
step.status='COMPLETE'
40+
}elseif(step.id===position.stepId){
41+
step.status='ACTIVE'
4242
}else{
4343
step.status='INCOMPLETE'
4444
}
4545
})
46+
stage.status=progress.stages[position.stageId] ?'COMPLETE' :'ACTIVE'
4647

4748
return<Stagestage={stage}onContinue={onContinue}onSave={onSave}/>
4849
}

‎web-app/src/services/state/actions/context.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,29 @@ export default {
3131
progress:(context:CR.MachineContext,event:CR.MachineEvent):CR.Progress=>{
3232
// update progress by tracking completed
3333
constcurrentProgress:CR.Progress=context.progress
34-
console.log('progress update',event.payload)
3534
conststepId=event.payload.stepId
35+
console.log('step progress update',stepId)
3636

3737
currentProgress.steps[stepId]=true
3838

3939
returncurrentProgress
4040
},
4141
}),
4242
//@ts-ignore
43+
updateStageProgress:assign({
44+
progress:(context:CR.MachineContext,event:CR.MachineEvent):CR.Progress=>{
45+
// update progress by tracking completed
46+
const{progress, position}=context
47+
48+
conststageId:string=position.stageId
49+
console.log('stage progress update',stageId)
50+
51+
progress.stages[stageId]=true
52+
53+
returnprogress
54+
},
55+
}),
56+
//@ts-ignore
4357
stepLoadNext:assign({
4458
position:(context:CR.MachineContext,event:CR.MachineEvent):CR.Position=>{
4559
constposition:CR.Position=context.position

‎web-app/src/services/state/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {send} from 'xstate'
22
// import {machine} from '../../extension'
33
// import {cache} from '../../services/apollo'
44
// import {editorDispatch} from '../../services/vscode'
5-
import*asCRfrom'typings'
5+
//import * as CR from 'typings'
66
// import * as G from 'typings/graphql'
77
// import tutorialConfig from '../../services/apollo/queries/tutorialConfig'
88
importeditorActionsfrom'./editor'

‎web-app/src/services/state/guards/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export default {
1212
.steps
1313

1414
// TODO: verify not -1
15-
return!(steps.findIndex((s:G.Step)=>s.id===position.stepId)===steps.length-1)
15+
consthasNextStep=!(steps.findIndex((s:G.Step)=>s.id===position.stepId)===steps.length-1)
16+
console.log(hasNextStep,steps,position.stepId)
17+
returnhasNextStep
1618
},
1719
hasNextStage:(context:CR.MachineContext):boolean=>{
1820
const{tutorial, position}=context

‎web-app/src/services/state/machine.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
151151
},
152152
{
153153
target:'StageComplete',
154+
actions:['updateStageProgress']
154155
},
155156
],
156157
},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp