Skip to content

Commit ff6eb22

Browse files
authored
Merge pull request #440 from coderoad/fixes/minor
Fixes/minor
2 parents 4e997d8 + 93b5e78 commit ff6eb22

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

web-app/src/containers/Tutorial/components/StepProgress.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ const styles = {
99
display: 'flex' as 'flex',
1010
justifyContent: 'flex-end' as 'flex-end',
1111
alignItems: 'center' as 'center',
12-
width: '10rem',
12+
width: '150px',
1313
color: theme['$color-white'],
14+
marginRight: '-16px',
1415
}),
1516
text: (theme: Theme) => ({
1617
color: theme['$color-white'],
17-
marginRight: '0.5rem',
18-
fontSize: '80%',
18+
marginRight: '5px',
19+
fontSize: '10px',
1920
}),
2021
}
2122

@@ -28,7 +29,11 @@ const StepProgress = (props: Props) => {
2829
const theme: Theme = useTheme()
2930
const isWide = useMedia({ minWidth: '340px' })
3031

31-
const Text = `${props.current} of ${props.max}`
32+
const Text = (
33+
<span style={styles.text(theme)}>
34+
{props.current} of {props.max}
35+
</span>
36+
)
3237

3338
if (isWide) {
3439
return (

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ const formatLevels = ({ position, levels, testStatus }: Input): Output => {
3636
stepIndex = levels[levelIndex].steps.length
3737
}
3838

39+
if (position.complete) {
40+
stepIndex += 1
41+
}
42+
3943
// current level
4044
const levelUI: T.LevelUI = {
4145
...currentLevel,
@@ -44,7 +48,7 @@ const formatLevels = ({ position, levels, testStatus }: Input): Output => {
4448
// label step status for step component
4549
let status: T.ProgressStatus = 'INCOMPLETE'
4650
let subtasks
47-
if (index < stepIndex || (index === stepIndex && position.complete)) {
51+
if (index < stepIndex) {
4852
status = 'COMPLETE'
4953
} else if (index === stepIndex) {
5054
status = 'ACTIVE'

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const TutorialPage = (props: PageProps) => {
181181
)}
182182
{/* Left */}
183183
<div css={{ flex: 1 }}>
184-
{DISPLAY_RUN_TEST_BUTTON && level.status !== 'COMPLETE' ? (
184+
{DISPLAY_RUN_TEST_BUTTON && level.steps.length && level.status !== 'COMPLETE' ? (
185185
<Button
186186
style={{ marginLeft: '1rem', width: '57px' }}
187187
type="primary"
@@ -221,7 +221,7 @@ const TutorialPage = (props: PageProps) => {
221221
/>
222222
</div>
223223
) : level.steps.length > 1 ? (
224-
<StepProgress current={stepIndex + 1} max={level.steps.length} />
224+
<StepProgress current={stepIndex} max={level.steps.length} />
225225
) : null}
226226
</div>
227227
</footer>

0 commit comments

Comments
 (0)