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

Commit893eca7

Browse files
committed
initialize position
1 parentb9e7d95 commit893eca7

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

‎src/state/actions/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
constlevelId=data.summary.levelList[0]
58+
conststageId=data.levels[levelId].stageList[0]
59+
conststepId=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{

‎src/state/machine.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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'],

‎typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export interface MachineStateSchema {
146146
}
147147
Tutorial:{
148148
states:{
149+
Initialize:{}
149150
Summary:{}
150151
LoadNext:{}
151152
Level:{}

‎web-app/src/containers/Tutorial/SummaryPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface PageProps {
99

1010
constSummaryPage=(props:PageProps)=>{
1111
const{ data}=React.useContext(DataContext)
12-
return<Summarydata={data}onNext={()=>props.send('LOAD_NEXT')}/>
12+
return<Summarydata={data}onNext={()=>props.send('NEXT')}/>
1313
}
1414

1515
exportdefaultSummaryPage

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp