Skip to content

Commit b6501e0

Browse files
committed
prevent commands on reset tutorial
Signed-off-by: shmck <[email protected]>
1 parent 032057d commit b6501e0

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

Diff for: typings/index.d.ts

+14-13
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,28 @@ export interface MachineStateSchema {
8989
states: {
9090
Setup: {
9191
states: {
92-
Startup: {}
93-
ValidateSetup: {}
94-
Start: {}
95-
SelectTutorial: {}
96-
SetupNewTutorial: {}
97-
StartTutorial: {}
92+
Startup: Record<string, unknown>
93+
ValidateSetup: Record<string, unknown>
94+
Start: Record<string, unknown>
95+
SelectTutorial: Record<string, unknown>
96+
SetupNewTutorial: Record<string, unknown>
97+
StartTutorial: Record<string, unknown>
9898
}
9999
}
100100
Tutorial: {
101101
states: {
102102
Level: {
103103
states: {
104-
Load: {}
105-
Normal: {}
106-
TestRunning: {}
107-
StepNext: {}
108-
LevelComplete: {}
109-
LoadNext: {}
104+
Load: Record<string, unknown>
105+
Normal: Record<string, unknown>
106+
TestRunning: Record<string, unknown>
107+
StepNext: Record<string, unknown>
108+
LevelComplete: Record<string, unknown>
109+
LoadNext: Record<string, unknown>
110110
}
111111
}
112-
Completed: {}
112+
Reset: Record<string, unknown>
113+
Completed: Record<string, unknown>
113114
}
114115
}
115116
}

Diff for: web-app/src/Routes.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const Routes = () => {
4242
<Route paths={{ Tutorial: { Level: { Load: true } } }}>
4343
<LoadingPage text="Loading Level..." processes={context.processes} />
4444
</Route>
45+
<Route paths={{ Tutorial: { Reset: true } }}>
46+
<LoadingPage text="Resetting tutorial..." processes={context.processes} />
47+
</Route>
4548
<Route paths={{ Tutorial: { Level: true, Completed: true } }}>
4649
<TutorialPage send={send} context={context} state={route.replace('Tutorial.', '')} />
4750
</Route>

Diff for: web-app/src/services/state/machine.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ export const createMachine = (options: any) => {
6969
target: 'SetupNewTutorial',
7070
actions: ['setTutorialContext'],
7171
},
72-
// TODO: handle completed tutorial differently
7372
TUTORIAL_ALREADY_COMPLETE: {
7473
target: 'Start',
7574
actions: ['setStart'],
@@ -168,9 +167,7 @@ export const createMachine = (options: any) => {
168167
RUN_TEST: {
169168
actions: ['runTest'],
170169
},
171-
RUN_RESET: {
172-
actions: ['runReset'],
173-
},
170+
RUN_RESET: '#reset-tutorial',
174171
KEY_PRESS_ENTER: {
175172
actions: ['runTest'],
176173
},
@@ -234,6 +231,14 @@ export const createMachine = (options: any) => {
234231
},
235232
},
236233
},
234+
Reset: {
235+
id: 'reset-tutorial',
236+
onEntry: ['runReset'],
237+
onExit: ['testClear'],
238+
after: {
239+
3000: '#tutorial',
240+
},
241+
},
237242
Completed: {
238243
id: 'completed-tutorial',
239244
on: {

0 commit comments

Comments
 (0)