Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 13 additions & 10 deletions web-app/src/containers/Tutorial/containers/Review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,19 @@ const ReviewPage = (props: Props) => {
return show(step.status) ? (
<div key={step.id}>
{adminMode && (
<div css={styles.adminNav}>
<Button
type="normal"
warning
onClick={() => props.onResetToPosition({ levelId: level.id, stepId: step.id })}
>
{step.id}&nbsp;
<Icon type="refresh" />
</Button>
</div>
<>
<div css={styles.adminNav}>
<Button
type="normal"
warning
onClick={() => props.onResetToPosition({ levelId: level.id, stepId: step.id })}
>
{step.id}&nbsp;
<Icon type="refresh" />
</Button>
</div>
<br />
</>
)}
<Step
key={step.id}
Expand Down
3 changes: 3 additions & 0 deletions web-app/src/containers/Tutorial/formatLevels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
stepIndex = levels[levelIndex].steps.length
}

// current level
const levelUI: T.LevelUI = {
...currentLevel,
status: progress.levels[position.levelId] ? 'COMPLETE' : 'ACTIVE',
Expand Down Expand Up @@ -80,6 +81,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
}),
}

// flag all levels before as complete
const completed: T.LevelUI[] = levels.slice(0, levelIndex).map((level: TT.Level) => ({
...level,
status: 'COMPLETE',
Expand All @@ -90,6 +92,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
})),
}))

// flag all levels after as incomplete
const incompleted: T.LevelUI[] = levels.slice(levelIndex + 1, levels.length).map((level: TT.Level) => ({
...level,
status: 'INCOMPLETE',
Expand Down
9 changes: 6 additions & 3 deletions web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ export const createMachine = (options: any) => {
Tutorial: {
id: 'tutorial',
initial: 'Level',
on: {
RUN_RESET_TO_POSITION: {
actions: ['runResetToPosition'],
target: 'Tutorial.Level',
},
},
states: {
Level: {
initial: 'Load',
Expand Down Expand Up @@ -171,9 +177,6 @@ export const createMachine = (options: any) => {
RUN_RESET: {
actions: ['runReset'],
},
RUN_RESET_TO_POSITION: {
actions: ['runResetToPosition'],
},
KEY_PRESS_ENTER: {
actions: ['runTest'],
},
Expand Down