Skip to content

level complete message #400

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 1 commit into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
level complete message
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 22, 2020
commit 6e96f2a5f813a8f75c8f0d926c1b721197307a3d
7 changes: 5 additions & 2 deletions web-app/src/containers/Tutorial/components/Continue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,25 @@ const Continue = (props: Props) => {
onClose()
}

const isComplete = props.current === props.max

return (
<>
<Button type="primary" size="medium" onClick={onOpen}>
Continue
</Button>
<Dialog
title="Level Complete!"
title={isComplete ? 'Tutorial Complete!' : 'Level Complete!'}
visible={modalState === 'open'}
onClose={onClose}
footer={false}
css={{ padding: '1rem' }}
>
<div css={styles.content}>
<ProgressPie current={props.current} max={props.max} />

<div css={styles.message}>
<h3>{props.title}</h3>
<h3>{isComplete ? 'Congratulations!' : props.title}</h3>
<br />
<Button type="primary" size="large" onClick={onContinue}>
Continue&nbsp;&nbsp;
Expand Down
29 changes: 25 additions & 4 deletions web-app/stories/Tutorial.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import SideBarDecorator from './utils/SideBarDecorator'
const context: Partial<T.MachineContext> = {
env: { machineId: '', sessionId: '', token: '' },
error: null,
position: { levelId: '2', stepId: '2.2' },
progress: { levels: { '1': true }, steps: { '1.1': true, '1.2': true, '1.3': true, '2.1': true }, complete: false },
processes: [],
testStatus: null,
tutorial: {
Expand Down Expand Up @@ -142,12 +140,35 @@ const context: Partial<T.MachineContext> = {
storiesOf('Tutorial', module)
.addDecorator(SideBarDecorator)
.addDecorator(withKnobs)
.add('1 step', () => {
.add('1.1 Start', () => {
const firstLevel = {
...context,
position: { levelId: '1', stepId: '1.2' },
progress: { levels: {}, steps: {}, complete: false },
}
return <Tutorial state="Normal" context={firstLevel} send={action('send')} />
})
.add('3 step', () => <Tutorial state="Normal" context={context} send={action('send')} />)
.add('1.3 Level Complete', () => {
const levelComplete = {
...context,
position: { levelId: '1', stepId: '1.2' },
progress: { levels: {}, steps: { '1.1': true }, complete: false },
}
return <Tutorial state="LevelComplete" context={levelComplete} send={action('send')} />
})
.add('3.1 Level Start', () => {
const newLevel = {
...context,
position: { levelId: '1', stepId: '1.2' },
progress: { levels: { '1': true, '2': true }, steps: {}, complete: false },
}
return <Tutorial state="Normal" context={newLevel} send={action('send')} />
})
.add('3.3 Final', () => {
const lastLevel = {
...context,
position: { levelId: '3', stepId: '3.3' },
progress: { levels: { '3': true }, steps: { '3.3': true }, complete: true },
}
return <Tutorial state="LevelComplete" context={lastLevel} send={action('send')} />
})