Skip to content

Commit 2d9c525

Browse files
authored
Merge pull request #400 from coderoad/feature/final-page
level complete message
2 parents c5daacf + 6e96f2a commit 2d9c525

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

Diff for: web-app/src/containers/Tutorial/components/Continue.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,25 @@ const Continue = (props: Props) => {
4343
onClose()
4444
}
4545

46+
const isComplete = props.current === props.max
47+
4648
return (
4749
<>
4850
<Button type="primary" size="medium" onClick={onOpen}>
4951
Continue
5052
</Button>
5153
<Dialog
52-
title="Level Complete!"
54+
title={isComplete ? 'Tutorial Complete!' : 'Level Complete!'}
5355
visible={modalState === 'open'}
5456
onClose={onClose}
5557
footer={false}
5658
css={{ padding: '1rem' }}
5759
>
5860
<div css={styles.content}>
5961
<ProgressPie current={props.current} max={props.max} />
62+
6063
<div css={styles.message}>
61-
<h3>{props.title}</h3>
64+
<h3>{isComplete ? 'Congratulations!' : props.title}</h3>
6265
<br />
6366
<Button type="primary" size="large" onClick={onContinue}>
6467
Continue&nbsp;&nbsp;

Diff for: web-app/stories/Tutorial.stories.tsx

+25-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import SideBarDecorator from './utils/SideBarDecorator'
99
const context: Partial<T.MachineContext> = {
1010
env: { machineId: '', sessionId: '', token: '' },
1111
error: null,
12-
position: { levelId: '2', stepId: '2.2' },
13-
progress: { levels: { '1': true }, steps: { '1.1': true, '1.2': true, '1.3': true, '2.1': true }, complete: false },
1412
processes: [],
1513
testStatus: null,
1614
tutorial: {
@@ -142,12 +140,35 @@ const context: Partial<T.MachineContext> = {
142140
storiesOf('Tutorial', module)
143141
.addDecorator(SideBarDecorator)
144142
.addDecorator(withKnobs)
145-
.add('1 step', () => {
143+
.add('1.1 Start', () => {
146144
const firstLevel = {
147145
...context,
148146
position: { levelId: '1', stepId: '1.2' },
149147
progress: { levels: {}, steps: {}, complete: false },
150148
}
151149
return <Tutorial state="Normal" context={firstLevel} send={action('send')} />
152150
})
153-
.add('3 step', () => <Tutorial state="Normal" context={context} send={action('send')} />)
151+
.add('1.3 Level Complete', () => {
152+
const levelComplete = {
153+
...context,
154+
position: { levelId: '1', stepId: '1.2' },
155+
progress: { levels: {}, steps: { '1.1': true }, complete: false },
156+
}
157+
return <Tutorial state="LevelComplete" context={levelComplete} send={action('send')} />
158+
})
159+
.add('3.1 Level Start', () => {
160+
const newLevel = {
161+
...context,
162+
position: { levelId: '1', stepId: '1.2' },
163+
progress: { levels: { '1': true, '2': true }, steps: {}, complete: false },
164+
}
165+
return <Tutorial state="Normal" context={newLevel} send={action('send')} />
166+
})
167+
.add('3.3 Final', () => {
168+
const lastLevel = {
169+
...context,
170+
position: { levelId: '3', stepId: '3.3' },
171+
progress: { levels: { '3': true }, steps: { '3.3': true }, complete: true },
172+
}
173+
return <Tutorial state="LevelComplete" context={lastLevel} send={action('send')} />
174+
})

0 commit comments

Comments
 (0)