Skip to content

Commit 92522b1

Browse files
committed
fix up client tutorialConfig
1 parent 0a47e7e commit 92522b1

File tree

7 files changed

+23
-76
lines changed

7 files changed

+23
-76
lines changed

web-app/src/containers/Continue/queryTutorial.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { gql } from 'apollo-boost'
1+
import {gql} from 'apollo-boost'
22

33
export default gql`
44
query getTutorial($tutorialId: ID!, $version: String) {
@@ -12,6 +12,7 @@ export default gql`
1212
}
1313
createdAt
1414
codingLanguage
15+
testRunner
1516
repo {
1617
uri
1718
branch

web-app/src/containers/Tutorial/StagePage/queryStage.ts

-41
This file was deleted.

web-app/src/containers/Tutorial/SummaryPage/querySummary.ts

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ export default gql`
66
id
77
title
88
text
9+
codingLanguage
10+
testRunner
11+
repo {
12+
uri
13+
}
914
version(version: $version) {
1015
version
1116
coderoadVersion

web-app/src/services/apollo/queries/tutorialConfig.ts

-13
This file was deleted.

web-app/src/services/apollo/queries/tutorialRepo.ts

-16
This file was deleted.

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

+15-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import channel from '../../channel'
33

44
export default {
55
tutorialStart() {
6+
console.log('EDITOR: TUTORIAL_START')
67
channel.editorSend({
78
type: 'TUTORIAL_START',
89
payload: {
@@ -12,11 +13,22 @@ export default {
1213
}
1314
})
1415
},
15-
testRunnerSetup(context: CR.MachineContext) {
16-
console.log('test runner setup', context)
16+
tutorialConfig(context: CR.MachineContext) {
17+
// setup test runner and git
18+
const {tutorial} = context
19+
const payload = {
20+
codingLanguage: tutorial.codingLanguage,
21+
testRunner: tutorial.testRunner,
22+
repo: tutorial.repo,
23+
}
24+
console.log('EDITOR: TUTORIAL_CONFIG')
25+
channel.editorSend({
26+
type: 'TUTORIAL_CONFIG',
27+
payload,
28+
})
1729
},
1830
testStart(context: CR.MachineContext, event: CR.MachineEvent) {
19-
console.log('test start')
31+
console.log('EDITOR: TEST_RUN')
2032
const {stepId} = event.payload
2133
channel.editorSend({
2234
type: 'TEST_RUN',

web-app/src/services/state/machine.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
6060
Tutorial: {
6161
id: 'tutorial',
6262
initial: 'Initialize',
63-
onEntry: ['testRunnerSetup'],
6463
states: {
6564
Initialize: {
6665
onEntry: ['initializeNewTutorial'],
@@ -96,7 +95,7 @@ export const machine = Machine<CR.MachineContext, CR.MachineStateSchema, CR.Mach
9695
on: {
9796
LOAD_TUTORIAL: {
9897
target: 'Level',
99-
actions: ['initPosition', 'setTutorial']
98+
actions: ['tutorialConfig', 'initPosition', 'setTutorial']
10099
}
101100
},
102101
},

0 commit comments

Comments
 (0)