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

Commit14d4f56

Browse files
committed
setup editor sync progress (uninitiated)
1 parent30dd21c commit14d4f56

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

‎src/channel/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ class Channel implements Channel {
7272
this.context.setTutorial(this.workspaceState,tutorialData)
7373
tutorialConfig(tutorialData)
7474
return
75+
case'EDITOR_SYNC_PROGRESS':
76+
// sync client progress on server
77+
this.context.position.set(action.payload.position)
78+
this.context.progress.set(action.payload.progress)
79+
return
7580
// run unit tests on step
7681
case'TEST_RUN':
7782
vscode.commands.executeCommand('coderoad.run_test',action.payload)
@@ -97,7 +102,12 @@ class Channel implements Channel {
97102
switch(action.type){
98103
case'TEST_PASS':
99104
// update local storage stepProgress
100-
this.context.progress.setStepComplete(action.payload.stepId)
105+
constprogress=this.context.progress.setStepComplete(action.payload.stepId)
106+
consttutorial=this.context.tutorial.get()
107+
if(!tutorial){
108+
thrownewError('Error with current tutorial')
109+
}
110+
this.context.position.setPositionFromProgress(tutorial,progress)
101111
saveCommit()
102112
}
103113

‎web-app/src/components/Error/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Props {
1515
}
1616

1717
constErrorView=({ error}:Props)=>{
18-
console.log(error)
18+
console.log(error)
1919
return(
2020
<divstyle={styles.container}>
2121
<h1>Error</h1>

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ export default {
1111
type:'EDITOR_TUTORIAL_LOAD',
1212
})
1313
},
14+
syncProgress(context:CR.MachineContext){
15+
// sync progress in editor local storage for persistence
16+
channel.editorSend({
17+
type:'EDITOR_SYNC_PROGRESS',
18+
payload:{
19+
progress:context.progress,
20+
}
21+
})
22+
},
1423
initializeTutorial(context:CR.MachineContext,event:CR.MachineEvent){
1524
// setup test runner and git
1625
const{tutorial}=event.data.payload

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp