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

Fixes#7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromfixes
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionssrc/editor/commands/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,6 +63,7 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
const{ steps}=tutorial.data
const{ setup}=steps[pos.stepId].actions
awaitgit.gitLoadCommits(setup)
machine.send('TUTORIAL_LOADED')
},
[COMMANDS.TUTORIAL_SETUP]:async(tutorial:CR.Tutorial)=>{
console.log('tutorial setup',tutorial)
Expand Down
34 changes: 32 additions & 2 deletionssrc/state/actions/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,6 +32,7 @@ export default {
constcanContinue=!!(tutorial&&progress&&hasGit&&hasGitRemote)

if(canContinue){
// continue
currentTutorial=tutorial
currentProgress=progress
}
Expand All@@ -41,6 +42,7 @@ export default {
asynctutorialLaunch(){
// TODO: add selection of tutorial id
consttutorial:CR.Tutorial=awaitapi({resource:'getTutorial',params:{id:'1'}})
currentTutorial=tutorial
console.log('api')
console.log(tutorial)
vscode.commands.executeCommand('coderoad.tutorial_launch',tutorial)
Expand All@@ -49,6 +51,19 @@ export default {
vscode.commands.executeCommand('coderoad.tutorial_setup',currentTutorial)
vscode.commands.executeCommand('coderoad.open_webview',vscode.ViewColumn.Two)
},
initializeNewTutorial:assign({
position:(context:any):CR.Position=>{
const{ data}=context
constlevelId=data.summary.levelList[0]
conststageId=data.levels[levelId].stageList[0]
conststepId=data.stages[stageId].stepList[0]
return{
levelId,
stageId,
stepId
}
}
}),
tutorialContinue:assign({
// load initial data, progress & position
data():CR.TutorialData{
Expand DownExpand Up@@ -149,7 +164,22 @@ export default {
returnnextProgress
}
}),
stepLoadNext(){
console.log("LOAD NEXT STEP")
stepLoadNext:assign({
position:(context:any)=>{
const{ data, position}=context
const{ stepList}=data.stages[position.stageId]
constcurrentStepIndex=stepList.indexOf(position.stepId)
constnextStepId=stepList[currentStepIndex+1]
return{
...context.position,
stepId:nextStepId,
}
}
}),
loadLevel(){
console.log('loadLevel')
},
loadStage(){
console.log('loadStage')
}
}
8 changes: 7 additions & 1 deletionsrc/state/machine.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -57,9 +57,15 @@ export const machine = Machine<
},
Tutorial:{
id:'tutorial',
initial:'Summary',
initial:'Initialize',
onEntry:['tutorialSetup'],
states:{
Initialize:{
onEntry:['initializeNewTutorial'],
after:{
0:'Summary'
}
},
LoadNext:{
id:'tutorial-load-next',
onEntry:['tutorialLoadNext'],
Expand Down
1 change: 1 addition & 0 deletionstypings/index.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -146,6 +146,7 @@ export interface MachineStateSchema {
}
Tutorial:{
states:{
Initialize:{}
Summary:{}
LoadNext:{}
Level:{}
Expand Down
2 changes: 1 addition & 1 deletionweb-app/src/containers/Tutorial/SummaryPage.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ interface PageProps {

constSummaryPage=(props:PageProps)=>{
const{ data}=React.useContext(DataContext)
return<Summarydata={data}onNext={()=>props.send('LOAD_NEXT')}/>
return<Summarydata={data}onNext={()=>props.send('NEXT')}/>
}

exportdefaultSummaryPage

[8]ページ先頭

©2009-2025 Movatter.jp