File tree 4 files changed +13
-7
lines changed
web-app/src/containers/Tutorial
4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -62,4 +62,4 @@ export async function loadProgressPosition() {
62
62
storage . setPosition ( position )
63
63
}
64
64
65
- export async function getPrev ( ) : Promise < void > { }
65
+ export async function getPrev ( ) : Promise < void > { }
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ export default (dispatch: CR.EditorDispatch) => ({
47
47
} ,
48
48
tutorialSetup ( ) {
49
49
dispatch ( 'coderoad.tutorial_setup' , currentTutorial )
50
- dispatch ( 'coderoad.open_webview' , 2 )
51
50
} ,
52
51
initializeNewTutorial : assign ( {
53
52
position : ( context : any ) : CR . Position => {
@@ -88,6 +87,8 @@ export default (dispatch: CR.EditorDispatch) => ({
88
87
const levelId = levelList . find ( ( id : string ) => ! currentProgress . levels [ id ] ) || levelList [ levelList . length - 1 ]
89
88
const { stageList } = data . levels [ levelId ]
90
89
const stageId = stageList . find ( ( id : string ) => ! currentProgress . stages [ id ] ) || stageList [ stageList . length - 1 ]
90
+ console . log ( 'position stepList' )
91
+ console . log ( data . stages [ stageId ] )
91
92
const { stepList } = data . stages [ stageId ]
92
93
const stepId = stepList . find ( ( id : string ) => ! currentProgress . steps [ id ] ) || stepList [ stepList . length - 1 ]
93
94
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ interface Props {
12
12
class StateMachine {
13
13
private dispatch : CR . EditorDispatch
14
14
private machineOptions = {
15
- logger : console . log ,
16
15
devTools : true ,
17
16
deferEvents : true ,
18
17
execute : true ,
@@ -24,10 +23,10 @@ class StateMachine {
24
23
this . service = interpret ( machine , this . machineOptions )
25
24
// logging
26
25
. onTransition ( state => {
27
- console . log ( 'onTransition' , state )
26
+ // console.log('onTransition', state)
28
27
if ( state . changed ) {
29
- console . log ( 'next state' )
30
- console . log ( state . value )
28
+ // console.log('next state')
29
+ // console.log(state.value)
31
30
dispatch ( 'coderoad.send_state' , { state : state . value , data : state . context } )
32
31
} else {
33
32
dispatch ( 'coderoad.send_data' , { data : state . context } )
@@ -43,6 +42,7 @@ class StateMachine {
43
42
}
44
43
public refresh ( ) {
45
44
console . log ( 'service refresh' )
45
+ console . log ( this . service . state )
46
46
const { value, context } = this . service . state
47
47
this . dispatch ( 'coderoad.send_state' , { state : value , data : context } )
48
48
}
Original file line number Diff line number Diff line change @@ -3,15 +3,20 @@ import DataContext from '../../utils/DataContext'
3
3
import Stage from '../../components/Stage'
4
4
5
5
interface PageProps {
6
- send ( action : string ) : void
7
6
state : any
7
+ send ( action : string ) : void
8
8
}
9
9
10
10
const StagePage = ( props : PageProps ) => {
11
11
const { position, data, progress } = React . useContext ( DataContext )
12
12
const { stageId } = position
13
13
const stage = data . stages [ stageId ]
14
14
15
+ if ( ! stage ) {
16
+ // may throw if no stage is supplied on restart
17
+ return < div > No Stage!</ div >
18
+ }
19
+
15
20
const stageComplete = progress . stages [ stageId ] || false
16
21
17
22
const onNextStage = ( ) : void => {
You can’t perform that action at this time.
0 commit comments