8000 setup editor sync progress (uninitiated) · benjaminthedev/coderoad-vscode@14d4f56 · GitHub
[go: up one dir, main page]

Skip to content

Commit 14d4f56

Browse files
committed
setup editor sync progress (uninitiated)
1 parent 30dd21c commit 14d4f56

File tree

3 files changed

+21
-2
lines changed
  • src/channel
  • web-app/src
    • components/Error
      • < 8000 div class="PRIVATE_TreeView-item-container prc-TreeView-TreeViewItemContainer--2Rkn" style="--level:3">
  • services/state/actions
  • 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+
    const progress = this.context.progress.setStepComplete(action.payload.stepId)
    106+
    const tutorial = this.context.tutorial.get()
    107+
    if (!tutorial) {
    108+
    throw new Error('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
    const ErrorView = ({ error }: Props) => {
    18-
    console.log(error)
    18+
    console.log(error)
    1919
    return (
    2020
    <div style={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)
    0