Skip to content

Feature/about #401

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 3 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
request workspace on completion
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 23, 2020
commit 089288577b20967cea29995848816e890f41f5a8
43 changes: 32 additions & 11 deletions web-app/src/containers/Tutorial/components/CompletedBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as React from 'react'
import { css, jsx } from '@emotion/core'
import { Icon } from '@alifd/next'
import { Button, Icon } from '@alifd/next'

const styles = {
banner: {
height: 'auto',
width: '100%',
backgroundColor: 'rgb(85, 132, 255)',
color: 'white',
padding: '0.5rem',
padding: '0.5rem 1rem',
},
header: {
position: 'relative' as 'relative',
Expand All @@ -26,32 +26,53 @@ const styles = {
section: {
padding: '0rem 0.5rem 1rem 0.5rem',
},
options: {
display: 'flex' as 'flex',
flexDirection: 'row' as 'row',
flexWrap: 'wrap' as 'wrap',
},
optionsLeft: {
flex: 3,
},
optionsRight: {
flex: 1,
display: 'flex' as 'flex',
justifyContent: 'flex-end' as 'flex-end',
alignItems: 'flex-end' as 'flex-end',
},
}

interface Props {
title: string
onRequestWorkspace(): void
}

const CompletedBanner = (props: Props) => {
return (
<div css={styles.banner}>
<div css={styles.header}>
{/* <div css={styles.close} onClick={() => setOpen(false)}>
<Icon type="close" size="xs" />
</div> */}
<h3>
<Icon type="success-filling" size="large" />
<span css={styles.headerMessage}>Congratulations on completing "{props.title}"!</span>
</h3>
</div>
<div css={styles.section}>
<h5>You've reached the end of the road...</h5>
<p>To go down another path:</p>
<ul>
<li>- open a new VSCode workspace</li>
<li>- relaunch the CodeRoad app</li>
<li>- select a new tutorial</li>
</ul>
<div css={styles.options}>
<div css={styles.optionsLeft}>
<p>To go down another path:</p>
<ul>
<li>- open a new VSCode workspace</li>
<li>- relaunch the CodeRoad app</li>
<li>- select a new tutorial</li>
</ul>
</div>
<div css={styles.optionsRight}>
<Button type="primary" ghost="dark" onClick={props.onRequestWorkspace}>
Open New Workspace
</Button>
</div>
</div>
</div>
</div>
)
Expand Down
7 changes: 4 additions & 3 deletions web-app/src/containers/Tutorial/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ const TutorialPage = (props: PageProps) => {

const disableOptions = processes.length > 0 || props.state === 'Level.TestRunning'

console.log(`STATE: ${props.state}`)

return (
<div>
<div css={styles.page}>
Expand All @@ -150,7 +148,10 @@ const TutorialPage = (props: PageProps) => {

{props.state === 'Completed' ? (
<div css={styles.completeFooter}>
<CompletedBanner title={tutorial.summary.title || 'Unknown'} />
<CompletedBanner
title={tutorial.summary.title || 'Unknown'}
onRequestWorkspace={() => props.send({ type: 'REQUEST_WORKSPACE' })}
/>
</div>
) : (
<div css={styles.footer}>
Expand Down
3 changes: 3 additions & 0 deletions web-app/src/services/state/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ export const createMachine = (options: any) => {
target: '#select-new-tutorial',
actions: ['reset'],
},
REQUEST_WORKSPACE: {
actions: 'requestWorkspaceSelect',
},
},
},
},
Expand Down