File tree Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Top Open diff view settings
web-app/src/containers/Tutorial Expand file tree Collapse file tree 4 files changed +22
-2
lines changed Top Open diff view settings Original file line number Diff line number Diff line change @@ -51,6 +51,19 @@ export default {
5151 vscode . commands . executeCommand ( 'coderoad.tutorial_setup' , currentTutorial )
5252 vscode . commands . executeCommand ( 'coderoad.open_webview' , vscode . ViewColumn . Two )
5353 } ,
54+ initializeNewTutorial : assign ( {
55+ position : ( context : any ) : CR . Position => {
56+ const { data } = context
57+ const levelId = data . summary . levelList [ 0 ]
58+ const stageId = data . levels [ levelId ] . stageList [ 0 ]
59+ const stepId = data . stages [ stageId ] . stepList [ 0 ]
60+ return {
61+ levelId,
62+ stageId,
63+ stepId
64+ }
65+ }
66+ } ) ,
5467 tutorialContinue : assign ( {
5568 // load initial data, progress & position
5669 data ( ) : CR . TutorialData {
Original file line number Diff line number Diff line change @@ -57,9 +57,15 @@ export const machine = Machine<
5757 } ,
5858 Tutorial : {
5959 id : 'tutorial' ,
60- initial : 'Summary ' ,
60+ initial : 'Initialize ' ,
6161 onEntry : [ 'tutorialSetup' ] ,
6262 states : {
63+ Initialize : {
64+ onEntry : [ 'initializeNewTutorial' ] ,
65+ after : {
66+ 0 : 'Summary'
67+ }
68+ } ,
6369 LoadNext : {
6470 id : 'tutorial-load-next' ,
6571 onEntry : [ 'tutorialLoadNext' ] ,
Original file line number Diff line number Diff line change @@ -146,6 +146,7 @@ export interface MachineStateSchema {
146146 }
147147 Tutorial : {
148148 states : {
149+ Initialize : { }
149150 Summary : { }
150151 LoadNext : { }
151152 Level : { }
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ interface PageProps {
99
1010const SummaryPage = ( props : PageProps ) => {
1111 const { data } = React . useContext ( DataContext )
12- return < Summary data = { data } onNext = { ( ) => props . send ( 'LOAD_NEXT ' ) } />
12+ return < Summary data = { data } onNext = { ( ) => props . send ( 'NEXT ' ) } />
1313}
1414
1515export default SummaryPage
You can’t perform that action at this time.
0 commit comments