Skip to content

Fixes/minor #440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2020
Merged
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
13 changes: 9 additions & 4 deletions web-app/src/containers/Tutorial/components/StepProgress.tsx
Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@ const styles = {
display: 'flex' as 'flex',
justifyContent: 'flex-end' as 'flex-end',
alignItems: 'center' as 'center',
width: '10rem',
width: '150px',
color: theme['$color-white'],
marginRight: '-16px',
}),
text: (theme: Theme) => ({
color: theme['$color-white'],
marginRight: '0.5rem',
fontSize: '80%',
marginRight: '5px',
fontSize: '10px',
}),
}

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

const Text = `${props.current} of ${props.max}`
const Text = (
<span style={styles.text(theme)}>
{props.current} of {props.max}
</span>
)

if (isWide) {
return (
6 changes: 5 additions & 1 deletion web-app/src/containers/Tutorial/formatLevels.ts
Original file line number Diff line number Diff line change
@@ -36,6 +36,10 @@ const formatLevels = ({ position, levels, testStatus }: Input): Output => {
stepIndex = levels[levelIndex].steps.length
}

if (position.complete) {
stepIndex += 1
}

// current level
const levelUI: T.LevelUI = {
...currentLevel,
@@ -44,7 +48,7 @@ const formatLevels = ({ position, levels, testStatus }: Input): Output => {
// label step status for step component
let status: T.ProgressStatus = 'INCOMPLETE'
let subtasks
if (index < stepIndex || (index === stepIndex && position.complete)) {
if (index < stepIndex) {
status = 'COMPLETE'
} else if (index === stepIndex) {
status = 'ACTIVE'
4 changes: 2 additions & 2 deletions web-app/src/containers/Tutorial/index.tsx
Original file line number Diff line number Diff line change
@@ -181,7 +181,7 @@ const TutorialPage = (props: PageProps) => {
)}
{/* Left */}
<div css={{ flex: 1 }}>
{DISPLAY_RUN_TEST_BUTTON && level.status !== 'COMPLETE' ? (
{DISPLAY_RUN_TEST_BUTTON && level.steps.length && level.status !== 'COMPLETE' ? (
<Button
style={{ marginLeft: '1rem', width: '57px' }}
type="primary"
@@ -221,7 +221,7 @@ const TutorialPage = (props: PageProps) => {
/>
</div>
) : level.steps.length > 1 ? (
<StepProgress current={stepIndex + 1} max={level.steps.length} />
<StepProgress current={stepIndex} max={level.steps.length} />
) : null}
</div>
</footer>