Skip to content

Commit 4c8eb65

Browse files
authored
Merge pull request #413 from coderoad/fix/admin-review
Fix/admin review
2 parents 05209eb + 89795db commit 4c8eb65

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

web-app/src/containers/Tutorial/containers/Review.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,19 @@ const ReviewPage = (props: Props) => {
9393
return show(step.status) ? (
9494
<div key={step.id}>
9595
{adminMode && (
96-
<div css={styles.adminNav}>
97-
<Button
98-
type="normal"
99-
warning
100-
onClick={() => props.onResetToPosition({ levelId: level.id, stepId: step.id })}
101-
>
102-
{step.id}&nbsp;
103-
<Icon type="refresh" />
104-
</Button>
105-
</div>
96+
<>
97+
<div css={styles.adminNav}>
98+
<Button
99+
type="normal"
100+
warning
101+
onClick={() => props.onResetToPosition({ levelId: level.id, stepId: step.id })}
102+
>
103+
{step.id}&nbsp;
104+
<Icon type="refresh" />
105+
</Button>
106+
</div>
107+
<br />
108+
</>
106109
)}
107110
<Step
108111
key={step.id}

web-app/src/containers/Tutorial/formatLevels.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
3737
stepIndex = levels[levelIndex].steps.length
3838
}
3939

40+
// current level
4041
const levelUI: T.LevelUI = {
4142
...currentLevel,
4243
status: progress.levels[position.levelId] ? 'COMPLETE' : 'ACTIVE',
@@ -80,6 +81,7 @@ const formatLevels = ({ progress, position, levels, testStatus }: Input): Output
8081
}),
8182
}
8283

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

95+
// flag all levels after as incomplete
9396
const incompleted: T.LevelUI[] = levels.slice(levelIndex + 1, levels.length).map((level: TT.Level) => ({
9497
...level,
9598
status: 'INCOMPLETE',

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ export const createMachine = (options: any) => {
141141
Tutorial: {
142142
id: 'tutorial',
143143
initial: 'Level',
144+
on: {
145+
RUN_RESET_TO_POSITION: {
146+
actions: ['runResetToPosition'],
147+
target: 'Tutorial.Level',
148+
},
149+
},
144150
states: {
145151
Level: {
146152
initial: 'Load',
@@ -171,9 +177,6 @@ export const createMachine = (options: any) => {
171177
RUN_RESET: {
172178
actions: ['runReset'],
173179
},
174-
RUN_RESET_TO_POSITION: {
175-
actions: ['runResetToPosition'],
176-
},
177180
KEY_PRESS_ENTER: {
178181
actions: ['runTest'],
179182
},

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy